Update render, spritebatch and input stuffs.

This commit is contained in:
2026-05-21 09:51:56 -05:00
parent a9e6f2b2a5
commit 6502822583
13 changed files with 394 additions and 214 deletions
+46
View File
@@ -184,6 +184,52 @@ inputbuttondata_t INPUT_BUTTON_DATA[] = {
{ .name = NULL },
};
errorret_t inputInitLinux(void) {
#define X(buttonName, buttonAction) \
inputBind(inputButtonGetByName(buttonName), buttonAction);
#ifdef DUSK_INPUT_KEYBOARD
X("w", INPUT_ACTION_UP);
X("s", INPUT_ACTION_DOWN);
X("a", INPUT_ACTION_LEFT);
X("d", INPUT_ACTION_RIGHT);
X("left", INPUT_ACTION_LEFT);
X("right", INPUT_ACTION_RIGHT);
X("up", INPUT_ACTION_UP);
X("down", INPUT_ACTION_DOWN);
X("enter", INPUT_ACTION_ACCEPT);
X("e", INPUT_ACTION_ACCEPT);
X("space", INPUT_ACTION_ACCEPT);
X("tab", INPUT_ACTION_CANCEL);
X("q", INPUT_ACTION_CANCEL);
X("escape", INPUT_ACTION_RAGEQUIT);
X("`", INPUT_ACTION_CONSOLE);
#endif
#ifdef DUSK_INPUT_GAMEPAD
X("gamepad_up", INPUT_ACTION_UP);
X("gamepad_down", INPUT_ACTION_DOWN);
X("gamepad_left", INPUT_ACTION_LEFT);
X("gamepad_right", INPUT_ACTION_RIGHT);
X("gamepad_a", INPUT_ACTION_ACCEPT);
X("gamepad_b", INPUT_ACTION_CANCEL);
X("gamepad_back", INPUT_ACTION_RAGEQUIT);
X("gamepad_lstick_up", INPUT_ACTION_UP);
X("gamepad_lstick_down", INPUT_ACTION_DOWN);
X("gamepad_lstick_left", INPUT_ACTION_LEFT);
X("gamepad_lstick_right", INPUT_ACTION_RIGHT);
#endif
#ifdef DUSK_INPUT_POINTER
X("mouse_x", INPUT_ACTION_POINTERX);
X("mouse_y", INPUT_ACTION_POINTERY);
#endif
#undef X
errorOk();
}
float_t inputGetDeadzoneSDL2(const inputbutton_t button) {
return 0.17f;
}
+17
View File
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "error/error.h"
#include "input/inputsdl2.h"
/**
* Initializes the input system on Linux.
*
* @return An error code indicating success or failure.
*/
errorret_t inputInitLinux(void);
+11
View File
@@ -0,0 +1,11 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "input/inputlinux.h"
#define inputInitPlatform inputInitLinux