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,14 +62,15 @@
62 62
         <div class="text">
63 63
             <h2>Controls</h2>
64 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 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 74
         </div>
74 75
         <div class="text">
75 76
             <h2>Description</h2>
@@ -104,6 +105,61 @@
104 105
             EJS_core = "gb";
105 106
             EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/";
106 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 163
         </script>
108 164
         <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script>
109 165
     </body>

+ 1
- 3
src/game.c View File

@@ -63,8 +63,7 @@ enum ACCELERATION {
63 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 67
 static enum SPRITE_ROT rot = 0;
69 68
 static enum ACCELERATION acc = 0;
70 69
 static uint16_t health = HEALTH_MAX;
@@ -160,7 +159,6 @@ void game_get_mp_state(void) NONBANKED {
160 159
     state.spd_y = spd_y;
161 160
 
162 161
     state.rot = rot;
163
-
164 162
     mp_new_state(&state);
165 163
 }
166 164
 

+ 2
- 4
src/obj.c View File

@@ -86,10 +86,8 @@
86 86
 struct obj {
87 87
     uint8_t active;
88 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 91
     uint8_t travel;
94 92
     uint8_t frame;
95 93
     uint8_t frame_index;

Loading…
Cancel
Save