| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file controls.cpp |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd August 2005: Created main.c |
| 10 | * - 22nd July 2008: Created util.c from parts of main.c |
| 11 | * - 3rd February 2009: Renamed main.c to main.cpp |
| 12 | * - 13th July 2009: Created controls.cpp from parts of main.cpp |
| 13 | * |
| 14 | * @par Licence: |
| 15 | * Copyright (c) 2005-2017 AJ Thomson |
| 16 | * Copyright (c) 2015-2026 Carsten Teibes |
| 17 | * |
| 18 | * OpenJazz is distributed under the terms of |
| 19 | * the GNU General Public License, version 2.0 |
| 20 | * |
| 21 | * @par Description: |
| 22 | * Deals with input. |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #ifdef OJ_SDL3 |
| 27 | #include <SDL3/SDL.h> |
| 28 | #else |
| 29 | #include <SDL.h> |
| 30 | #endif |
| 31 | |
| 32 | #include "controls.h"cxx . . $ `<file>/src/io/controls.h`/ |
| 33 | #include "gfx/video.h"cxx . . $ `<file>/src/io/gfx/video.h`/ |
| 34 | #include "platforms/platforms.h"cxx . . $ `<file>/src/platforms/platforms.h`/ |
| 35 | #include "loop.h"cxx . . $ `<file>/src/loop.h`/ |
| 36 | |
| 37 | #if !OJ_SDL3 |
| 38 | // Define some stuff to be SDL3 compatible |
| 39 | |
| 40 | #define SDLK_Pcxx . . $ `src/io/controls.cpp:40:10`! SDLK_p |
| 41 | #define SDLK_Ycxx . . $ `src/io/controls.cpp:41:10`! SDLK_y |
| 42 | #define SDLK_Ncxx . . $ `src/io/controls.cpp:42:10`! SDLK_n |
| 43 | |
| 44 | #define SDL_EVENT_JOYSTICK_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:44:10`! SDL_JOYBUTTONDOWN |
| 45 | #define SDL_EVENT_JOYSTICK_BUTTON_UPcxx . . $ `src/io/controls.cpp:45:10`! SDL_JOYBUTTONUP |
| 46 | #define SDL_EVENT_JOYSTICK_BUTTON_UPcxx . . $ `src/io/controls.cpp:46:10`! SDL_JOYBUTTONUP |
| 47 | #define SDL_EVENT_JOYSTICK_AXIS_MOTIONcxx . . $ `src/io/controls.cpp:47:10`! SDL_JOYAXISMOTION |
| 48 | #define SDL_EVENT_JOYSTICK_HAT_MOTIONcxx . . $ `src/io/controls.cpp:48:10`! SDL_JOYHATMOTION |
| 49 | #define SDL_EVENT_MOUSE_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:49:10`! SDL_MOUSEBUTTONDOWN |
| 50 | #define SDL_EVENT_MOUSE_BUTTON_UPcxx . . $ `src/io/controls.cpp:50:10`! SDL_MOUSEBUTTONUP |
| 51 | #define SDL_EVENT_MOUSE_MOTIONcxx . . $ `src/io/controls.cpp:51:10`! SDL_MOUSEMOTION |
| 52 | #define SDL_BUTTON_MASKcxx . . $ `src/io/controls.cpp:52:10`! SDL_BUTTONcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:444:9`! |
| 53 | #endif |
| 54 | |
| 55 | /* Default Keyboard config */ |
| 56 | #ifndef DEFAULT_KEY_UP |
| 57 | #define DEFAULT_KEY_UPcxx . . $ `src/io/controls.cpp:57:10`! (SDLK_UP) |
| 58 | #endif |
| 59 | #ifndef DEFAULT_KEY_DOWN |
| 60 | #define DEFAULT_KEY_DOWNcxx . . $ `src/io/controls.cpp:60:10`! (SDLK_DOWN) |
| 61 | #endif |
| 62 | #ifndef DEFAULT_KEY_LEFT |
| 63 | #define DEFAULT_KEY_LEFTcxx . . $ `src/io/controls.cpp:63:10`! (SDLK_LEFT) |
| 64 | #endif |
| 65 | #ifndef DEFAULT_KEY_RIGHT |
| 66 | #define DEFAULT_KEY_RIGHTcxx . . $ `src/io/controls.cpp:66:10`! (SDLK_RIGHT) |
| 67 | #endif |
| 68 | #ifndef DEFAULT_KEY_JUMP |
| 69 | #define DEFAULT_KEY_JUMPcxx . . $ `src/io/controls.cpp:69:10`! (SDLK_SPACE) |
| 70 | #endif |
| 71 | #ifndef DEFAULT_KEY_SWIM |
| 72 | #define DEFAULT_KEY_SWIMcxx . . $ `src/io/controls.cpp:72:10`! (SDLK_SPACE) |
| 73 | #endif |
| 74 | #ifndef DEFAULT_KEY_FIRE |
| 75 | #define DEFAULT_KEY_FIREcxx . . $ `src/io/controls.cpp:75:10`! (SDLK_LALT) |
| 76 | #endif |
| 77 | #ifndef DEFAULT_KEY_CHANGE |
| 78 | #define DEFAULT_KEY_CHANGEcxx . . $ `src/io/controls.cpp:78:10`! (SDLK_RCTRL) |
| 79 | #endif |
| 80 | #ifndef DEFAULT_KEY_ENTER |
| 81 | #define DEFAULT_KEY_ENTERcxx . . $ `src/io/controls.cpp:81:10`! (SDLK_RETURN) |
| 82 | #endif |
| 83 | #ifndef DEFAULT_KEY_ESCAPE |
| 84 | #define DEFAULT_KEY_ESCAPEcxx . . $ `src/io/controls.cpp:84:10`! (SDLK_ESCAPE) |
| 85 | #endif |
| 86 | #ifndef DEFAULT_KEY_STATS |
| 87 | #define DEFAULT_KEY_STATScxx . . $ `src/io/controls.cpp:87:10`! (SDLK_F9) |
| 88 | #endif |
| 89 | #ifndef DEFAULT_KEY_PAUSE |
| 90 | #define DEFAULT_KEY_PAUSEcxx . . $ `src/io/controls.cpp:90:10`! (SDLK_Pcxx . . $ `src/io/controls.cpp:40:10`!) |
| 91 | #endif |
| 92 | #ifndef DEFAULT_KEY_YES |
| 93 | #define DEFAULT_KEY_YEScxx . . $ `src/io/controls.cpp:93:10`! (SDLK_Ycxx . . $ `src/io/controls.cpp:41:10`!) |
| 94 | #endif |
| 95 | #ifndef DEFAULT_KEY_NO |
| 96 | #define DEFAULT_KEY_NOcxx . . $ `src/io/controls.cpp:96:10`! (SDLK_Ncxx . . $ `src/io/controls.cpp:42:10`!) |
| 97 | #endif |
| 98 | |
| 99 | /* These are optional */ |
| 100 | #ifndef DEFAULT_KEY_BLASTER |
| 101 | #define DEFAULT_KEY_BLASTERcxx . . $ `src/io/controls.cpp:101:10`! (SDLK_1) |
| 102 | #endif |
| 103 | #ifndef DEFAULT_KEY_TOASTER |
| 104 | #define DEFAULT_KEY_TOASTERcxx . . $ `src/io/controls.cpp:104:10`! (SDLK_2) |
| 105 | #endif |
| 106 | #ifndef DEFAULT_KEY_MISSILE |
| 107 | #define DEFAULT_KEY_MISSILEcxx . . $ `src/io/controls.cpp:107:10`! (SDLK_3) |
| 108 | #endif |
| 109 | #ifndef DEFAULT_KEY_BOUNCER |
| 110 | #define DEFAULT_KEY_BOUNCERcxx . . $ `src/io/controls.cpp:110:10`! (SDLK_4) |
| 111 | #endif |
| 112 | #ifndef DEFAULT_KEY_TNT |
| 113 | #define DEFAULT_KEY_TNTcxx . . $ `src/io/controls.cpp:113:10`! (SDLK_5) |
| 114 | #endif |
| 115 | |
| 116 | /* Arbitrary default button config */ |
| 117 | #ifndef DEFAULT_BUTTON_UP |
| 118 | #define DEFAULT_BUTTON_UPcxx . . $ `src/io/controls.cpp:118:10`! (-1) |
| 119 | #endif |
| 120 | #ifndef DEFAULT_BUTTON_DOWN |
| 121 | #define DEFAULT_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:121:10`! (-1) |
| 122 | #endif |
| 123 | #ifndef DEFAULT_BUTTON_LEFT |
| 124 | #define DEFAULT_BUTTON_LEFTcxx . . $ `src/io/controls.cpp:124:10`! (-1) |
| 125 | #endif |
| 126 | #ifndef DEFAULT_BUTTON_RIGHT |
| 127 | #define DEFAULT_BUTTON_RIGHTcxx . . $ `src/io/controls.cpp:127:10`! (-1) |
| 128 | #endif |
| 129 | #ifndef DEFAULT_BUTTON_JUMP |
| 130 | #define DEFAULT_BUTTON_JUMPcxx . . $ `src/io/controls.cpp:130:10`! (1) |
| 131 | #endif |
| 132 | #ifndef DEFAULT_BUTTON_SWIM |
| 133 | #define DEFAULT_BUTTON_SWIMcxx . . $ `src/io/controls.cpp:133:10`! (1) |
| 134 | #endif |
| 135 | #ifndef DEFAULT_BUTTON_FIRE |
| 136 | #define DEFAULT_BUTTON_FIREcxx . . $ `src/io/controls.cpp:136:10`! (0) |
| 137 | #endif |
| 138 | #ifndef DEFAULT_BUTTON_CHANGE |
| 139 | #define DEFAULT_BUTTON_CHANGEcxx . . $ `src/io/controls.cpp:139:10`! (3) |
| 140 | #endif |
| 141 | #ifndef DEFAULT_BUTTON_ENTER |
| 142 | #define DEFAULT_BUTTON_ENTERcxx . . $ `src/io/controls.cpp:142:10`! (0) |
| 143 | #endif |
| 144 | #ifndef DEFAULT_BUTTON_ESCAPE |
| 145 | #define DEFAULT_BUTTON_ESCAPEcxx . . $ `src/io/controls.cpp:145:10`! (5) |
| 146 | #endif |
| 147 | #ifndef DEFAULT_BUTTON_STATS |
| 148 | #define DEFAULT_BUTTON_STATScxx . . $ `src/io/controls.cpp:148:10`! (-1) |
| 149 | #endif |
| 150 | #ifndef DEFAULT_BUTTON_PAUSE |
| 151 | #define DEFAULT_BUTTON_PAUSEcxx . . $ `src/io/controls.cpp:151:10`! (4) |
| 152 | #endif |
| 153 | #ifndef DEFAULT_BUTTON_YES |
| 154 | #define DEFAULT_BUTTON_YEScxx . . $ `src/io/controls.cpp:154:10`! (-1) |
| 155 | #endif |
| 156 | #ifndef DEFAULT_BUTTON_NO |
| 157 | #define DEFAULT_BUTTON_NOcxx . . $ `src/io/controls.cpp:157:10`! (-1) |
| 158 | #endif |
| 159 | |
| 160 | /** |
| 161 | * Set up the default controls. |
| 162 | */ |
| 163 | Controlscxx . . $ Controls#::Controlscxx . . $ Controls#Controls(49f6e7a06ebc5aa8). () { |
| 164 | |
| 165 | int count; |
| 166 | |
| 167 | keyscxx . . $ Controls#keys.[C_UPcxx . . $ `src/io/controls.h:30:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_UPcxx . . $ `src/io/controls.cpp:57:10`!; |
| 168 | keyscxx . . $ Controls#keys.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_DOWNcxx . . $ `src/io/controls.cpp:60:10`!; |
| 169 | keyscxx . . $ Controls#keys.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_LEFTcxx . . $ `src/io/controls.cpp:63:10`!; |
| 170 | keyscxx . . $ Controls#keys.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_RIGHTcxx . . $ `src/io/controls.cpp:66:10`!; |
| 171 | keyscxx . . $ Controls#keys.[C_JUMPcxx . . $ `src/io/controls.h:34:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_JUMPcxx . . $ `src/io/controls.cpp:69:10`!; |
| 172 | keyscxx . . $ Controls#keys.[C_SWIMcxx . . $ `src/io/controls.h:35:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_SWIMcxx . . $ `src/io/controls.cpp:72:10`!; |
| 173 | keyscxx . . $ Controls#keys.[C_FIREcxx . . $ `src/io/controls.h:36:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_FIREcxx . . $ `src/io/controls.cpp:75:10`!; |
| 174 | keyscxx . . $ Controls#keys.[C_CHANGEcxx . . $ `src/io/controls.h:37:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_CHANGEcxx . . $ `src/io/controls.cpp:78:10`!; |
| 175 | keyscxx . . $ Controls#keys.[C_ENTERcxx . . $ `src/io/controls.h:38:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_ENTERcxx . . $ `src/io/controls.cpp:81:10`!; |
| 176 | keyscxx . . $ Controls#keys.[C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_ESCAPEcxx . . $ `src/io/controls.cpp:84:10`!; |
| 177 | keyscxx . . $ Controls#keys.[C_BLASTERcxx . . $ `src/io/controls.h:40:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_BLASTERcxx . . $ `src/io/controls.cpp:101:10`!; |
| 178 | keyscxx . . $ Controls#keys.[C_TOASTERcxx . . $ `src/io/controls.h:41:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_TOASTERcxx . . $ `src/io/controls.cpp:104:10`!; |
| 179 | keyscxx . . $ Controls#keys.[C_MISSILEcxx . . $ `src/io/controls.h:42:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_MISSILEcxx . . $ `src/io/controls.cpp:107:10`!; |
| 180 | keyscxx . . $ Controls#keys.[C_BOUNCERcxx . . $ `src/io/controls.h:43:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_BOUNCERcxx . . $ `src/io/controls.cpp:110:10`!; |
| 181 | keyscxx . . $ Controls#keys.[C_TNTcxx . . $ `src/io/controls.h:44:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_TNTcxx . . $ `src/io/controls.cpp:113:10`!; |
| 182 | keyscxx . . $ Controls#keys.[C_STATScxx . . $ `src/io/controls.h:45:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_STATScxx . . $ `src/io/controls.cpp:87:10`!; |
| 183 | keyscxx . . $ Controls#keys.[C_PAUSEcxx . . $ `src/io/controls.h:46:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_PAUSEcxx . . $ `src/io/controls.cpp:90:10`!; |
| 184 | keyscxx . . $ Controls#keys.[C_YEScxx . . $ `src/io/controls.h:47:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_YEScxx . . $ `src/io/controls.cpp:93:10`!; |
| 185 | keyscxx . . $ Controls#keys.[C_NOcxx . . $ `src/io/controls.h:48:9`!].keycxx . . $ Controls#$anonymous_type_0#key. = DEFAULT_KEY_NOcxx . . $ `src/io/controls.cpp:96:10`!; |
| 186 | |
| 187 | |
| 188 | buttonscxx . . $ Controls#buttons.[C_UPcxx . . $ `src/io/controls.h:30:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_UPcxx . . $ `src/io/controls.cpp:118:10`!; |
| 189 | buttonscxx . . $ Controls#buttons.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:121:10`!; |
| 190 | buttonscxx . . $ Controls#buttons.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_LEFTcxx . . $ `src/io/controls.cpp:124:10`!; |
| 191 | buttonscxx . . $ Controls#buttons.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_RIGHTcxx . . $ `src/io/controls.cpp:127:10`!; |
| 192 | buttonscxx . . $ Controls#buttons.[C_JUMPcxx . . $ `src/io/controls.h:34:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_JUMPcxx . . $ `src/io/controls.cpp:130:10`!; |
| 193 | buttonscxx . . $ Controls#buttons.[C_SWIMcxx . . $ `src/io/controls.h:35:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_SWIMcxx . . $ `src/io/controls.cpp:133:10`!; |
| 194 | buttonscxx . . $ Controls#buttons.[C_FIREcxx . . $ `src/io/controls.h:36:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_FIREcxx . . $ `src/io/controls.cpp:136:10`!; |
| 195 | buttonscxx . . $ Controls#buttons.[C_CHANGEcxx . . $ `src/io/controls.h:37:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_CHANGEcxx . . $ `src/io/controls.cpp:139:10`!; |
| 196 | buttonscxx . . $ Controls#buttons.[C_ENTERcxx . . $ `src/io/controls.h:38:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_ENTERcxx . . $ `src/io/controls.cpp:142:10`!; |
| 197 | buttonscxx . . $ Controls#buttons.[C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_ESCAPEcxx . . $ `src/io/controls.cpp:145:10`!; |
| 198 | buttonscxx . . $ Controls#buttons.[C_BLASTERcxx . . $ `src/io/controls.h:40:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = -1; |
| 199 | buttonscxx . . $ Controls#buttons.[C_TOASTERcxx . . $ `src/io/controls.h:41:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = -1; |
| 200 | buttonscxx . . $ Controls#buttons.[C_MISSILEcxx . . $ `src/io/controls.h:42:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = -1; |
| 201 | buttonscxx . . $ Controls#buttons.[C_BOUNCERcxx . . $ `src/io/controls.h:43:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = -1; |
| 202 | buttonscxx . . $ Controls#buttons.[C_TNTcxx . . $ `src/io/controls.h:44:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = -1; |
| 203 | buttonscxx . . $ Controls#buttons.[C_STATScxx . . $ `src/io/controls.h:45:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_STATScxx . . $ `src/io/controls.cpp:148:10`!; |
| 204 | buttonscxx . . $ Controls#buttons.[C_PAUSEcxx . . $ `src/io/controls.h:46:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_PAUSEcxx . . $ `src/io/controls.cpp:151:10`!; |
| 205 | buttonscxx . . $ Controls#buttons.[C_YEScxx . . $ `src/io/controls.h:47:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_YEScxx . . $ `src/io/controls.cpp:154:10`!; |
| 206 | buttonscxx . . $ Controls#buttons.[C_NOcxx . . $ `src/io/controls.h:48:9`!].buttoncxx . . $ Controls#$anonymous_type_1#button. = DEFAULT_BUTTON_NOcxx . . $ `src/io/controls.cpp:157:10`!; |
| 207 | |
| 208 | |
| 209 | axescxx . . $ Controls#axes.[C_UPcxx . . $ `src/io/controls.h:30:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = 1; |
| 210 | axescxx . . $ Controls#axes.[C_UPcxx . . $ `src/io/controls.h:30:9`!].directioncxx . . $ Controls#$anonymous_type_2#direction. = false; |
| 211 | axescxx . . $ Controls#axes.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = 1; |
| 212 | axescxx . . $ Controls#axes.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].directioncxx . . $ Controls#$anonymous_type_2#direction. = true; |
| 213 | axescxx . . $ Controls#axes.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = 0; |
| 214 | axescxx . . $ Controls#axes.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].directioncxx . . $ Controls#$anonymous_type_2#direction. = false; |
| 215 | axescxx . . $ Controls#axes.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = 0; |
| 216 | axescxx . . $ Controls#axes.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].directioncxx . . $ Controls#$anonymous_type_2#direction. = true; |
| 217 | axescxx . . $ Controls#axes.[C_JUMPcxx . . $ `src/io/controls.h:34:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 218 | axescxx . . $ Controls#axes.[C_SWIMcxx . . $ `src/io/controls.h:35:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 219 | axescxx . . $ Controls#axes.[C_FIREcxx . . $ `src/io/controls.h:36:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 220 | axescxx . . $ Controls#axes.[C_CHANGEcxx . . $ `src/io/controls.h:37:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 221 | axescxx . . $ Controls#axes.[C_ENTERcxx . . $ `src/io/controls.h:38:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 222 | axescxx . . $ Controls#axes.[C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 223 | axescxx . . $ Controls#axes.[C_BLASTERcxx . . $ `src/io/controls.h:40:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 224 | axescxx . . $ Controls#axes.[C_TOASTERcxx . . $ `src/io/controls.h:41:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 225 | axescxx . . $ Controls#axes.[C_MISSILEcxx . . $ `src/io/controls.h:42:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 226 | axescxx . . $ Controls#axes.[C_BOUNCERcxx . . $ `src/io/controls.h:43:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 227 | axescxx . . $ Controls#axes.[C_TNTcxx . . $ `src/io/controls.h:44:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 228 | axescxx . . $ Controls#axes.[C_STATScxx . . $ `src/io/controls.h:45:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 229 | axescxx . . $ Controls#axes.[C_PAUSEcxx . . $ `src/io/controls.h:46:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 230 | axescxx . . $ Controls#axes.[C_YEScxx . . $ `src/io/controls.h:47:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 231 | axescxx . . $ Controls#axes.[C_NOcxx . . $ `src/io/controls.h:48:9`!].axiscxx . . $ Controls#$anonymous_type_2#axis. = -1; |
| 232 | |
| 233 | |
| 234 | hatscxx . . $ Controls#hats.[C_UPcxx . . $ `src/io/controls.h:30:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = 0; |
| 235 | hatscxx . . $ Controls#hats.[C_UPcxx . . $ `src/io/controls.h:30:9`!].directioncxx . . $ Controls#$anonymous_type_3#direction. = SDL_HAT_UPcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:882:9`!; |
| 236 | hatscxx . . $ Controls#hats.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = 0; |
| 237 | hatscxx . . $ Controls#hats.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].directioncxx . . $ Controls#$anonymous_type_3#direction. = SDL_HAT_DOWNcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:884:9`!; |
| 238 | hatscxx . . $ Controls#hats.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = 0; |
| 239 | hatscxx . . $ Controls#hats.[C_LEFTcxx . . $ `src/io/controls.h:32:9`!].directioncxx . . $ Controls#$anonymous_type_3#direction. = SDL_HAT_LEFTcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:885:9`!; |
| 240 | hatscxx . . $ Controls#hats.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = 0; |
| 241 | hatscxx . . $ Controls#hats.[C_RIGHTcxx . . $ `src/io/controls.h:33:9`!].directioncxx . . $ Controls#$anonymous_type_3#direction. = SDL_HAT_RIGHTcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:883:9`!; |
| 242 | hatscxx . . $ Controls#hats.[C_JUMPcxx . . $ `src/io/controls.h:34:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 243 | hatscxx . . $ Controls#hats.[C_SWIMcxx . . $ `src/io/controls.h:35:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 244 | hatscxx . . $ Controls#hats.[C_FIREcxx . . $ `src/io/controls.h:36:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 245 | hatscxx . . $ Controls#hats.[C_CHANGEcxx . . $ `src/io/controls.h:37:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 246 | hatscxx . . $ Controls#hats.[C_ENTERcxx . . $ `src/io/controls.h:38:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 247 | hatscxx . . $ Controls#hats.[C_ESCAPEcxx . . $ `src/io/controls.h:39:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 248 | hatscxx . . $ Controls#hats.[C_BLASTERcxx . . $ `src/io/controls.h:40:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 249 | hatscxx . . $ Controls#hats.[C_TOASTERcxx . . $ `src/io/controls.h:41:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 250 | hatscxx . . $ Controls#hats.[C_MISSILEcxx . . $ `src/io/controls.h:42:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 251 | hatscxx . . $ Controls#hats.[C_BOUNCERcxx . . $ `src/io/controls.h:43:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 252 | hatscxx . . $ Controls#hats.[C_TNTcxx . . $ `src/io/controls.h:44:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 253 | hatscxx . . $ Controls#hats.[C_STATScxx . . $ `src/io/controls.h:45:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 254 | hatscxx . . $ Controls#hats.[C_PAUSEcxx . . $ `src/io/controls.h:46:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 255 | hatscxx . . $ Controls#hats.[C_YEScxx . . $ `src/io/controls.h:47:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 256 | hatscxx . . $ Controls#hats.[C_NOcxx . . $ `src/io/controls.h:48:9`!].hatcxx . . $ Controls#$anonymous_type_3#hat. = -1; |
| 257 | |
| 258 | |
| 259 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) { |
| 260 | |
| 261 | keyscxx . . $ Controls#keys.[count].pressedcxx . . $ Controls#$anonymous_type_0#pressed. = false; |
| 262 | buttonscxx . . $ Controls#buttons.[count].pressedcxx . . $ Controls#$anonymous_type_1#pressed. = false; |
| 263 | axescxx . . $ Controls#axes.[count].pressedcxx . . $ Controls#$anonymous_type_2#pressed. = false; |
| 264 | hatscxx . . $ Controls#hats.[count].pressedcxx . . $ Controls#$anonymous_type_3#pressed. = false; |
| 265 | |
| 266 | controlstatescxx . . $ Controls#controlstates.[count].timecxx . . $ Controls#$anonymous_type_4#time. = 0; |
| 267 | controlstatescxx . . $ Controls#controlstates.[count].statecxx . . $ Controls#$anonymous_type_4#state. = false; |
| 268 | |
| 269 | } |
| 270 | |
| 271 | cursorXcxx . . $ Controls#cursorX. = cursorYcxx . . $ Controls#cursorY. = 0; |
| 272 | cursorPressedcxx . . $ Controls#cursorPressed. = cursorReleasedcxx . . $ Controls#cursorReleased. = false; |
| 273 | wheelUpcxx . . $ Controls#wheelUp. = wheelDowncxx . . $ Controls#wheelDown. = 0; |
| 274 | |
| 275 | } |
| 276 | |
| 277 | void Controlscxx . . $ Controls#::initcxx . . $ Controls#init(49f6e7a06ebc5aa8).() { |
| 278 | #if OJ_SDL3 |
| 279 | if(SDL_HasJoystick()) SDL_OpenJoystick(0); |
| 280 | #else |
| 281 | if (SDL_NumJoysticks() > 0) SDL_JoystickOpen(0); |
| 282 | #endif |
| 283 | } |
| 284 | |
| 285 | void Controlscxx . . $ Controls#::deinitcxx . . $ Controls#deinit(49f6e7a06ebc5aa8).() { |
| 286 | #if OJ_SDL3 |
| 287 | if(SDL_HasJoystick()) SDL_CloseJoystick(0); |
| 288 | #else |
| 289 | if (SDL_NumJoysticks() > 0) SDL_JoystickClose(0); |
| 290 | #endif |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Set the key to use for the specified control. |
| 295 | * |
| 296 | * @param control The control |
| 297 | * @param key The key to use |
| 298 | */ |
| 299 | void Controlscxx . . $ Controls#::setKeycxx . . $ Controls#setKey(3e454b8ccf442868). (int control, int key) { |
| 300 | |
| 301 | keyscxx . . $ Controls#keys.[control].keycxx . . $ Controls#$anonymous_type_0#key. = key; |
| 302 | keyscxx . . $ Controls#keys.[control].pressedcxx . . $ Controls#$anonymous_type_0#pressed. = false; |
| 303 | |
| 304 | } |
| 305 | |
| 306 | |
| 307 | /** |
| 308 | * Set the button to use for the specified control. |
| 309 | * |
| 310 | * @param control The control |
| 311 | * @param button The button to use |
| 312 | */ |
| 313 | void Controlscxx . . $ Controls#::setButtoncxx . . $ Controls#setButton(3e454b8ccf442868). (int control, int button) { |
| 314 | |
| 315 | buttonscxx . . $ Controls#buttons.[control].buttoncxx . . $ Controls#$anonymous_type_1#button. = button; |
| 316 | buttonscxx . . $ Controls#buttons.[control].pressedcxx . . $ Controls#$anonymous_type_1#pressed. = false; |
| 317 | |
| 318 | } |
| 319 | |
| 320 | |
| 321 | /** |
| 322 | * Set the axis and direction to use for the specified control. |
| 323 | * |
| 324 | * @param control The control |
| 325 | * @param axis The axis to use |
| 326 | * @param direction Whether or not to use positive axis values |
| 327 | */ |
| 328 | void Controlscxx . . $ Controls#::setAxiscxx . . $ Controls#setAxis(6908015b96d379c0). (int control, int axis, bool direction) { |
| 329 | |
| 330 | axescxx . . $ Controls#axes.[control].axiscxx . . $ Controls#$anonymous_type_2#axis. = axis; |
| 331 | axescxx . . $ Controls#axes.[control].directioncxx . . $ Controls#$anonymous_type_2#direction. = direction; |
| 332 | axescxx . . $ Controls#axes.[control].pressedcxx . . $ Controls#$anonymous_type_2#pressed. = false; |
| 333 | |
| 334 | } |
| 335 | |
| 336 | |
| 337 | /** |
| 338 | * Set the hat and direction to use for the specified control. |
| 339 | * |
| 340 | * @param control The control |
| 341 | * @param hat The hat to use |
| 342 | * @param direction The direction to use |
| 343 | */ |
| 344 | void Controlscxx . . $ Controls#::setHatcxx . . $ Controls#setHat(b1146eedae1e1d0b). (int control, int hat, int direction) { |
| 345 | |
| 346 | hatscxx . . $ Controls#hats.[control].hatcxx . . $ Controls#$anonymous_type_3#hat. = hat; |
| 347 | hatscxx . . $ Controls#hats.[control].directioncxx . . $ Controls#$anonymous_type_3#direction. = direction; |
| 348 | hatscxx . . $ Controls#hats.[control].pressedcxx . . $ Controls#$anonymous_type_3#pressed. = false; |
| 349 | |
| 350 | } |
| 351 | |
| 352 | |
| 353 | /** |
| 354 | * Get the key being used for the specified control. |
| 355 | * |
| 356 | * @param control The control |
| 357 | * |
| 358 | * @return The key being used |
| 359 | */ |
| 360 | int Controlscxx . . $ Controls#::getKeycxx . . $ Controls#getKey(7864480464b09eea). (int control) { |
| 361 | |
| 362 | return keyscxx . . $ Controls#keys.[control].keycxx . . $ Controls#$anonymous_type_0#key.; |
| 363 | |
| 364 | } |
| 365 | |
| 366 | |
| 367 | /** |
| 368 | * Get the button being used for the specified control. |
| 369 | * |
| 370 | * @param control The control |
| 371 | * |
| 372 | * @return The button being used |
| 373 | */ |
| 374 | int Controlscxx . . $ Controls#::getButtoncxx . . $ Controls#getButton(7864480464b09eea). (int control) { |
| 375 | |
| 376 | return buttonscxx . . $ Controls#buttons.[control].buttoncxx . . $ Controls#$anonymous_type_1#button.; |
| 377 | |
| 378 | } |
| 379 | |
| 380 | |
| 381 | /** |
| 382 | * Get the axis being used for the specified control. |
| 383 | * |
| 384 | * @param control The control |
| 385 | * |
| 386 | * @return The axis being used |
| 387 | */ |
| 388 | int Controlscxx . . $ Controls#::getAxiscxx . . $ Controls#getAxis(7864480464b09eea). (int control) { |
| 389 | |
| 390 | return axescxx . . $ Controls#axes.[control].axiscxx . . $ Controls#$anonymous_type_2#axis.; |
| 391 | |
| 392 | } |
| 393 | |
| 394 | |
| 395 | /** |
| 396 | * Get the direction of the axis being used for the specified control. |
| 397 | * |
| 398 | * @param control The control |
| 399 | * |
| 400 | * @return True if positive values of the axis are being used |
| 401 | */ |
| 402 | int Controlscxx . . $ Controls#::getAxisDirectioncxx . . $ Controls#getAxisDirection(7864480464b09eea). (int control) { |
| 403 | |
| 404 | return axescxx . . $ Controls#axes.[control].directioncxx . . $ Controls#$anonymous_type_2#direction.; |
| 405 | |
| 406 | } |
| 407 | |
| 408 | |
| 409 | /** |
| 410 | * Get the hat being used for the specified control. |
| 411 | * |
| 412 | * @param control The control |
| 413 | * |
| 414 | * @return The hat being used |
| 415 | */ |
| 416 | int Controlscxx . . $ Controls#::getHatcxx . . $ Controls#getHat(7864480464b09eea). (int control) { |
| 417 | |
| 418 | return hatscxx . . $ Controls#hats.[control].hatcxx . . $ Controls#$anonymous_type_3#hat.; |
| 419 | |
| 420 | } |
| 421 | |
| 422 | |
| 423 | /** |
| 424 | * Get the direction of the hat being used for the specified control. |
| 425 | * |
| 426 | * @param control The control |
| 427 | * |
| 428 | * @return hat direction |
| 429 | */ |
| 430 | int Controlscxx . . $ Controls#::getHatDirectioncxx . . $ Controls#getHatDirection(7864480464b09eea). (int control) { |
| 431 | |
| 432 | return hatscxx . . $ Controls#hats.[control].directioncxx . . $ Controls#$anonymous_type_3#direction.; |
| 433 | |
| 434 | } |
| 435 | |
| 436 | |
| 437 | /** |
| 438 | * Set the position and state of the cursor. |
| 439 | * |
| 440 | * @param x The x-coordinate of the cursor |
| 441 | * @param y The y-coordinate of the cursor |
| 442 | * @param pressed The state of the cursor |
| 443 | */ |
| 444 | void Controlscxx . . $ Controls#::setCursorcxx . . $ Controls#setCursor(6908015b96d379c0).(int x, int y, bool pressed) { |
| 445 | |
| 446 | cursorXcxx . . $ Controls#cursorX. = x; |
| 447 | cursorYcxx . . $ Controls#cursorY. = y; |
| 448 | cursorPressedcxx . . $ Controls#cursorPressed. = pressed; |
| 449 | cursorReleasedcxx . . $ Controls#cursorReleased. = !pressed; |
| 450 | |
| 451 | } |
| 452 | |
| 453 | |
| 454 | /** |
| 455 | * Update controls based on a system event. |
| 456 | * |
| 457 | * @param event The system event. Non-input events will be ignored |
| 458 | * @param type Type of loop. Normal, typing, or input configuration |
| 459 | * |
| 460 | * @return Error code |
| 461 | */ |
| 462 | int Controlscxx . . $ Controls#::updatecxx . . $ Controls#update(db42b6765f9e21b0). (SDL_Event *event, LoopTypecxx . . $ LoopType# type) { |
| 463 | |
| 464 | int count; |
| 465 | |
| 466 | count = CONTROLScxx . . $ `src/io/controls.h:50:9`!; |
| 467 | |
| 468 | switch (event->typecxx . . $ SDL_Event#type.) { |
| 469 | #if OJ_SDL3 |
| 470 | case SDL_EVENT_KEY_DOWN: |
| 471 | if (type == SET_KEY_LOOP) return event->key.key; |
| 472 | |
| 473 | for (count = 0; count < CONTROLS; count++) |
| 474 | if (event->key.key == (unsigned int)keys[count].key) |
| 475 | keys[count].pressed = true; |
| 476 | |
| 477 | if (type == TYPING_LOOP) return event->key.key; |
| 478 | #else |
| 479 | case SDL_KEYDOWN: |
| 480 | if (type == SET_KEY_LOOPcxx . . $ SET_KEY_LOOP.) return event->keycxx . . $ SDL_Event#key..keysym.sym; |
| 481 | |
| 482 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 483 | if (event->keycxx . . $ SDL_Event#key..keysym.sym == keyscxx . . $ Controls#keys.[count].keycxx . . $ Controls#$anonymous_type_0#key.) |
| 484 | keyscxx . . $ Controls#keys.[count].pressedcxx . . $ Controls#$anonymous_type_0#pressed. = true; |
| 485 | |
| 486 | if (type == TYPING_LOOPcxx . . $ TYPING_LOOP.) return event->keycxx . . $ SDL_Event#key..keysym.sym; |
| 487 | #endif |
| 488 | |
| 489 | break; |
| 490 | |
| 491 | #if OJ_SDL3 |
| 492 | case SDL_EVENT_KEY_UP: |
| 493 | for (count = 0; count < CONTROLS; count++) |
| 494 | if (event->key.key == (unsigned int)keys[count].key) |
| 495 | keys[count].pressed = false; |
| 496 | #else |
| 497 | case SDL_KEYUP: |
| 498 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 499 | if (event->keycxx . . $ SDL_Event#key..keysym.sym == keyscxx . . $ Controls#keys.[count].keycxx . . $ Controls#$anonymous_type_0#key.) |
| 500 | keyscxx . . $ Controls#keys.[count].pressedcxx . . $ Controls#$anonymous_type_0#pressed. = false; |
| 501 | #endif |
| 502 | |
| 503 | break; |
| 504 | |
| 505 | case SDL_EVENT_JOYSTICK_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:44:10`!: |
| 506 | if (type == SET_JOYSTICK_LOOPcxx . . $ SET_JOYSTICK_LOOP.) return JOYSTICKBcxx . . $ `src/loop.h:31:9`! | event->jbuttoncxx . . $ SDL_Event#jbutton..button; |
| 507 | |
| 508 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 509 | if (event->jbuttoncxx . . $ SDL_Event#jbutton..button == buttonscxx . . $ Controls#buttons.[count].buttoncxx . . $ Controls#$anonymous_type_1#button.) |
| 510 | buttonscxx . . $ Controls#buttons.[count].pressedcxx . . $ Controls#$anonymous_type_1#pressed. = true; |
| 511 | |
| 512 | break; |
| 513 | |
| 514 | case SDL_EVENT_JOYSTICK_BUTTON_UPcxx . . $ `src/io/controls.cpp:46:10`!: |
| 515 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 516 | if (event->jbuttoncxx . . $ SDL_Event#jbutton..button == buttonscxx . . $ Controls#buttons.[count].buttoncxx . . $ Controls#$anonymous_type_1#button.) |
| 517 | buttonscxx . . $ Controls#buttons.[count].pressedcxx . . $ Controls#$anonymous_type_1#pressed. = false; |
| 518 | |
| 519 | break; |
| 520 | |
| 521 | case SDL_EVENT_JOYSTICK_AXIS_MOTIONcxx . . $ `src/io/controls.cpp:47:10`!: |
| 522 | if (type == SET_JOYSTICK_LOOPcxx . . $ SET_JOYSTICK_LOOP.) { |
| 523 | |
| 524 | if (event->jaxiscxx . . $ SDL_Event#jaxis..value < -16384) |
| 525 | return JOYSTICKANEGcxx . . $ `src/loop.h:32:9`! | event->jaxiscxx . . $ SDL_Event#jaxis..axis; |
| 526 | else if (event->jaxiscxx . . $ SDL_Event#jaxis..value > 16384) |
| 527 | return JOYSTICKAPOScxx . . $ `src/loop.h:33:9`! | event->jaxiscxx . . $ SDL_Event#jaxis..axis; |
| 528 | |
| 529 | } |
| 530 | |
| 531 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 532 | if (event->jaxiscxx . . $ SDL_Event#jaxis..axis == axescxx . . $ Controls#axes.[count].axiscxx . . $ Controls#$anonymous_type_2#axis.) { |
| 533 | |
| 534 | if (!axescxx . . $ Controls#axes.[count].directioncxx . . $ Controls#$anonymous_type_2#direction. && (event->jaxiscxx . . $ SDL_Event#jaxis..value < -16384)) |
| 535 | axescxx . . $ Controls#axes.[count].pressedcxx . . $ Controls#$anonymous_type_2#pressed. = true; |
| 536 | else if (axescxx . . $ Controls#axes.[count].directioncxx . . $ Controls#$anonymous_type_2#direction. && (event->jaxiscxx . . $ SDL_Event#jaxis..value > 16384)) |
| 537 | axescxx . . $ Controls#axes.[count].pressedcxx . . $ Controls#$anonymous_type_2#pressed. = true; |
| 538 | else |
| 539 | axescxx . . $ Controls#axes.[count].pressedcxx . . $ Controls#$anonymous_type_2#pressed. = false; |
| 540 | |
| 541 | } |
| 542 | |
| 543 | break; |
| 544 | |
| 545 | case SDL_EVENT_JOYSTICK_HAT_MOTIONcxx . . $ `src/io/controls.cpp:48:10`!: |
| 546 | if (type == SET_JOYSTICK_LOOPcxx . . $ SET_JOYSTICK_LOOP.) { |
| 547 | |
| 548 | switch(event->jhatcxx . . $ SDL_Event#jhat..value) { |
| 549 | case SDL_HAT_UPcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:882:9`!: |
| 550 | return JOYSTICKHUPcxx . . $ `src/loop.h:34:9`! | event->jhatcxx . . $ SDL_Event#jhat..hat; |
| 551 | case SDL_HAT_LEFTcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:885:9`!: |
| 552 | return JOYSTICKHLFTcxx . . $ `src/loop.h:35:9`! | event->jhatcxx . . $ SDL_Event#jhat..hat; |
| 553 | case SDL_HAT_RIGHTcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:883:9`!: |
| 554 | return JOYSTICKHRHTcxx . . $ `src/loop.h:36:9`! | event->jhatcxx . . $ SDL_Event#jhat..hat; |
| 555 | case SDL_HAT_DOWNcxx . . $ `<external>/17049259561641565683/SDL_joystick.h:884:9`!: |
| 556 | return JOYSTICKHDWNcxx . . $ `src/loop.h:37:9`! | event->jhatcxx . . $ SDL_Event#jhat..hat; |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | for(count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 561 | if (event->jhatcxx . . $ SDL_Event#jhat..hat == hatscxx . . $ Controls#hats.[count].hatcxx . . $ Controls#$anonymous_type_3#hat.) { |
| 562 | |
| 563 | if (hatscxx . . $ Controls#hats.[count].directioncxx . . $ Controls#$anonymous_type_3#direction. & event->jhatcxx . . $ SDL_Event#jhat..value) |
| 564 | hatscxx . . $ Controls#hats.[count].pressedcxx . . $ Controls#$anonymous_type_3#pressed. = true; |
| 565 | else |
| 566 | hatscxx . . $ Controls#hats.[count].pressedcxx . . $ Controls#$anonymous_type_3#pressed. = false; |
| 567 | |
| 568 | } |
| 569 | |
| 570 | break; |
| 571 | |
| 572 | case SDL_EVENT_MOUSE_MOTIONcxx . . $ `src/io/controls.cpp:51:10`!: |
| 573 | if(event->motioncxx . . $ SDL_Event#motion..state & SDL_BUTTON_MASKcxx . . $ `src/io/controls.cpp:52:10`!(1)) |
| 574 | setCursorcxx . . $ Controls#setCursor(6908015b96d379c0).(event->motioncxx . . $ SDL_Event#motion..x, event->motioncxx . . $ SDL_Event#motion..y, true); |
| 575 | |
| 576 | break; |
| 577 | |
| 578 | case SDL_EVENT_MOUSE_BUTTON_DOWNcxx . . $ `src/io/controls.cpp:49:10`!: |
| 579 | if (event->buttoncxx . . $ SDL_Event#button..button == SDL_BUTTON_LEFTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:445:9`!) { |
| 580 | |
| 581 | setCursorcxx . . $ Controls#setCursor(6908015b96d379c0).(event->buttoncxx . . $ SDL_Event#button..x, event->buttoncxx . . $ SDL_Event#button..y, true); |
| 582 | |
| 583 | } else if (event->buttoncxx . . $ SDL_Event#button..button == 4) { |
| 584 | |
| 585 | wheelUpcxx . . $ Controls#wheelUp.++; |
| 586 | |
| 587 | } else if (event->buttoncxx . . $ SDL_Event#button..button == 5) { |
| 588 | |
| 589 | wheelDowncxx . . $ Controls#wheelDown.++; |
| 590 | |
| 591 | } |
| 592 | |
| 593 | break; |
| 594 | |
| 595 | case SDL_EVENT_MOUSE_BUTTON_UPcxx . . $ `src/io/controls.cpp:50:10`!: |
| 596 | if (event->buttoncxx . . $ SDL_Event#button..button == SDL_BUTTON_LEFTcxx . . $ `<external>/13849749812924280863/SDL_mouse.h:445:9`!) { |
| 597 | |
| 598 | setCursorcxx . . $ Controls#setCursor(6908015b96d379c0).(event->buttoncxx . . $ SDL_Event#button..x, event->buttoncxx . . $ SDL_Event#button..y, false); |
| 599 | |
| 600 | } |
| 601 | |
| 602 | break; |
| 603 | |
| 604 | } |
| 605 | |
| 606 | return E_NONEcxx . . $ `src/OpenJazz.h:69:9`!; |
| 607 | |
| 608 | } |
| 609 | |
| 610 | |
| 611 | /** |
| 612 | * Process input iteration. |
| 613 | * |
| 614 | * Called once per game iteration. Updates input. |
| 615 | */ |
| 616 | void Controlscxx . . $ Controls#::loopcxx . . $ Controls#loop(49f6e7a06ebc5aa8). () { |
| 617 | |
| 618 | int count; |
| 619 | |
| 620 | // Apply controls to universal control tracking |
| 621 | for (count = 0; count < CONTROLScxx . . $ `src/io/controls.h:50:9`!; count++) |
| 622 | controlstatescxx . . $ Controls#controlstates.[count].statecxx . . $ Controls#$anonymous_type_4#state. = (controlstatescxx . . $ Controls#controlstates.[count].timecxx . . $ Controls#$anonymous_type_4#time. < globalTickscxx . . $ globalTicks.) && |
| 623 | (keyscxx . . $ Controls#keys.[count].pressedcxx . . $ Controls#$anonymous_type_0#pressed. || buttonscxx . . $ Controls#buttons.[count].pressedcxx . . $ Controls#$anonymous_type_1#pressed. || |
| 624 | axescxx . . $ Controls#axes.[count].pressedcxx . . $ Controls#$anonymous_type_2#pressed. || hatscxx . . $ Controls#hats.[count].pressedcxx . . $ Controls#$anonymous_type_3#pressed.); |
| 625 | |
| 626 | if (wheelUpcxx . . $ Controls#wheelUp.) { |
| 627 | |
| 628 | controlstatescxx . . $ Controls#controlstates.[C_UPcxx . . $ `src/io/controls.h:30:9`!].statecxx . . $ Controls#$anonymous_type_4#state. = true; |
| 629 | wheelUpcxx . . $ Controls#wheelUp.--; |
| 630 | |
| 631 | } |
| 632 | |
| 633 | if (wheelDowncxx . . $ Controls#wheelDown.) { |
| 634 | |
| 635 | controlstatescxx . . $ Controls#controlstates.[C_DOWNcxx . . $ `src/io/controls.h:31:9`!].statecxx . . $ Controls#$anonymous_type_4#state. = true; |
| 636 | wheelDowncxx . . $ Controls#wheelDown.--; |
| 637 | |
| 638 | } |
| 639 | |
| 640 | } |
| 641 | |
| 642 | |
| 643 | /** |
| 644 | * Determine whether or not the specified control is being used. |
| 645 | * |
| 646 | * @param control The control |
| 647 | * |
| 648 | * @return True if the control is being used |
| 649 | */ |
| 650 | bool Controlscxx . . $ Controls#::getStatecxx . . $ Controls#getState(83c267b20bac841a). (int control) { |
| 651 | |
| 652 | return controlstatescxx . . $ Controls#controlstates.[control].statecxx . . $ Controls#$anonymous_type_4#state.; |
| 653 | |
| 654 | } |
| 655 | |
| 656 | |
| 657 | /** |
| 658 | * If it's being used, release the specified control. |
| 659 | * |
| 660 | * @param control The control |
| 661 | * |
| 662 | * @return True if the control was being used |
| 663 | */ |
| 664 | bool Controlscxx . . $ Controls#::releasecxx . . $ Controls#release(83c267b20bac841a). (int control) { |
| 665 | |
| 666 | if (!controlstatescxx . . $ Controls#controlstates.[control].statecxx . . $ Controls#$anonymous_type_4#state.) return false; |
| 667 | |
| 668 | controlstatescxx . . $ Controls#controlstates.[control].timecxx . . $ Controls#$anonymous_type_4#time. = globalTickscxx . . $ globalTicks. + T_KEYcxx . . $ `src/io/controls.h:53:9`!; |
| 669 | controlstatescxx . . $ Controls#controlstates.[control].statecxx . . $ Controls#$anonymous_type_4#state. = false; |
| 670 | |
| 671 | return true; |
| 672 | |
| 673 | } |
| 674 | |
| 675 | |
| 676 | /** |
| 677 | * Get the position of the cursor, and determine whether or not it's being used. |
| 678 | * |
| 679 | * @param x Is set to the x-coordinate of the cursor |
| 680 | * @param y Is set to the y-coordinate of the cursor |
| 681 | * |
| 682 | * @return True if the cursor was being used |
| 683 | */ |
| 684 | bool Controlscxx . . $ Controls#::getCursorcxx . . $ Controls#getCursor(8a990ad1ed500b42). (int& x, int& y) { |
| 685 | int scaleFactor = videocxx . . $ video..getScaleFactorcxx . . $ Video#getScaleFactor(455f465bc33b4cdf).(); |
| 686 | |
| 687 | if (scaleFactor > MIN_SCALEcxx . . $ `src/io/gfx/video.h:41:9`!) { |
| 688 | x = cursorXcxx . . $ Controls#cursorX. / scaleFactor; |
| 689 | y = cursorYcxx . . $ Controls#cursorY. / scaleFactor; |
| 690 | } else { |
| 691 | x = cursorXcxx . . $ Controls#cursorX.; |
| 692 | y = cursorYcxx . . $ Controls#cursorY.; |
| 693 | } |
| 694 | |
| 695 | return cursorPressedcxx . . $ Controls#cursorPressed. || cursorReleasedcxx . . $ Controls#cursorReleased.; |
| 696 | |
| 697 | } |
| 698 | |
| 699 | |
| 700 | /** |
| 701 | * Determine whether or not the cursor has been released. |
| 702 | * |
| 703 | * @return True if the cursor has been released |
| 704 | */ |
| 705 | bool Controlscxx . . $ Controls#::wasCursorReleasedcxx . . $ Controls#wasCursorReleased(c9857a73d68e59ba). () { |
| 706 | |
| 707 | if (cursorReleasedcxx . . $ Controls#cursorReleased.) { |
| 708 | |
| 709 | cursorReleasedcxx . . $ Controls#cursorReleased. = false; |
| 710 | |
| 711 | return true; |
| 712 | |
| 713 | } |
| 714 | |
| 715 | return false; |
| 716 | |
| 717 | } |