File tree Expand file tree Collapse file tree 4 files changed +24
-16
lines changed
Expand file tree Collapse file tree 4 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: Release to Github Pages
33
44on :
55 push :
6- branches : [main]
6+ branches : [main, add-wasm-backend ]
77 paths :
88 - ' examples/wasm/**'
99 workflow_dispatch :
Original file line number Diff line number Diff line change 11// Configuration constants
22const CONFIG = {
33 GROUND_HEIGHT : 22 ,
4+ CANVAS : {
5+ WIDTH : 600 ,
6+ HEIGHT : 300 ,
7+ } ,
48 PLAYER : {
59 WIDTH : 80 ,
610 HEIGHT : 40 ,
@@ -70,6 +74,9 @@ const Utils = {
7074
7175// Game elements
7276const canvas = document . getElementById ( "game-canvas" ) ;
77+ canvas . width = CONFIG . CANVAS . WIDTH ;
78+ canvas . height = CONFIG . CANVAS . HEIGHT ;
79+
7380const ctx = canvas . getContext ( "2d" ) ;
7481const UI = {
7582 gameOverMessage : document . getElementById ( "game-over" ) ,
Original file line number Diff line number Diff line change 77 font-style : normal;
88}
99body {
10- display : flex;
11- align-items : center;
12- justify-content : center;
13- flex-direction : column;
1410 min-height : 100vh ;
1511 margin : 0 ;
1612 padding-top : 1.5rem ;
17- background-color : # f0f4f8 ; /* Soft light blue-gray */
18- font-family : 'Silkscreen' , cursive; /* Pixel font for everything */
19- color : # 334e68 ; /* Dark blue-gray text */
13+ background-color : # f0f4f8 ;
14+ font-family : 'Silkscreen' , cursive;
15+ color : # 334e68 ;
2016}
2117body > * {
22- width : 600px ;
23- margin : 0 0 2rem ;
18+ max-width : 600px ;
19+ min-width : 400px ;
20+ margin : 0 auto 2rem ;
2421}
2522h1 , h2 {
26- font-family : 'Press Start 2P' , cursive; /* Pixel font for everything */
23+ font-family : 'Press Start 2P' , cursive;
2724 text-align : center;
2825}
2926h1 {
30- color : # 243b53 ; /* Darker blue-gray for title */
27+ color : # 243b53 ;
3128}
3229h3 {
3330 margin-bottom : 1.5rem ;
@@ -48,7 +45,7 @@ code, p {
4845}
4946p {
5047 font-size : 1.2em ;
51- margin : 0 0 1em ;
48+ margin : 0 auto 1em ;
5249 line-height : 1.3em ;
5350}
5451p code {
@@ -59,17 +56,21 @@ code {
5956}
6057.game-container {
6158 position : relative;
62- width : 600 px ;
63- height : 300 px ;
59+ min- width: 400 px ;
60+ max-width : 600 px ;
6461 border : 4px solid # 9fb3c8 ; /* Muted blue-gray border */
6562 box-sizing : content-box; /* Include padding and border in the element's total width and height */
63+ margin : 0 auto 2rem ;
6664}
6765canvas {
6866 background-color : # 0c0c1f ; /* Dark blue night sky */
6967 image-rendering : pixelated; /* Ensure pixel art stays sharp */
7068 image-rendering : -moz-crisp-edges;
7169 image-rendering : -webkit-crisp-edges;
7270 display : block; /* Remove extra space below canvas */
71+ width : 100% ;
72+ height : 100% ;
73+ aspect-ratio : 600 / 300 ;
7374}
7475.socials a {
7576 float : right;
Original file line number Diff line number Diff line change 2929 </ p >
3030 < h3 > DEMO: Nyan Jump! (WASM Edition)</ h3 >
3131 < div class ="game-container ">
32- < canvas id ="game-canvas " width ="600 " height =" 300 "> </ canvas >
32+ < canvas id ="game-canvas " width ="100% "> </ canvas >
3333 < div id ="game-over "> GAME OVER!</ div >
3434 < button id ="restart-button "> Restart</ button >
3535 < button id ="share-button "> Share on X</ button >
You can’t perform that action at this time.
0 commit comments