Update style
This commit is contained in:
parent
1847ab85d8
commit
7266f58506
@ -1,7 +1,13 @@
|
|||||||
BasedOnStyle: GNU
|
BasedOnStyle: GNU
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
TabWidth: 4
|
TabWidth: 4
|
||||||
UseTab: Always
|
UseTab: ForIndentation
|
||||||
IndentCaseLabels: False
|
IndentCaseLabels: False
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
ColumnLimit: 150
|
ColumnLimit: 150
|
||||||
|
AlignConsecutiveAssignments: Consecutive
|
||||||
|
AlignConsecutiveMacros: Consecutive
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AllowShortCaseLabelsOnASingleLine: True
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
@ -48,24 +48,15 @@ HOOK_DYNAMIC (i64, __fastcall, DecCoin, i32 a1, u16 a2) {
|
|||||||
|
|
||||||
HOOK_DYNAMIC (u16, __fastcall, GetAnalogIn, u8 which) {
|
HOOK_DYNAMIC (u16, __fastcall, GetAnalogIn, u8 which) {
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case 0: // Player 1 Left Blue
|
case 0: IF_HIT (P1_LEFT_BLUE); // Player 1 Left Blue
|
||||||
IF_HIT (P1_LEFT_BLUE);
|
case 1: IF_HIT (P1_LEFT_RED); // Player 1 Left Red
|
||||||
case 1: // Player 1 Left Red
|
case 2: IF_HIT (P1_RIGHT_RED); // Player 1 Right Red
|
||||||
IF_HIT (P1_LEFT_RED);
|
case 3: IF_HIT (P1_RIGHT_BLUE); // Player 1 Right Blue
|
||||||
case 2: // Player 1 Right Red
|
case 4: IF_HIT (P2_LEFT_BLUE); // Player 2 Left Blue
|
||||||
IF_HIT (P1_RIGHT_RED);
|
case 5: IF_HIT (P2_LEFT_RED); // Player 2 Left Red
|
||||||
case 3: // Player 1 Right Blue
|
case 6: IF_HIT (P2_RIGHT_RED); // Player 2 Right Red
|
||||||
IF_HIT (P1_RIGHT_BLUE);
|
case 7: IF_HIT (P2_RIGHT_BLUE); // Player 2 Right Blue
|
||||||
case 4: // Player 2 Left Blue
|
default: return 0;
|
||||||
IF_HIT (P2_LEFT_BLUE);
|
|
||||||
case 5: // Player 2 Left Red
|
|
||||||
IF_HIT (P2_LEFT_RED);
|
|
||||||
case 6: // Player 2 Right Red
|
|
||||||
IF_HIT (P2_RIGHT_RED);
|
|
||||||
case 7: // Player 2 Right Blue
|
|
||||||
IF_HIT (P2_RIGHT_BLUE);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +94,9 @@ HOOK_DYNAMIC (u16, __fastcall, GetCoin, i32 a1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdatePoll (windowHandle);
|
UpdatePoll (windowHandle);
|
||||||
if (IsButtonTapped (COIN_ADD))
|
if (IsButtonTapped (COIN_ADD)) coin_count++;
|
||||||
coin_count++;
|
if (IsButtonTapped (TEST)) testEnabled = !testEnabled;
|
||||||
if (IsButtonTapped (TEST))
|
if (IsButtonTapped (EXIT)) ExitProcess (0);
|
||||||
testEnabled = !testEnabled;
|
|
||||||
if (IsButtonTapped(EXIT))
|
|
||||||
ExitProcess(0);
|
|
||||||
}
|
}
|
||||||
return coin_count;
|
return coin_count;
|
||||||
}
|
}
|
||||||
@ -129,10 +117,8 @@ HOOK_DYNAMIC (i64, __stdcall, ResetCoin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) {
|
i32 __stdcall DllMain (HMODULE mod, DWORD cause, void *ctx) {
|
||||||
if (cause == DLL_PROCESS_DETACH)
|
if (cause == DLL_PROCESS_DETACH) DisposePoll ();
|
||||||
DisposePoll ();
|
if (cause != DLL_PROCESS_ATTACH) return 1;
|
||||||
if (cause != DLL_PROCESS_ATTACH)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// Blatantly stolen patches from mon.im
|
// Blatantly stolen patches from mon.im
|
||||||
WRITE_MEMORY (0x1400239C0, u8, 0xC3); // Stop error
|
WRITE_MEMORY (0x1400239C0, u8, 0xC3); // Stop error
|
||||||
|
@ -46,8 +46,7 @@ openConfigSection (toml_table_t *config, char *sectionName) {
|
|||||||
bool
|
bool
|
||||||
readConfigBool (toml_table_t *table, char *key, bool notFoundValue) {
|
readConfigBool (toml_table_t *table, char *key, bool notFoundValue) {
|
||||||
toml_datum_t data = toml_bool_in (table, key);
|
toml_datum_t data = toml_bool_in (table, key);
|
||||||
if (!data.ok)
|
if (!data.ok) return notFoundValue;
|
||||||
return notFoundValue;
|
|
||||||
|
|
||||||
return (bool)data.u.b;
|
return (bool)data.u.b;
|
||||||
}
|
}
|
||||||
@ -55,8 +54,7 @@ readConfigBool (toml_table_t *table, char *key, bool notFoundValue) {
|
|||||||
int64_t
|
int64_t
|
||||||
readConfigInt (toml_table_t *table, char *key, int64_t notFoundValue) {
|
readConfigInt (toml_table_t *table, char *key, int64_t notFoundValue) {
|
||||||
toml_datum_t data = toml_int_in (table, key);
|
toml_datum_t data = toml_int_in (table, key);
|
||||||
if (!data.ok)
|
if (!data.ok) return notFoundValue;
|
||||||
return notFoundValue;
|
|
||||||
|
|
||||||
return data.u.i;
|
return data.u.i;
|
||||||
}
|
}
|
||||||
@ -64,8 +62,7 @@ readConfigInt (toml_table_t *table, char *key, int64_t notFoundValue) {
|
|||||||
char *
|
char *
|
||||||
readConfigString (toml_table_t *table, char *key, char *notFoundValue) {
|
readConfigString (toml_table_t *table, char *key, char *notFoundValue) {
|
||||||
toml_datum_t data = toml_string_in (table, key);
|
toml_datum_t data = toml_string_in (table, key);
|
||||||
if (!data.ok)
|
if (!data.ok) return notFoundValue;
|
||||||
return notFoundValue;
|
|
||||||
|
|
||||||
return data.u.s;
|
return data.u.s;
|
||||||
}
|
}
|
||||||
@ -75,8 +72,7 @@ printColour (int colour, const char *format, ...) {
|
|||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
|
|
||||||
if (consoleHandle == 0)
|
if (consoleHandle == 0) consoleHandle = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||||
consoleHandle = GetStdHandle (STD_OUTPUT_HANDLE);
|
|
||||||
|
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
vsprintf (buffer, format, args);
|
vsprintf (buffer, format, args);
|
||||||
|
217
src/poll.c
217
src/poll.c
@ -95,8 +95,7 @@ SetConfigValue (toml_table_t *table, char *key, struct Keybindings *keybind) {
|
|||||||
|
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
toml_datum_t bind = toml_string_at (array, i);
|
toml_datum_t bind = toml_string_at (array, i);
|
||||||
if (!bind.ok)
|
if (!bind.ok) break;
|
||||||
break;
|
|
||||||
struct ConfigValue value = StringToConfigEnum (bind.u.s);
|
struct ConfigValue value = StringToConfigEnum (bind.u.s);
|
||||||
free (bind.u.s);
|
free (bind.u.s);
|
||||||
|
|
||||||
@ -132,8 +131,7 @@ SetConfigValue (toml_table_t *table, char *key, struct Keybindings *keybind) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,8 +167,7 @@ InitializePoll (void *DivaWindowHandle) {
|
|||||||
SDL_GameControllerEventState (SDL_ENABLE);
|
SDL_GameControllerEventState (SDL_ENABLE);
|
||||||
|
|
||||||
for (int i = 0; i < SDL_NumJoysticks (); i++) {
|
for (int i = 0; i < SDL_NumJoysticks (); i++) {
|
||||||
if (!SDL_IsGameController (i))
|
if (!SDL_IsGameController (i)) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
SDL_GameController *controller = SDL_GameControllerOpen (i);
|
SDL_GameController *controller = SDL_GameControllerOpen (i);
|
||||||
|
|
||||||
@ -184,18 +181,15 @@ InitializePoll (void *DivaWindowHandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_CreateWindowFrom (DivaWindowHandle);
|
window = SDL_CreateWindowFrom (DivaWindowHandle);
|
||||||
if (window != NULL)
|
if (window != NULL) SDL_SetWindowResizable (window, true);
|
||||||
SDL_SetWindowResizable (window, true);
|
else printError ("SDL_CreateWindowFrom (DivaWindowHandle): %s\n", SDL_GetError ());
|
||||||
else
|
|
||||||
printError ("SDL_CreateWindowFrom (DivaWindowHandle): %s\n", SDL_GetError ());
|
|
||||||
|
|
||||||
return hasRumble;
|
return hasRumble;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UpdatePoll (void *DivaWindowHandle) {
|
UpdatePoll (void *DivaWindowHandle) {
|
||||||
if (DivaWindowHandle == NULL || GetForegroundWindow () != DivaWindowHandle)
|
if (DivaWindowHandle == NULL || GetForegroundWindow () != DivaWindowHandle) return;
|
||||||
return;
|
|
||||||
|
|
||||||
memcpy (lastKeyboardState, currentKeyboardState, 255);
|
memcpy (lastKeyboardState, currentKeyboardState, 255);
|
||||||
memcpy (lastControllerButtonsState, currentControllerButtonsState, 21);
|
memcpy (lastControllerButtonsState, currentControllerButtonsState, 21);
|
||||||
@ -212,8 +206,7 @@ UpdatePoll (void *DivaWindowHandle) {
|
|||||||
while (SDL_PollEvent (&event) != 0) {
|
while (SDL_PollEvent (&event) != 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_CONTROLLERDEVICEADDED:
|
case SDL_CONTROLLERDEVICEADDED:
|
||||||
if (!SDL_IsGameController (event.cdevice.which))
|
if (!SDL_IsGameController (event.cdevice.which)) break;
|
||||||
break;
|
|
||||||
|
|
||||||
SDL_GameController *controller = SDL_GameControllerOpen (event.cdevice.which);
|
SDL_GameController *controller = SDL_GameControllerOpen (event.cdevice.which);
|
||||||
|
|
||||||
@ -229,57 +222,32 @@ UpdatePoll (void *DivaWindowHandle) {
|
|||||||
controllers[event.cdevice.which] = controller;
|
controllers[event.cdevice.which] = controller;
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLERDEVICEREMOVED:
|
case SDL_CONTROLLERDEVICEREMOVED:
|
||||||
if (!SDL_IsGameController (event.cdevice.which))
|
if (!SDL_IsGameController (event.cdevice.which)) break;
|
||||||
break;
|
|
||||||
SDL_GameControllerClose (controllers[event.cdevice.which]);
|
SDL_GameControllerClose (controllers[event.cdevice.which]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
if (event.wheel.y > 0)
|
if (event.wheel.y > 0) currentMouseState.ScrolledUp = true;
|
||||||
currentMouseState.ScrolledUp = true;
|
else if (event.wheel.y < 0) currentMouseState.ScrolledDown = true;
|
||||||
else if (event.wheel.y < 0)
|
|
||||||
currentMouseState.ScrolledDown = true;
|
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLERBUTTONUP:
|
case SDL_CONTROLLERBUTTONUP:
|
||||||
case SDL_CONTROLLERBUTTONDOWN:
|
case SDL_CONTROLLERBUTTONDOWN: currentControllerButtonsState[event.cbutton.button] = event.cbutton.state; break;
|
||||||
currentControllerButtonsState[event.cbutton.button] = event.cbutton.state;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLERAXISMOTION:
|
case SDL_CONTROLLERAXISMOTION:
|
||||||
if (event.caxis.value > 8000) {
|
if (event.caxis.value > 8000) {
|
||||||
switch (event.caxis.axis) {
|
switch (event.caxis.axis) {
|
||||||
case SDL_CONTROLLER_AXIS_LEFTX:
|
case SDL_CONTROLLER_AXIS_LEFTX: currentControllerAxisState.LeftRight = 1; break;
|
||||||
currentControllerAxisState.LeftRight = 1;
|
case SDL_CONTROLLER_AXIS_LEFTY: currentControllerAxisState.LeftDown = 1; break;
|
||||||
break;
|
case SDL_CONTROLLER_AXIS_RIGHTX: currentControllerAxisState.RightRight = 1; break;
|
||||||
case SDL_CONTROLLER_AXIS_LEFTY:
|
case SDL_CONTROLLER_AXIS_RIGHTY: currentControllerAxisState.RightDown = 1; break;
|
||||||
currentControllerAxisState.LeftDown = 1;
|
case SDL_CONTROLLER_AXIS_TRIGGERLEFT: currentControllerAxisState.LTriggerDown = 1; break;
|
||||||
break;
|
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: currentControllerAxisState.RTriggerDown = 1; break;
|
||||||
case SDL_CONTROLLER_AXIS_RIGHTX:
|
|
||||||
currentControllerAxisState.RightRight = 1;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_RIGHTY:
|
|
||||||
currentControllerAxisState.RightDown = 1;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
|
||||||
currentControllerAxisState.LTriggerDown = 1;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
|
||||||
currentControllerAxisState.RTriggerDown = 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else if (event.caxis.value < -8000) {
|
} else if (event.caxis.value < -8000) {
|
||||||
switch (event.caxis.axis) {
|
switch (event.caxis.axis) {
|
||||||
case SDL_CONTROLLER_AXIS_LEFTX:
|
case SDL_CONTROLLER_AXIS_LEFTX: currentControllerAxisState.LeftLeft = 1; break;
|
||||||
currentControllerAxisState.LeftLeft = 1;
|
case SDL_CONTROLLER_AXIS_LEFTY: currentControllerAxisState.LeftUp = 1; break;
|
||||||
break;
|
case SDL_CONTROLLER_AXIS_RIGHTX: currentControllerAxisState.RightLeft = 1; break;
|
||||||
case SDL_CONTROLLER_AXIS_LEFTY:
|
case SDL_CONTROLLER_AXIS_RIGHTY: currentControllerAxisState.RightUp = 1; break;
|
||||||
currentControllerAxisState.LeftUp = 1;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_RIGHTX:
|
|
||||||
currentControllerAxisState.RightLeft = 1;
|
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_RIGHTY:
|
|
||||||
currentControllerAxisState.RightUp = 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (event.caxis.axis) {
|
switch (event.caxis.axis) {
|
||||||
@ -299,12 +267,8 @@ UpdatePoll (void *DivaWindowHandle) {
|
|||||||
currentControllerAxisState.RightDown = 0;
|
currentControllerAxisState.RightDown = 0;
|
||||||
currentControllerAxisState.RightUp = 0;
|
currentControllerAxisState.RightUp = 0;
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
|
case SDL_CONTROLLER_AXIS_TRIGGERLEFT: currentControllerAxisState.LTriggerDown = 0; break;
|
||||||
currentControllerAxisState.LTriggerDown = 0;
|
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: currentControllerAxisState.RTriggerDown = 0; break;
|
||||||
break;
|
|
||||||
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
|
|
||||||
currentControllerAxisState.RTriggerDown = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -355,44 +319,28 @@ GetInternalButtonState (struct Keybindings bindings) {
|
|||||||
struct InternalButtonState buttons = { 0 };
|
struct InternalButtonState buttons = { 0 };
|
||||||
|
|
||||||
for (int i = 0; i < COUNTOFARR (ConfigKeyboardButtons); i++) {
|
for (int i = 0; i < COUNTOFARR (ConfigKeyboardButtons); i++) {
|
||||||
if (bindings.keycodes[i] == 0)
|
if (bindings.keycodes[i] == 0) continue;
|
||||||
continue;
|
if (KeyboardIsReleased (bindings.keycodes[i])) buttons.Released = 1;
|
||||||
if (KeyboardIsReleased (bindings.keycodes[i]))
|
if (KeyboardIsDown (bindings.keycodes[i])) buttons.Down = 1;
|
||||||
buttons.Released = 1;
|
if (KeyboardIsTapped (bindings.keycodes[i])) buttons.Tapped = 1;
|
||||||
if (KeyboardIsDown (bindings.keycodes[i]))
|
|
||||||
buttons.Down = 1;
|
|
||||||
if (KeyboardIsTapped (bindings.keycodes[i]))
|
|
||||||
buttons.Tapped = 1;
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < COUNTOFARR (ConfigControllerButtons); i++) {
|
for (int i = 0; i < COUNTOFARR (ConfigControllerButtons); i++) {
|
||||||
if (bindings.buttons[i] == SDL_CONTROLLER_BUTTON_INVALID)
|
if (bindings.buttons[i] == SDL_CONTROLLER_BUTTON_INVALID) continue;
|
||||||
continue;
|
if (ControllerButtonIsReleased (bindings.buttons[i])) buttons.Released = 1;
|
||||||
if (ControllerButtonIsReleased (bindings.buttons[i]))
|
if (ControllerButtonIsDown (bindings.buttons[i])) buttons.Down = 1;
|
||||||
buttons.Released = 1;
|
if (ControllerButtonIsTapped (bindings.buttons[i])) buttons.Tapped = 1;
|
||||||
if (ControllerButtonIsDown (bindings.buttons[i]))
|
|
||||||
buttons.Down = 1;
|
|
||||||
if (ControllerButtonIsTapped (bindings.buttons[i]))
|
|
||||||
buttons.Tapped = 1;
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < COUNTOFARR (ConfigControllerAXIS); i++) {
|
for (int i = 0; i < COUNTOFARR (ConfigControllerAXIS); i++) {
|
||||||
if (bindings.axis[i] == 0)
|
if (bindings.axis[i] == 0) continue;
|
||||||
continue;
|
if (ControllerAxisIsReleased (bindings.axis[i])) buttons.Released = 1;
|
||||||
if (ControllerAxisIsReleased (bindings.axis[i]))
|
if (ControllerAxisIsDown (bindings.axis[i])) buttons.Down = 1;
|
||||||
buttons.Released = 1;
|
if (ControllerAxisIsTapped (bindings.axis[i])) buttons.Tapped = 1;
|
||||||
if (ControllerAxisIsDown (bindings.axis[i]))
|
|
||||||
buttons.Down = 1;
|
|
||||||
if (ControllerAxisIsTapped (bindings.axis[i]))
|
|
||||||
buttons.Tapped = 1;
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < COUNTOFARR (ConfigMouseScroll); i++) {
|
for (int i = 0; i < COUNTOFARR (ConfigMouseScroll); i++) {
|
||||||
if (bindings.scroll[i] == 0)
|
if (bindings.scroll[i] == 0) continue;
|
||||||
continue;
|
if (GetMouseScrollIsReleased (bindings.scroll[i])) buttons.Released = 1;
|
||||||
if (GetMouseScrollIsReleased (bindings.scroll[i]))
|
if (GetMouseScrollIsDown (bindings.scroll[i])) buttons.Down = 1;
|
||||||
buttons.Released = 1;
|
if (GetMouseScrollIsTapped (bindings.scroll[i])) buttons.Tapped = 1;
|
||||||
if (GetMouseScrollIsDown (bindings.scroll[i]))
|
|
||||||
buttons.Down = 1;
|
|
||||||
if (GetMouseScrollIsTapped (bindings.scroll[i]))
|
|
||||||
buttons.Tapped = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buttons;
|
return buttons;
|
||||||
@ -401,8 +349,7 @@ GetInternalButtonState (struct Keybindings bindings) {
|
|||||||
void
|
void
|
||||||
SetRumble (int left, int right) {
|
SetRumble (int left, int right) {
|
||||||
for (int i = 0; i < COUNTOFARR (controllers); i++) {
|
for (int i = 0; i < COUNTOFARR (controllers); i++) {
|
||||||
if (!controllers[i] || !SDL_GameControllerHasRumble (controllers[i]))
|
if (!controllers[i] || !SDL_GameControllerHasRumble (controllers[i])) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
SDL_GameControllerRumble (controllers[i], left, right, 1000);
|
SDL_GameControllerRumble (controllers[i], left, right, 1000);
|
||||||
}
|
}
|
||||||
@ -485,26 +432,20 @@ GetWasMouseScrollDown () {
|
|||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
GetMouseScrollIsReleased (enum Scroll scroll) {
|
GetMouseScrollIsReleased (enum Scroll scroll) {
|
||||||
if (scroll == MOUSE_SCROLL_UP)
|
if (scroll == MOUSE_SCROLL_UP) return !GetMouseScrollUp () && GetWasMouseScrollUp ();
|
||||||
return !GetMouseScrollUp () && GetWasMouseScrollUp ();
|
else return !GetMouseScrollDown () && GetWasMouseScrollDown ();
|
||||||
else
|
|
||||||
return !GetMouseScrollDown () && GetWasMouseScrollDown ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
GetMouseScrollIsDown (enum Scroll scroll) {
|
GetMouseScrollIsDown (enum Scroll scroll) {
|
||||||
if (scroll == MOUSE_SCROLL_UP)
|
if (scroll == MOUSE_SCROLL_UP) return GetMouseScrollUp ();
|
||||||
return GetMouseScrollUp ();
|
else return GetMouseScrollDown ();
|
||||||
else
|
|
||||||
return GetMouseScrollDown ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
GetMouseScrollIsTapped (enum Scroll scroll) {
|
GetMouseScrollIsTapped (enum Scroll scroll) {
|
||||||
if (scroll == MOUSE_SCROLL_UP)
|
if (scroll == MOUSE_SCROLL_UP) return GetMouseScrollUp () && !GetWasMouseScrollUp ();
|
||||||
return GetMouseScrollUp () && !GetWasMouseScrollUp ();
|
else return GetMouseScrollDown () && !GetWasMouseScrollDown ();
|
||||||
else
|
|
||||||
return GetMouseScrollDown () && !GetWasMouseScrollDown ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@ -540,29 +481,18 @@ ControllerButtonIsReleased (SDL_GameControllerButton button) {
|
|||||||
inline bool
|
inline bool
|
||||||
ControllerAxisIsDown (enum SDLAxis axis) {
|
ControllerAxisIsDown (enum SDLAxis axis) {
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case SDL_AXIS_LEFT_LEFT:
|
case SDL_AXIS_LEFT_LEFT: return currentControllerAxisState.LeftLeft;
|
||||||
return currentControllerAxisState.LeftLeft;
|
case SDL_AXIS_LEFT_RIGHT: return currentControllerAxisState.LeftRight;
|
||||||
case SDL_AXIS_LEFT_RIGHT:
|
case SDL_AXIS_LEFT_UP: return currentControllerAxisState.LeftUp;
|
||||||
return currentControllerAxisState.LeftRight;
|
case SDL_AXIS_LEFT_DOWN: return currentControllerAxisState.LeftDown;
|
||||||
case SDL_AXIS_LEFT_UP:
|
case SDL_AXIS_RIGHT_LEFT: return currentControllerAxisState.RightLeft;
|
||||||
return currentControllerAxisState.LeftUp;
|
case SDL_AXIS_RIGHT_RIGHT: return currentControllerAxisState.RightRight;
|
||||||
case SDL_AXIS_LEFT_DOWN:
|
case SDL_AXIS_RIGHT_UP: return currentControllerAxisState.RightUp;
|
||||||
return currentControllerAxisState.LeftDown;
|
case SDL_AXIS_RIGHT_DOWN: return currentControllerAxisState.RightDown;
|
||||||
case SDL_AXIS_RIGHT_LEFT:
|
case SDL_AXIS_LTRIGGER_DOWN: return currentControllerAxisState.LTriggerDown;
|
||||||
return currentControllerAxisState.RightLeft;
|
case SDL_AXIS_RTRIGGER_DOWN: return currentControllerAxisState.RTriggerDown;
|
||||||
case SDL_AXIS_RIGHT_RIGHT:
|
|
||||||
return currentControllerAxisState.RightRight;
|
|
||||||
case SDL_AXIS_RIGHT_UP:
|
|
||||||
return currentControllerAxisState.RightUp;
|
|
||||||
case SDL_AXIS_RIGHT_DOWN:
|
|
||||||
return currentControllerAxisState.RightDown;
|
|
||||||
case SDL_AXIS_LTRIGGER_DOWN:
|
|
||||||
return currentControllerAxisState.LTriggerDown;
|
|
||||||
case SDL_AXIS_RTRIGGER_DOWN:
|
|
||||||
return currentControllerAxisState.RTriggerDown;
|
|
||||||
case SDL_AXIS_NULL:
|
case SDL_AXIS_NULL:
|
||||||
case SDL_AXIS_MAX:
|
case SDL_AXIS_MAX: return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,29 +504,18 @@ ControllerAxisIsUp (enum SDLAxis axis) {
|
|||||||
inline bool
|
inline bool
|
||||||
ControllerAxisWasDown (enum SDLAxis axis) {
|
ControllerAxisWasDown (enum SDLAxis axis) {
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case SDL_AXIS_LEFT_LEFT:
|
case SDL_AXIS_LEFT_LEFT: return lastControllerAxisState.LeftLeft;
|
||||||
return lastControllerAxisState.LeftLeft;
|
case SDL_AXIS_LEFT_RIGHT: return lastControllerAxisState.LeftRight;
|
||||||
case SDL_AXIS_LEFT_RIGHT:
|
case SDL_AXIS_LEFT_UP: return lastControllerAxisState.LeftUp;
|
||||||
return lastControllerAxisState.LeftRight;
|
case SDL_AXIS_LEFT_DOWN: return lastControllerAxisState.LeftDown;
|
||||||
case SDL_AXIS_LEFT_UP:
|
case SDL_AXIS_RIGHT_LEFT: return lastControllerAxisState.RightLeft;
|
||||||
return lastControllerAxisState.LeftUp;
|
case SDL_AXIS_RIGHT_RIGHT: return lastControllerAxisState.RightRight;
|
||||||
case SDL_AXIS_LEFT_DOWN:
|
case SDL_AXIS_RIGHT_UP: return lastControllerAxisState.RightUp;
|
||||||
return lastControllerAxisState.LeftDown;
|
case SDL_AXIS_RIGHT_DOWN: return lastControllerAxisState.RightDown;
|
||||||
case SDL_AXIS_RIGHT_LEFT:
|
case SDL_AXIS_LTRIGGER_DOWN: return lastControllerAxisState.LTriggerDown;
|
||||||
return lastControllerAxisState.RightLeft;
|
case SDL_AXIS_RTRIGGER_DOWN: return lastControllerAxisState.RTriggerDown;
|
||||||
case SDL_AXIS_RIGHT_RIGHT:
|
|
||||||
return lastControllerAxisState.RightRight;
|
|
||||||
case SDL_AXIS_RIGHT_UP:
|
|
||||||
return lastControllerAxisState.RightUp;
|
|
||||||
case SDL_AXIS_RIGHT_DOWN:
|
|
||||||
return lastControllerAxisState.RightDown;
|
|
||||||
case SDL_AXIS_LTRIGGER_DOWN:
|
|
||||||
return lastControllerAxisState.LTriggerDown;
|
|
||||||
case SDL_AXIS_RTRIGGER_DOWN:
|
|
||||||
return lastControllerAxisState.RTriggerDown;
|
|
||||||
case SDL_AXIS_NULL:
|
case SDL_AXIS_NULL:
|
||||||
case SDL_AXIS_MAX:
|
case SDL_AXIS_MAX: return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user