Browse Source

tweak website

Thomas B 1 month ago
parent
commit
56d41c91a1
3 changed files with 66 additions and 14 deletions
  1. 63
    7
      docs/index.html
  2. 1
    3
      src/game.c
  3. 2
    4
      src/obj.c

+ 63
- 7
docs/index.html View File

62
         <div class="text">
62
         <div class="text">
63
             <h2>Controls</h2>
63
             <h2>Controls</h2>
64
             <table id="controls" border="1">
64
             <table id="controls" border="1">
65
-                <tr><th>Key</th><th>Action</th></tr>
66
-                <tr><td>Arrow Left</td><td>Rotate Left</td></tr>
67
-                <tr><td>Arrow Right</td><td>Rotate Right</td></tr>
68
-                <tr><td>A (Z)</td><td>Accelerate</td></tr>
69
-                <tr><td>B (X)</td><td>Shoot</td></tr>
70
-                <tr><td>Start (Enter)</td><td>Pause</td></tr>
71
-                <tr><td>Select (V)</td><td>About</td></tr>
65
+                <tr><th>Button</th><th>Key</th><th>Action</th></tr>
66
+                <tr><td>D-Pad Left</td><td>Arrow Left</td><td>Rotate Left</td></tr>
67
+                <tr><td>D-Pad Right</td><td>Arrow Right</td><td>Rotate Right</td></tr>
68
+                <tr><td>A</td><td>S</td><td>Accelerate</td></tr>
69
+                <tr><td>B</td><td>A</td><td>Shoot</td></tr>
70
+                <tr><td>Start</td><td>Enter</td><td>Pause</td></tr>
71
+                <tr><td>Select</td><td>Space</td><td>About</td></tr>
72
             </table>
72
             </table>
73
+            <p>On PCs use keyboard input with the keys given above. On mobile devices a touch overlay should automatically appear over the emulator.</p>
73
         </div>
74
         </div>
74
         <div class="text">
75
         <div class="text">
75
             <h2>Description</h2>
76
             <h2>Description</h2>
104
             EJS_core = "gb";
105
             EJS_core = "gb";
105
             EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/";
106
             EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/";
106
             EJS_gameUrl = "https://xythobuz.github.io/Duality/duality.gb";
107
             EJS_gameUrl = "https://xythobuz.github.io/Duality/duality.gb";
108
+            EJS_alignStartButton = "center";
109
+            EJS_backgroundImage = "https://xythobuz.github.io/Duality/cartridge.png";
110
+            if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
111
+                EJS_backgroundColor = "#111111";
112
+            } else {
113
+                EJS_backgroundColor = "#DDDDDD";
114
+            }
115
+            EJS_defaultControls = {
116
+                0: {
117
+                    0: {
118
+                        'value': 'a',
119
+                        'value2': 'BUTTON_2'
120
+                    },
121
+                    2: {
122
+                        'value': 'space',
123
+                        'value2': 'SELECT'
124
+                    },
125
+                    3: {
126
+                        'value': 'enter',
127
+                        'value2': 'START'
128
+                    },
129
+                    4: {
130
+                        'value': 'up arrow',
131
+                        'value2': 'DPAD_UP'
132
+                    },
133
+                    5: {
134
+                        'value': 'down arrow',
135
+                        'value2': 'DPAD_DOWN'
136
+                    },
137
+                    6: {
138
+                        'value': 'left arrow',
139
+                        'value2': 'DPAD_LEFT'
140
+                    },
141
+                    7: {
142
+                        'value': 'right arrow',
143
+                        'value2': 'DPAD_RIGHT'
144
+                    },
145
+                    8: {
146
+                        'value': 's',
147
+                        'value2': 'BUTTON_1'
148
+                    }
149
+                },
150
+                1: {},
151
+                2: {},
152
+                3: {}
153
+            };
154
+            EJS_onGameStart = function(e) {
155
+                setTimeout(function() {
156
+                    window.EJS_emulator.gameManager.simulateInput(0, 3, 1);
157
+                    setTimeout(function() {
158
+                        window.EJS_emulator.gameManager.simulateInput(0, 3, 0);
159
+                    }, 42);
160
+                }, 420);
161
+            };
162
+            EJS_startButtonName = "Start Duality";
107
         </script>
163
         </script>
108
         <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script>
164
         <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script>
109
     </body>
165
     </body>

+ 1
- 3
src/game.c View File

63
     ACC_R = 4,
63
     ACC_R = 4,
64
 };
64
 };
65
 
65
 
66
-static int16_t spd_x = 0;
67
-static int16_t spd_y = 0;
66
+static int16_t spd_x = 0, spd_y = 0;
68
 static enum SPRITE_ROT rot = 0;
67
 static enum SPRITE_ROT rot = 0;
69
 static enum ACCELERATION acc = 0;
68
 static enum ACCELERATION acc = 0;
70
 static uint16_t health = HEALTH_MAX;
69
 static uint16_t health = HEALTH_MAX;
160
     state.spd_y = spd_y;
159
     state.spd_y = spd_y;
161
 
160
 
162
     state.rot = rot;
161
     state.rot = rot;
163
-
164
     mp_new_state(&state);
162
     mp_new_state(&state);
165
 }
163
 }
166
 
164
 

+ 2
- 4
src/obj.c View File

86
 struct obj {
86
 struct obj {
87
     uint8_t active;
87
     uint8_t active;
88
     enum SPRITES sprite;
88
     enum SPRITES sprite;
89
-    int16_t off_x;
90
-    int16_t off_y;
91
-    int16_t spd_x;
92
-    int16_t spd_y;
89
+    int16_t off_x, off_y;
90
+    int16_t spd_x, spd_y;
93
     uint8_t travel;
91
     uint8_t travel;
94
     uint8_t frame;
92
     uint8_t frame;
95
     uint8_t frame_index;
93
     uint8_t frame_index;

Loading…
Cancel
Save