File tree Expand file tree Collapse file tree 2 files changed +26
-33
lines changed
Expand file tree Collapse file tree 2 files changed +26
-33
lines changed Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22< html lang ="en ">
3- < head >
3+ < head >
44 < meta charset ="utf-8 ">
5- < title > C port of Ken Thompson's Space Travel</ title >
5+ < title > Space Travel</ title >
66 < style >
7- html , body {
8- margin : 0 ;
9- padding : 0 ;
10- height : 100% ;
11- display : flex;
12- justify-content : center;
13- align-items : center;
14- background-color : black;
15- }
16- canvas {
17- display : block;
18- max-width : calc (100% - 40px );
19- max-height : calc (100% - 40px );
20- object-fit : contain;
21- margin : 20px ;
22- }
7+ body {
8+ background : black;
9+ }
10+ canvas {
11+ position : absolute;
12+ max-width : 100% ;
13+ max-height : 100% ;
14+ top : 50% ;
15+ left : 50% ;
16+ transform : translate (-50% , -50% );
17+ }
2318 </ style >
24- </ head >
25- < body >
26- < canvas id ="canvas " oncontextmenu ="event.preventDefault() "> </ canvas >
27- < script >
28- var Module = {
29- canvas : ( function ( ) { return document . getElementById ( 'canvas' ) ; } ) ( )
30- } ;
31- </ script >
19+ </ head >
20+ < body >
21+ < canvas id ="canvas "> </ canvas >
22+ < script > Module = { canvas } </ script >
3223 < script src ="st.js "> </ script >
33- </ body >
24+ </ body >
3425</ html >
Original file line number Diff line number Diff line change @@ -941,19 +941,21 @@ void mainloop(void)
941941 displist ();
942942 loop ();
943943 SDL_RenderPresent (renderer );
944+ #ifndef __EMSCRIPTEN__
944945 SDL_Delay (1000 /60 );
946+ #endif
945947 return ;
946948 }
947949
948950 SDL_DestroyRenderer (renderer );
949951 SDL_DestroyWindow (window );
950952 SDL_Quit ();
951953
952- #ifdef __EMSCRIPTEN__
954+ #ifdef __EMSCRIPTEN__
953955 emscripten_cancel_main_loop ();
954- #else
956+ #else
955957 exit (0 );
956- #endif
958+ #endif
957959}
958960
959961int main (void )
@@ -1012,11 +1014,11 @@ int main(void)
10121014
10131015 pbson = SDL_GetKeyboardState (NULL );
10141016
1015- #ifdef __EMSCRIPTEN__
1017+ #ifdef __EMSCRIPTEN__
10161018 emscripten_set_main_loop (mainloop , 0 , 1 );
1017- #else
1019+ #else
10181020 while (1 ) mainloop ();
1019- #endif
1021+ #endif
10201022
10211023 return 0 ;
10221024}
You can’t perform that action at this time.
0 commit comments