Technically working
This commit is contained in:
@@ -4,56 +4,56 @@ module('scene')
|
|||||||
module('locale')
|
module('locale')
|
||||||
|
|
||||||
-- Default Input bindings.
|
-- Default Input bindings.
|
||||||
if PLATFORM == "psp" then
|
-- if PLATFORM == "psp" then
|
||||||
inputBind("up", INPUT_ACTION_UP)
|
-- inputBind("up", INPUT_ACTION_UP)
|
||||||
inputBind("down", INPUT_ACTION_DOWN)
|
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||||
inputBind("left", INPUT_ACTION_LEFT)
|
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||||
inputBind("right", INPUT_ACTION_RIGHT)
|
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||||
inputBind("circle", INPUT_ACTION_CANCEL)
|
-- inputBind("circle", INPUT_ACTION_CANCEL)
|
||||||
inputBind("cross", INPUT_ACTION_ACCEPT)
|
-- inputBind("cross", INPUT_ACTION_ACCEPT)
|
||||||
inputBind("select", INPUT_ACTION_RAGEQUIT)
|
-- inputBind("select", INPUT_ACTION_RAGEQUIT)
|
||||||
inputBind("lstick_up", INPUT_ACTION_UP)
|
-- inputBind("lstick_up", INPUT_ACTION_UP)
|
||||||
inputBind("lstick_down", INPUT_ACTION_DOWN)
|
-- inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||||
inputBind("lstick_left", INPUT_ACTION_LEFT)
|
-- inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||||
inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
-- inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||||
|
|
||||||
elseif DOLPHIN then
|
-- elseif DOLPHIN then
|
||||||
inputBind("up", INPUT_ACTION_UP)
|
-- inputBind("up", INPUT_ACTION_UP)
|
||||||
inputBind("down", INPUT_ACTION_DOWN)
|
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||||
inputBind("left", INPUT_ACTION_LEFT)
|
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||||
inputBind("right", INPUT_ACTION_RIGHT)
|
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||||
inputBind("b", INPUT_ACTION_CANCEL)
|
-- inputBind("b", INPUT_ACTION_CANCEL)
|
||||||
inputBind("a", INPUT_ACTION_ACCEPT)
|
-- inputBind("a", INPUT_ACTION_ACCEPT)
|
||||||
inputBind("z", INPUT_ACTION_RAGEQUIT)
|
-- inputBind("z", INPUT_ACTION_RAGEQUIT)
|
||||||
inputBind("lstick_up", INPUT_ACTION_UP)
|
-- inputBind("lstick_up", INPUT_ACTION_UP)
|
||||||
inputBind("lstick_down", INPUT_ACTION_DOWN)
|
-- inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||||
inputBind("lstick_left", INPUT_ACTION_LEFT)
|
-- inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||||
inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
-- inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||||
|
|
||||||
else
|
-- else
|
||||||
if INPUT_KEYBOARD then
|
-- if INPUT_KEYBOARD then
|
||||||
inputBind("w", INPUT_ACTION_UP)
|
-- inputBind("w", INPUT_ACTION_UP)
|
||||||
inputBind("s", INPUT_ACTION_DOWN)
|
-- inputBind("s", INPUT_ACTION_DOWN)
|
||||||
inputBind("a", INPUT_ACTION_LEFT)
|
-- inputBind("a", INPUT_ACTION_LEFT)
|
||||||
inputBind("d", INPUT_ACTION_RIGHT)
|
-- inputBind("d", INPUT_ACTION_RIGHT)
|
||||||
|
|
||||||
inputBind("left", INPUT_ACTION_LEFT)
|
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||||
inputBind("right", INPUT_ACTION_RIGHT)
|
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||||
inputBind("up", INPUT_ACTION_UP)
|
-- inputBind("up", INPUT_ACTION_UP)
|
||||||
inputBind("down", INPUT_ACTION_DOWN)
|
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||||
|
|
||||||
inputBind("enter", INPUT_ACTION_ACCEPT)
|
-- inputBind("enter", INPUT_ACTION_ACCEPT)
|
||||||
inputBind("e", INPUT_ACTION_ACCEPT)
|
-- inputBind("e", INPUT_ACTION_ACCEPT)
|
||||||
|
|
||||||
inputBind("q", INPUT_ACTION_CANCEL)
|
-- inputBind("q", INPUT_ACTION_CANCEL)
|
||||||
|
|
||||||
inputBind("escape", INPUT_ACTION_RAGEQUIT)
|
-- inputBind("escape", INPUT_ACTION_RAGEQUIT)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
if INPUT_POINTER then
|
-- if INPUT_POINTER then
|
||||||
inputBind("mouse_x", INPUT_ACTION_POINTERX)
|
-- inputBind("mouse_x", INPUT_ACTION_POINTERX)
|
||||||
inputBind("mouse_y", INPUT_ACTION_POINTERY)
|
-- inputBind("mouse_y", INPUT_ACTION_POINTERY)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
|
||||||
sceneSet('scene/minesweeper.lua')
|
-- sceneSet('scene/minesweeper.lua')
|
||||||
@@ -21,4 +21,5 @@ target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
|||||||
DUSK_INPUT_KEYBOARD
|
DUSK_INPUT_KEYBOARD
|
||||||
DUSK_INPUT_POINTER
|
DUSK_INPUT_POINTER
|
||||||
DUSK_INPUT_GAMEPAD
|
DUSK_INPUT_GAMEPAD
|
||||||
|
DUSK_TIME_DYNAMIC
|
||||||
)
|
)
|
||||||
@@ -15,6 +15,8 @@ add_subdirectory(camera)
|
|||||||
add_subdirectory(framebuffer)
|
add_subdirectory(framebuffer)
|
||||||
add_subdirectory(mesh)
|
add_subdirectory(mesh)
|
||||||
add_subdirectory(texture)
|
add_subdirectory(texture)
|
||||||
|
add_subdirectory(spritebatch)
|
||||||
|
add_subdirectory(screen)
|
||||||
|
|
||||||
# Color definitions
|
# Color definitions
|
||||||
dusk_run_python(
|
dusk_run_python(
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ errorret_t displayInit(void) {
|
|||||||
|
|
||||||
errorChain(quadInit());
|
errorChain(quadInit());
|
||||||
errorChain(frameBufferInitBackBuffer());
|
errorChain(frameBufferInitBackBuffer());
|
||||||
spriteBatchInit();
|
errorChain(spriteBatchInit());
|
||||||
errorChain(textInit());
|
errorChain(textInit());
|
||||||
// errorChain(assetLoad("main_palette.dpf", &PALETTES[0]));
|
// errorChain(assetLoad("main_palette.dpf", &PALETTES[0]));
|
||||||
screenInit();
|
screenInit();
|
||||||
|
|||||||
@@ -17,6 +17,12 @@
|
|||||||
#ifndef frameBufferPlatformBind
|
#ifndef frameBufferPlatformBind
|
||||||
#error "frameBufferPlatformBind not defined for this platform"
|
#error "frameBufferPlatformBind not defined for this platform"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef frameBufferPlatformGetWidth
|
||||||
|
#error "frameBufferPlatformGetWidth not defined for this platform"
|
||||||
|
#endif
|
||||||
|
#ifndef frameBufferPlatformGetHeight
|
||||||
|
#error "frameBufferPlatformGetHeight not defined for this platform"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FRAMEBUFFER_CLEAR_COLOR (1 << 0)
|
#define FRAMEBUFFER_CLEAR_COLOR (1 << 0)
|
||||||
#define FRAMEBUFFER_CLEAR_DEPTH (1 << 1)
|
#define FRAMEBUFFER_CLEAR_DEPTH (1 << 1)
|
||||||
|
|||||||
10
src/dusk/display/screen/CMakeLists.txt
Normal file
10
src/dusk/display/screen/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Copyright (c) 2026 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
screen.c
|
||||||
|
)
|
||||||
10
src/dusk/display/spritebatch/CMakeLists.txt
Normal file
10
src/dusk/display/spritebatch/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Copyright (c) 2026 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
spritebatch.c
|
||||||
|
)
|
||||||
@@ -12,18 +12,19 @@
|
|||||||
meshvertex_t SPRITEBATCH_VERTICES[SPRITEBATCH_VERTEX_COUNT];
|
meshvertex_t SPRITEBATCH_VERTICES[SPRITEBATCH_VERTEX_COUNT];
|
||||||
spritebatch_t SPRITEBATCH;
|
spritebatch_t SPRITEBATCH;
|
||||||
|
|
||||||
void spriteBatchInit() {
|
errorret_t spriteBatchInit() {
|
||||||
memoryZero(&SPRITEBATCH, sizeof(spritebatch_t));
|
memoryZero(&SPRITEBATCH, sizeof(spritebatch_t));
|
||||||
|
|
||||||
meshInit(
|
errorChain(meshInit(
|
||||||
&SPRITEBATCH.mesh,
|
&SPRITEBATCH.mesh,
|
||||||
MESH_PRIMITIVE_TRIANGLES,
|
QUAD_PRIMITIVE_TYPE,
|
||||||
SPRITEBATCH_VERTEX_COUNT,
|
SPRITEBATCH_VERTEX_COUNT,
|
||||||
&SPRITEBATCH_VERTICES[0]
|
&SPRITEBATCH_VERTICES[0]
|
||||||
);
|
));
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void spriteBatchPush(
|
errorret_t spriteBatchPush(
|
||||||
texture_t *texture,
|
texture_t *texture,
|
||||||
const float_t minX,
|
const float_t minX,
|
||||||
const float_t minY,
|
const float_t minY,
|
||||||
@@ -35,17 +36,18 @@ void spriteBatchPush(
|
|||||||
const float_t u1,
|
const float_t u1,
|
||||||
const float_t v1
|
const float_t v1
|
||||||
) {
|
) {
|
||||||
return spriteBatchPush3D(
|
errorChain(spriteBatchPush3D(
|
||||||
texture,
|
texture,
|
||||||
(vec3){ minX, minY, 0 },
|
(vec3){ minX, minY, 0 },
|
||||||
(vec3){ maxX, maxY, 0 },
|
(vec3){ maxX, maxY, 0 },
|
||||||
color,
|
color,
|
||||||
(vec2){ u0, v0 },
|
(vec2){ u0, v0 },
|
||||||
(vec2){ u1, v1 }
|
(vec2){ u1, v1 }
|
||||||
);
|
));
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void spriteBatchPush3D(
|
errorret_t spriteBatchPush3D(
|
||||||
texture_t *texture,
|
texture_t *texture,
|
||||||
const vec3 min,
|
const vec3 min,
|
||||||
const vec3 max,
|
const vec3 max,
|
||||||
@@ -58,22 +60,17 @@ void spriteBatchPush3D(
|
|||||||
SPRITEBATCH.currentTexture != texture ||
|
SPRITEBATCH.currentTexture != texture ||
|
||||||
SPRITEBATCH.spriteCount >= SPRITEBATCH_SPRITES_MAX
|
SPRITEBATCH.spriteCount >= SPRITEBATCH_SPRITES_MAX
|
||||||
) {
|
) {
|
||||||
spriteBatchFlush();
|
errorChain(spriteBatchFlush());
|
||||||
SPRITEBATCH.currentTexture = texture;
|
SPRITEBATCH.currentTexture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t vertexOffset = SPRITEBATCH.spriteCount * QUAD_VERTEX_COUNT;
|
size_t vertexOffset = SPRITEBATCH.spriteCount * QUAD_VERTEX_COUNT;
|
||||||
#if DOLPHIN
|
|
||||||
vertexOffset += (
|
|
||||||
SPRITEBATCH.batchIndex * SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
quadBuffer3D(
|
quadBuffer3D(
|
||||||
&SPRITEBATCH_VERTICES[vertexOffset],
|
&SPRITEBATCH_VERTICES[vertexOffset],
|
||||||
min, max, color, uv0, uv1
|
min, max, color, uv0, uv1
|
||||||
);
|
);
|
||||||
SPRITEBATCH.spriteCount++;
|
SPRITEBATCH.spriteCount++;
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void spriteBatchClear() {
|
void spriteBatchClear() {
|
||||||
@@ -81,23 +78,17 @@ void spriteBatchClear() {
|
|||||||
SPRITEBATCH.currentTexture = NULL;
|
SPRITEBATCH.currentTexture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spriteBatchFlush() {
|
errorret_t spriteBatchFlush() {
|
||||||
if(SPRITEBATCH.spriteCount == 0) return;
|
if(SPRITEBATCH.spriteCount == 0) {
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
|
|
||||||
textureBind(SPRITEBATCH.currentTexture);
|
textureBind(SPRITEBATCH.currentTexture);
|
||||||
|
errorChain(meshDraw(
|
||||||
#if DOLPHIN
|
&SPRITEBATCH.mesh, 0, QUAD_VERTEX_COUNT * SPRITEBATCH.spriteCount
|
||||||
meshDraw(
|
));
|
||||||
&SPRITEBATCH.mesh,
|
|
||||||
QUAD_VERTEX_COUNT * SPRITEBATCH.batchIndex * SPRITEBATCH_SPRITES_MAX,
|
|
||||||
QUAD_VERTEX_COUNT * SPRITEBATCH.spriteCount
|
|
||||||
);
|
|
||||||
SPRITEBATCH.batchIndex = (
|
|
||||||
(SPRITEBATCH.batchIndex + 1) % SPRITEBATCH_BATCH_COUNT
|
|
||||||
);
|
|
||||||
#else
|
|
||||||
meshDraw(&SPRITEBATCH.mesh, 0, QUAD_VERTEX_COUNT * SPRITEBATCH.spriteCount);
|
|
||||||
#endif
|
|
||||||
spriteBatchClear();
|
spriteBatchClear();
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void spriteBatchDispose() {
|
void spriteBatchDispose() {
|
||||||
|
|||||||
@@ -12,12 +12,6 @@
|
|||||||
#define SPRITEBATCH_SPRITES_MAX 128
|
#define SPRITEBATCH_SPRITES_MAX 128
|
||||||
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT)
|
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT)
|
||||||
|
|
||||||
#if DOLPHIN
|
|
||||||
#define SPRITEBATCH_SPRITES_MAX 16
|
|
||||||
#define SPRITEBATCH_BATCH_COUNT 16
|
|
||||||
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT * SPRITEBATCH_BATCH_COUNT)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mesh_t mesh;
|
mesh_t mesh;
|
||||||
@@ -37,8 +31,9 @@ extern spritebatch_t SPRITEBATCH;
|
|||||||
* Initializes a sprite batch.
|
* Initializes a sprite batch.
|
||||||
*
|
*
|
||||||
* @param spriteBatch The sprite batch to initialize.
|
* @param spriteBatch The sprite batch to initialize.
|
||||||
|
* @return An error code indicating success or failure.
|
||||||
*/
|
*/
|
||||||
void spriteBatchInit();
|
errorret_t spriteBatchInit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a sprite to the batch. This basically "queues" it to render (well
|
* Pushes a sprite to the batch. This basically "queues" it to render (well
|
||||||
@@ -58,8 +53,9 @@ void spriteBatchInit();
|
|||||||
* @param v0 The texture coordinate for the top-left corner of the sprite.
|
* @param v0 The texture coordinate for the top-left corner of the sprite.
|
||||||
* @param u1 The texture coordinate for the bottom-right corner of the sprite.
|
* @param u1 The texture coordinate for the bottom-right corner of the sprite.
|
||||||
* @param v1 The texture coordinate for the bottom-right corner of the sprite.
|
* @param v1 The texture coordinate for the bottom-right corner of the sprite.
|
||||||
|
* @return An error code indicating success or failure.
|
||||||
*/
|
*/
|
||||||
void spriteBatchPush(
|
errorret_t spriteBatchPush(
|
||||||
texture_t *texture,
|
texture_t *texture,
|
||||||
const float_t minX,
|
const float_t minX,
|
||||||
const float_t minY,
|
const float_t minY,
|
||||||
@@ -81,9 +77,10 @@ void spriteBatchPush(
|
|||||||
* @param max The maximum (x,y,z) coordinate of the sprite.
|
* @param max The maximum (x,y,z) coordinate of the sprite.
|
||||||
* @param color The color to tint the sprite with.
|
* @param color The color to tint the sprite with.
|
||||||
* @param uvMin The texture coordinate for the top-left corner of the sprite.
|
* @param uvMin The texture coordinate for the top-left corner of the sprite.
|
||||||
* @param uvMax The texture coordinate for the bottom-right corner of the sprite.
|
* @param uvMax The texture coordinate for the bottom-right corner of the sprite
|
||||||
|
* @return An error code indicating success or failure.
|
||||||
*/
|
*/
|
||||||
void spriteBatchPush3D(
|
errorret_t spriteBatchPush3D(
|
||||||
texture_t *texture,
|
texture_t *texture,
|
||||||
const vec3 min,
|
const vec3 min,
|
||||||
const vec3 max,
|
const vec3 max,
|
||||||
@@ -99,8 +96,10 @@ void spriteBatchClear();
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Flushes the sprite batch, rendering all queued sprites.
|
* Flushes the sprite batch, rendering all queued sprites.
|
||||||
|
*
|
||||||
|
* @return An error code indicating success or failure.
|
||||||
*/
|
*/
|
||||||
void spriteBatchFlush();
|
errorret_t spriteBatchFlush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes of the sprite batch, freeing any allocated resources.
|
* Disposes of the sprite batch, freeing any allocated resources.
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ texture_t DEFAULT_FONT_TEXTURE;
|
|||||||
tileset_t DEFAULT_FONT_TILESET;
|
tileset_t DEFAULT_FONT_TILESET;
|
||||||
|
|
||||||
errorret_t textInit(void) {
|
errorret_t textInit(void) {
|
||||||
errorChain(assetLoad("ui/minogram.dpt", &DEFAULT_FONT_TEXTURE));
|
// errorChain(assetLoad("ui/minogram.dpt", &DEFAULT_FONT_TEXTURE));
|
||||||
errorChain(assetLoad("ui/minogram.dtf", &DEFAULT_FONT_TILESET));
|
// errorChain(assetLoad("ui/minogram.dtf", &DEFAULT_FONT_TILESET));
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ void inputInit(void) {
|
|||||||
INPUT.actions[i].currentValue = 0.0f;
|
INPUT.actions[i].currentValue = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INPUT_GAMEPAD == 1
|
#ifdef DUSK_INPUT_GAMEPAD
|
||||||
INPUT.deadzone = 0.2f;
|
INPUT.deadzone = 0.2f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DOLPHIN
|
#ifdef inputInitPlatform
|
||||||
PAD_Init();
|
inputInitPlatform();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventInit(
|
eventInit(
|
||||||
@@ -42,51 +42,14 @@ void inputInit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void inputUpdate(void) {
|
void inputUpdate(void) {
|
||||||
#if INPUT_SDL2 == 1
|
#ifdef inputUpdatePlatform
|
||||||
#if INPUT_GAMEPAD == 1
|
inputUpdatePlatform();
|
||||||
INPUT.controller = NULL;
|
|
||||||
|
|
||||||
for(int32_t i = 0; i < SDL_NumJoysticks(); i++) {
|
|
||||||
if(!SDL_IsGameController(i)) continue;
|
|
||||||
INPUT.controller = SDL_GameControllerOpen(i);
|
|
||||||
if(INPUT.controller) break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INPUT_KEYBOARD == 1
|
|
||||||
INPUT.keyboardState = SDL_GetKeyboardState(NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INPUT_POINTER == 1
|
|
||||||
int pointerX, pointerY;
|
|
||||||
SDL_GetMouseState(&pointerX, &pointerY);
|
|
||||||
|
|
||||||
int windowWidth, windowHeight;
|
|
||||||
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
|
||||||
|
|
||||||
INPUT.mouseX = (float_t)pointerX / (float_t)windowWidth;
|
|
||||||
INPUT.mouseY = (float_t)pointerY / (float_t)windowHeight;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif DOLPHIN
|
|
||||||
PAD_ScanPads();
|
|
||||||
|
|
||||||
for(uint8_t i = 0; i < INPUT_PAD_COUNT; i++) {
|
|
||||||
INPUT.padState[i] = PAD_ButtonsDown(i);
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_LEFT_X] = INPUT_AXIS_FLOAT(PAD_StickX(i));
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_LEFT_Y] = INPUT_AXIS_FLOAT(PAD_StickY(i));
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_C_X] = INPUT_AXIS_FLOAT(PAD_SubStickX(i));
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_C_Y] = INPUT_AXIS_FLOAT(PAD_SubStickY(i));
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_LEFT] = INPUT_AXIS_FLOAT(PAD_TriggerL(i));
|
|
||||||
INPUT.pads[i][INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT] = INPUT_AXIS_FLOAT(PAD_TriggerR(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Reset all actions
|
// Reset all actions
|
||||||
inputactiondata_t *action = &INPUT.actions[0];
|
inputactiondata_t *action = &INPUT.actions[0];
|
||||||
do {
|
do {
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
action->lastDynamicValue = action->currentDynamicValue;
|
action->lastDynamicValue = action->currentDynamicValue;
|
||||||
action->currentDynamicValue = 0.0f;
|
action->currentDynamicValue = 0.0f;
|
||||||
if(!TIME.dynamicUpdate) {
|
if(!TIME.dynamicUpdate) {
|
||||||
@@ -113,7 +76,7 @@ void inputUpdate(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update current val.
|
// Update current val.
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
INPUT.actions[cur->action].currentDynamicValue = mathMax(
|
INPUT.actions[cur->action].currentDynamicValue = mathMax(
|
||||||
cur->curVal, INPUT.actions[cur->action].currentDynamicValue
|
cur->curVal, INPUT.actions[cur->action].currentDynamicValue
|
||||||
);
|
);
|
||||||
@@ -132,7 +95,7 @@ void inputUpdate(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do we need to fire off events?
|
// Do we need to fire off events?
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
if(TIME.dynamicUpdate) return;
|
if(TIME.dynamicUpdate) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -160,7 +123,7 @@ void inputUpdate(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float_t inputGetCurrentValue(const inputaction_t action) {
|
float_t inputGetCurrentValue(const inputaction_t action) {
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
if(TIME.dynamicUpdate) return inputGetCurrentValueDynamic(action);
|
if(TIME.dynamicUpdate) return inputGetCurrentValueDynamic(action);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -169,7 +132,7 @@ float_t inputGetCurrentValue(const inputaction_t action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float_t inputGetLastValue(const inputaction_t action) {
|
float_t inputGetLastValue(const inputaction_t action) {
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
if(TIME.dynamicUpdate) return inputGetLastValueDynamic(action);
|
if(TIME.dynamicUpdate) return inputGetLastValueDynamic(action);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -177,7 +140,7 @@ float_t inputGetLastValue(const inputaction_t action) {
|
|||||||
return INPUT.actions[action].lastValue;
|
return INPUT.actions[action].lastValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
float_t inputGetCurrentValueDynamic(const inputaction_t action) {
|
float_t inputGetCurrentValueDynamic(const inputaction_t action) {
|
||||||
assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds");
|
assertTrue(action < INPUT_ACTION_COUNT, "Input action out of bounds");
|
||||||
return INPUT.actions[action].currentDynamicValue;
|
return INPUT.actions[action].currentDynamicValue;
|
||||||
|
|||||||
@@ -10,11 +10,6 @@
|
|||||||
#include "inputaction.h"
|
#include "inputaction.h"
|
||||||
#include "event/event.h"
|
#include "event/event.h"
|
||||||
|
|
||||||
#if DOLPHIN
|
|
||||||
#define INPUT_PAD_COUNT PAD_CHANMAX
|
|
||||||
#define INPUT_AXIS_FLOAT(value) ((float_t)(value) / 128.0f)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define INPUT_LISTENER_PRESSED_MAX 16
|
#define INPUT_LISTENER_PRESSED_MAX 16
|
||||||
#define INPUT_LISTENER_RELEASED_MAX INPUT_LISTENER_PRESSED_MAX
|
#define INPUT_LISTENER_RELEASED_MAX INPUT_LISTENER_PRESSED_MAX
|
||||||
|
|
||||||
@@ -65,7 +60,7 @@ float_t inputGetCurrentValue(const inputaction_t action);
|
|||||||
*/
|
*/
|
||||||
float_t inputGetLastValue(const inputaction_t action);
|
float_t inputGetLastValue(const inputaction_t action);
|
||||||
|
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
/**
|
/**
|
||||||
* Gets the current value of a specific input action (dynamic timestep).
|
* Gets the current value of a specific input action (dynamic timestep).
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,228 +11,228 @@
|
|||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||||
#if INPUT_SDL2 == 1
|
// #if INPUT_SDL2 == 1
|
||||||
#if INPUT_GAMEPAD == 1
|
// #if INPUT_GAMEPAD == 1
|
||||||
#if PSP
|
// #if PSP
|
||||||
{ .name = "triangle", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
// { .name = "triangle", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
||||||
{ .name = "cross", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
// { .name = "cross", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
||||||
{ .name = "circle", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_B } },
|
// { .name = "circle", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_B } },
|
||||||
{ .name = "square", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_X } },
|
// { .name = "square", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_X } },
|
||||||
{ .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_START } },
|
// { .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_START } },
|
||||||
{ .name = "select", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
// { .name = "select", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
||||||
{ .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
// { .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
||||||
{ .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
// { .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
||||||
{ .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
// { .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
||||||
{ .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
// { .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
||||||
{ .name = "l", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
// { .name = "l", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
||||||
{ .name = "r", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
// { .name = "r", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
||||||
|
|
||||||
{ .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
// { .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
||||||
{ .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
// { .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
||||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
// { .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
||||||
{ .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
// { .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
||||||
#else
|
// #else
|
||||||
{ .name = "a", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
// { .name = "a", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_A } },
|
||||||
{ .name = "b", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_B } },
|
// { .name = "b", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_B } },
|
||||||
{ .name = "x", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_X } },
|
// { .name = "x", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_X } },
|
||||||
{ .name = "y", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
// { .name = "y", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_Y } },
|
||||||
{ .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_START } },
|
// { .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_START } },
|
||||||
{ .name = "back", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
// { .name = "back", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_BACK } },
|
||||||
{ .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
// { .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_UP } },
|
||||||
{ .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
// { .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_DOWN } },
|
||||||
{ .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
// { .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_LEFT } },
|
||||||
{ .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
// { .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_DPAD_RIGHT } },
|
||||||
{ .name = "l1", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
// { .name = "l1", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSHOULDER } },
|
||||||
{ .name = "r1", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
// { .name = "r1", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER } },
|
||||||
{ .name = "l3", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSTICK } },
|
// { .name = "l3", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_LEFTSTICK } },
|
||||||
{ .name = "r3", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSTICK } },
|
// { .name = "r3", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = SDL_CONTROLLER_BUTTON_RIGHTSTICK } },
|
||||||
{ .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
// { .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = true } } },
|
||||||
{ .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
// { .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTY, .positive = false } } },
|
||||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
// { .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = true } } },
|
||||||
{ .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
// { .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_LEFTX, .positive = false } } },
|
||||||
{ .name = "rstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = true } } },
|
// { .name = "rstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = true } } },
|
||||||
{ .name = "rstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = false } } },
|
// { .name = "rstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTY, .positive = false } } },
|
||||||
{ .name = "rstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = true } } },
|
// { .name = "rstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = true } } },
|
||||||
{ .name = "rstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = false } } },
|
// { .name = "rstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_RIGHTX, .positive = false } } },
|
||||||
{ .name = "l2", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_TRIGGERLEFT, .positive = true } } },
|
// { .name = "l2", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_TRIGGERLEFT, .positive = true } } },
|
||||||
{ .name = "r2", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_TRIGGERRIGHT, .positive = true } } },
|
// { .name = "r2", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = SDL_CONTROLLER_AXIS_TRIGGERRIGHT, .positive = true } } },
|
||||||
#endif
|
// #endif
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
#if INPUT_POINTER == 1
|
// #if INPUT_POINTER == 1
|
||||||
{ .name = "mouse_x", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_X } },
|
// { .name = "mouse_x", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_X } },
|
||||||
{ .name = "mouse_y", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_Y } },
|
// { .name = "mouse_y", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_Y } },
|
||||||
// { .name = "mouse_wheel_x", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_WHEEL_X } },
|
// // { .name = "mouse_wheel_x", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_WHEEL_X } },
|
||||||
// { .name = "mouse_wheel_y", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_WHEEL_Y } },
|
// // { .name = "mouse_wheel_y", { .type = INPUT_BUTTON_TYPE_POINTER, .pointerAxis = INPUT_POINTER_AXIS_WHEEL_Y } },
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
#if INPUT_KEYBOARD == 1
|
// #if INPUT_KEYBOARD == 1
|
||||||
{ .name = "a", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_A } },
|
// { .name = "a", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_A } },
|
||||||
{ .name = "b", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_B } },
|
// { .name = "b", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_B } },
|
||||||
{ .name = "c", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_C } },
|
// { .name = "c", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_C } },
|
||||||
{ .name = "d", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_D } },
|
// { .name = "d", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_D } },
|
||||||
{ .name = "e", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_E } },
|
// { .name = "e", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_E } },
|
||||||
{ .name = "f", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F } },
|
// { .name = "f", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F } },
|
||||||
{ .name = "g", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_G } },
|
// { .name = "g", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_G } },
|
||||||
{ .name = "h", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_H } },
|
// { .name = "h", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_H } },
|
||||||
{ .name = "i", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_I } },
|
// { .name = "i", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_I } },
|
||||||
{ .name = "j", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_J } },
|
// { .name = "j", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_J } },
|
||||||
{ .name = "k", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_K } },
|
// { .name = "k", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_K } },
|
||||||
{ .name = "l", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_L } },
|
// { .name = "l", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_L } },
|
||||||
{ .name = "m", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_M } },
|
// { .name = "m", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_M } },
|
||||||
{ .name = "n", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_N } },
|
// { .name = "n", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_N } },
|
||||||
{ .name = "o", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_O } },
|
// { .name = "o", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_O } },
|
||||||
{ .name = "p", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_P } },
|
// { .name = "p", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_P } },
|
||||||
{ .name = "q", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Q } },
|
// { .name = "q", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Q } },
|
||||||
{ .name = "r", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_R } },
|
// { .name = "r", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_R } },
|
||||||
{ .name = "s", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_S } },
|
// { .name = "s", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_S } },
|
||||||
{ .name = "t", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_T } },
|
// { .name = "t", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_T } },
|
||||||
{ .name = "u", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_U } },
|
// { .name = "u", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_U } },
|
||||||
{ .name = "v", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_V } },
|
// { .name = "v", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_V } },
|
||||||
{ .name = "w", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_W } },
|
// { .name = "w", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_W } },
|
||||||
{ .name = "x", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_X } },
|
// { .name = "x", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_X } },
|
||||||
{ .name = "y", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Y } },
|
// { .name = "y", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Y } },
|
||||||
{ .name = "z", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Z } },
|
// { .name = "z", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_Z } },
|
||||||
|
|
||||||
{ .name = "0", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_0 } },
|
// { .name = "0", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_0 } },
|
||||||
{ .name = "1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_1 } },
|
// { .name = "1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_1 } },
|
||||||
{ .name = "2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_2 } },
|
// { .name = "2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_2 } },
|
||||||
{ .name = "3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_3 } },
|
// { .name = "3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_3 } },
|
||||||
{ .name = "4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_4 } },
|
// { .name = "4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_4 } },
|
||||||
{ .name = "5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_5 } },
|
// { .name = "5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_5 } },
|
||||||
{ .name = "6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_6 } },
|
// { .name = "6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_6 } },
|
||||||
{ .name = "7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_7 } },
|
// { .name = "7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_7 } },
|
||||||
{ .name = "8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_8 } },
|
// { .name = "8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_8 } },
|
||||||
{ .name = "9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_9 } },
|
// { .name = "9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_9 } },
|
||||||
|
|
||||||
{ .name = "space", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SPACE } },
|
// { .name = "space", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SPACE } },
|
||||||
{ .name = "shift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LSHIFT } },
|
// { .name = "shift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LSHIFT } },
|
||||||
{ .name = "lshift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LSHIFT } },
|
// { .name = "lshift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LSHIFT } },
|
||||||
{ .name = "rshift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RSHIFT } },
|
// { .name = "rshift", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RSHIFT } },
|
||||||
{ .name = "lctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LCTRL } },
|
// { .name = "lctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LCTRL } },
|
||||||
{ .name = "rctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RCTRL } },
|
// { .name = "rctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RCTRL } },
|
||||||
{ .name = "ctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LCTRL } },
|
// { .name = "ctrl", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LCTRL } },
|
||||||
{ .name = "lalt", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LALT } },
|
// { .name = "lalt", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LALT } },
|
||||||
{ .name = "ralt", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RALT } },
|
// { .name = "ralt", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RALT } },
|
||||||
{ .name = "tab", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_TAB } },
|
// { .name = "tab", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_TAB } },
|
||||||
{ .name = "enter", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RETURN } },
|
// { .name = "enter", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RETURN } },
|
||||||
{ .name = "backspace", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSPACE } },
|
// { .name = "backspace", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSPACE } },
|
||||||
{ .name = "escape", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_ESCAPE } },
|
// { .name = "escape", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_ESCAPE } },
|
||||||
{ .name = "esc", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_ESCAPE } },
|
// { .name = "esc", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_ESCAPE } },
|
||||||
{ .name = "up", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_UP } },
|
// { .name = "up", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_UP } },
|
||||||
{ .name = "down", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_DOWN } },
|
// { .name = "down", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_DOWN } },
|
||||||
{ .name = "left", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFT } },
|
// { .name = "left", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFT } },
|
||||||
{ .name = "right", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHT } },
|
// { .name = "right", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHT } },
|
||||||
{ .name = "pageup", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PAGEUP } },
|
// { .name = "pageup", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PAGEUP } },
|
||||||
{ .name = "pagedown", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PAGEDOWN } },
|
// { .name = "pagedown", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PAGEDOWN } },
|
||||||
{ .name = "home", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_HOME } },
|
// { .name = "home", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_HOME } },
|
||||||
{ .name = "end", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_END } },
|
// { .name = "end", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_END } },
|
||||||
{ .name = "insert", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_INSERT } },
|
// { .name = "insert", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_INSERT } },
|
||||||
{ .name = "delete", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_DELETE } },
|
// { .name = "delete", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_DELETE } },
|
||||||
|
|
||||||
{ .name = "f1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F1 } },
|
// { .name = "f1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F1 } },
|
||||||
{ .name = "f2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F2 } },
|
// { .name = "f2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F2 } },
|
||||||
{ .name = "f3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F3 } },
|
// { .name = "f3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F3 } },
|
||||||
{ .name = "f4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F4 } },
|
// { .name = "f4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F4 } },
|
||||||
{ .name = "f5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F5 } },
|
// { .name = "f5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F5 } },
|
||||||
{ .name = "f6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F6 } },
|
// { .name = "f6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F6 } },
|
||||||
{ .name = "f7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F7 } },
|
// { .name = "f7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F7 } },
|
||||||
{ .name = "f8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F8 } },
|
// { .name = "f8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F8 } },
|
||||||
{ .name = "f9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F9 } },
|
// { .name = "f9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F9 } },
|
||||||
{ .name = "f10", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F10 } },
|
// { .name = "f10", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F10 } },
|
||||||
{ .name = "f11", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F11 } },
|
// { .name = "f11", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F11 } },
|
||||||
{ .name = "f12", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F12 } },
|
// { .name = "f12", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F12 } },
|
||||||
{ .name = "f13", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F13 } },
|
// { .name = "f13", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F13 } },
|
||||||
{ .name = "f14", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F14 } },
|
// { .name = "f14", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F14 } },
|
||||||
{ .name = "f15", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F15 } },
|
// { .name = "f15", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F15 } },
|
||||||
{ .name = "f16", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F16 } },
|
// { .name = "f16", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F16 } },
|
||||||
{ .name = "f17", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F17 } },
|
// { .name = "f17", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F17 } },
|
||||||
{ .name = "f18", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F18 } },
|
// { .name = "f18", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F18 } },
|
||||||
{ .name = "f19", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F19 } },
|
// { .name = "f19", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F19 } },
|
||||||
{ .name = "f20", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F20 } },
|
// { .name = "f20", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F20 } },
|
||||||
{ .name = "f21", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F21 } },
|
// { .name = "f21", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F21 } },
|
||||||
{ .name = "f22", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F22 } },
|
// { .name = "f22", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F22 } },
|
||||||
{ .name = "f23", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F23 } },
|
// { .name = "f23", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F23 } },
|
||||||
{ .name = "f24", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F24 } },
|
// { .name = "f24", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_F24 } },
|
||||||
|
|
||||||
|
|
||||||
{ .name = "minus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_MINUS } },
|
// { .name = "minus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_MINUS } },
|
||||||
{ .name = "equals", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_EQUALS } },
|
// { .name = "equals", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_EQUALS } },
|
||||||
{ .name = "leftbracket", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFTBRACKET } },
|
// { .name = "leftbracket", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFTBRACKET } },
|
||||||
{ .name = "rightbracket", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHTBRACKET } },
|
// { .name = "rightbracket", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHTBRACKET } },
|
||||||
{ .name = "backslash", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSLASH } },
|
// { .name = "backslash", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSLASH } },
|
||||||
{ .name = "semicolon", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SEMICOLON } },
|
// { .name = "semicolon", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SEMICOLON } },
|
||||||
{ .name = "apostrophe", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_APOSTROPHE } },
|
// { .name = "apostrophe", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_APOSTROPHE } },
|
||||||
{ .name = "grave", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_GRAVE } },
|
// { .name = "grave", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_GRAVE } },
|
||||||
{ .name = "comma", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_COMMA } },
|
// { .name = "comma", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_COMMA } },
|
||||||
{ .name = "period", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PERIOD } },
|
// { .name = "period", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PERIOD } },
|
||||||
{ .name = "slash", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SLASH } },
|
// { .name = "slash", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SLASH } },
|
||||||
|
|
||||||
{ .name = "caps", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_CAPSLOCK } },
|
// { .name = "caps", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_CAPSLOCK } },
|
||||||
{ .name = "capslock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_CAPSLOCK } },
|
// { .name = "capslock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_CAPSLOCK } },
|
||||||
{ .name = "numlock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_NUMLOCKCLEAR } },
|
// { .name = "numlock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_NUMLOCKCLEAR } },
|
||||||
{ .name = "scrollock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SCROLLLOCK } },
|
// { .name = "scrollock", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SCROLLLOCK } },
|
||||||
|
|
||||||
{ .name = "-", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_MINUS } },
|
// { .name = "-", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_MINUS } },
|
||||||
{ .name = "=", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_EQUALS } },
|
// { .name = "=", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_EQUALS } },
|
||||||
{ .name = "[", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFTBRACKET } },
|
// { .name = "[", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_LEFTBRACKET } },
|
||||||
{ .name = "]", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHTBRACKET } },
|
// { .name = "]", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_RIGHTBRACKET } },
|
||||||
{ .name = "\\", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSLASH } },
|
// { .name = "\\", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_BACKSLASH } },
|
||||||
{ .name = ";", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SEMICOLON } },
|
// { .name = ";", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SEMICOLON } },
|
||||||
{ .name = "'", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_APOSTROPHE } },
|
// { .name = "'", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_APOSTROPHE } },
|
||||||
{ .name = "`", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_GRAVE } },
|
// { .name = "`", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_GRAVE } },
|
||||||
{ .name = ",", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_COMMA } },
|
// { .name = ",", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_COMMA } },
|
||||||
{ .name = ".", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PERIOD } },
|
// { .name = ".", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_PERIOD } },
|
||||||
{ .name = "/", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SLASH } },
|
// { .name = "/", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_SLASH } },
|
||||||
|
|
||||||
{ .name = "kp_0", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_0 } },
|
// { .name = "kp_0", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_0 } },
|
||||||
{ .name = "kp_1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_1 } },
|
// { .name = "kp_1", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_1 } },
|
||||||
{ .name = "kp_2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_2 } },
|
// { .name = "kp_2", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_2 } },
|
||||||
{ .name = "kp_3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_3 } },
|
// { .name = "kp_3", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_3 } },
|
||||||
{ .name = "kp_4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_4 } },
|
// { .name = "kp_4", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_4 } },
|
||||||
{ .name = "kp_5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_5 } },
|
// { .name = "kp_5", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_5 } },
|
||||||
{ .name = "kp_6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_6 } },
|
// { .name = "kp_6", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_6 } },
|
||||||
{ .name = "kp_7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_7 } },
|
// { .name = "kp_7", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_7 } },
|
||||||
{ .name = "kp_8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_8 } },
|
// { .name = "kp_8", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_8 } },
|
||||||
{ .name = "kp_9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_9 } },
|
// { .name = "kp_9", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_9 } },
|
||||||
{ .name = "kp_period", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_PERIOD } },
|
// { .name = "kp_period", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_PERIOD } },
|
||||||
{ .name = "kp_divide", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_DIVIDE } },
|
// { .name = "kp_divide", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_DIVIDE } },
|
||||||
{ .name = "kp_multiply", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_MULTIPLY } },
|
// { .name = "kp_multiply", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_MULTIPLY } },
|
||||||
{ .name = "kp_minus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_MINUS } },
|
// { .name = "kp_minus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_MINUS } },
|
||||||
{ .name = "kp_plus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_PLUS } },
|
// { .name = "kp_plus", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_PLUS } },
|
||||||
{ .name = "kp_enter", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_ENTER } },
|
// { .name = "kp_enter", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_ENTER } },
|
||||||
{ .name = "kp_equals", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_EQUALS } },
|
// { .name = "kp_equals", { .type = INPUT_BUTTON_TYPE_KEYBOARD, .scancode = SDL_SCANCODE_KP_EQUALS } },
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
#elif DOLPHIN
|
// #elif DOLPHIN
|
||||||
#if INPUT_GAMEPAD == 1
|
// #if INPUT_GAMEPAD == 1
|
||||||
{ .name = "a", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_A } },
|
// { .name = "a", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_A } },
|
||||||
{ .name = "b", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_B } },
|
// { .name = "b", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_B } },
|
||||||
{ .name = "x", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_X } },
|
// { .name = "x", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_X } },
|
||||||
{ .name = "y", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_Y } },
|
// { .name = "y", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_Y } },
|
||||||
{ .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_START } },
|
// { .name = "start", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_START } },
|
||||||
{ .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_UP } },
|
// { .name = "up", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_UP } },
|
||||||
{ .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_DOWN } },
|
// { .name = "down", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_DOWN } },
|
||||||
{ .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_LEFT } },
|
// { .name = "left", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_LEFT } },
|
||||||
{ .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_RIGHT } },
|
// { .name = "right", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_RIGHT } },
|
||||||
{ .name = "l", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_L } },
|
// { .name = "l", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_L } },
|
||||||
{ .name = "r", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_R } },
|
// { .name = "r", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_R } },
|
||||||
{ .name = "z", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_Z } },
|
// { .name = "z", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_TRIGGER_Z } },
|
||||||
{ .name = "menu", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_MENU } },
|
// { .name = "menu", { .type = INPUT_BUTTON_TYPE_GAMEPAD, .gpButton = PAD_BUTTON_MENU } },
|
||||||
{ .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = true } } },
|
// { .name = "lstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = true } } },
|
||||||
{ .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = false } } },
|
// { .name = "lstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_X, .positive = false } } },
|
||||||
{ .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = true } } },
|
// { .name = "lstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = true } } },
|
||||||
{ .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = false } } },
|
// { .name = "lstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_LEFT_Y, .positive = false } } },
|
||||||
{ .name = "rstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = true } } },
|
// { .name = "rstick_up", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = true } } },
|
||||||
{ .name = "rstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = false } } },
|
// { .name = "rstick_down", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_X, .positive = false } } },
|
||||||
{ .name = "rstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = true } } },
|
// { .name = "rstick_left", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = true } } },
|
||||||
{ .name = "rstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = false } } },
|
// { .name = "rstick_right", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_C_Y, .positive = false } } },
|
||||||
{ .name = "ltrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_LEFT, .positive = true } } },
|
// { .name = "ltrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_LEFT, .positive = true } } },
|
||||||
{ .name = "rtrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT, .positive = true } } },
|
// { .name = "rtrigger", { .type = INPUT_BUTTON_TYPE_GAMEPAD_AXIS, .gpAxis = { .axis = INPUT_GAMEPAD_AXIS_TRIGGER_RIGHT, .positive = true } } },
|
||||||
#endif
|
// #endif
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
{ .name = NULL }
|
// { .name = NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
inputbutton_t inputButtonGetByName(const char_t *name) {
|
inputbutton_t inputButtonGetByName(const char_t *name) {
|
||||||
@@ -247,78 +247,4 @@ inputbutton_t inputButtonGetByName(const char_t *name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (inputbutton_t){ .type = INPUT_BUTTON_TYPE_NONE };
|
return (inputbutton_t){ .type = INPUT_BUTTON_TYPE_NONE };
|
||||||
}
|
|
||||||
|
|
||||||
float_t inputButtonGetValue(const inputbutton_t button) {
|
|
||||||
switch(button.type) {
|
|
||||||
#if INPUT_KEYBOARD == 1
|
|
||||||
case INPUT_BUTTON_TYPE_KEYBOARD: {
|
|
||||||
#if INPUT_SDL2 == 1
|
|
||||||
return INPUT.keyboardState[button.scancode] ? 1.0f : 0.0f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INPUT_POINTER == 1
|
|
||||||
case INPUT_BUTTON_TYPE_POINTER: {
|
|
||||||
switch(button.pointerAxis) {
|
|
||||||
case INPUT_POINTER_AXIS_X:
|
|
||||||
#if INPUT_SDL2 == 1
|
|
||||||
return INPUT.mouseX;
|
|
||||||
#endif
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
case INPUT_POINTER_AXIS_Y:
|
|
||||||
#if INPUT_SDL2 == 1
|
|
||||||
return INPUT.mouseY;
|
|
||||||
#endif
|
|
||||||
return 0.0f;
|
|
||||||
|
|
||||||
default: {
|
|
||||||
assertUnreachable("Unknown pointer axis");
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if INPUT_GAMEPAD == 1
|
|
||||||
case INPUT_BUTTON_TYPE_GAMEPAD: {
|
|
||||||
#if INPUT_SDL2 == 1
|
|
||||||
if(SDL_GameControllerGetButton(INPUT.controller, button.gpButton)) {
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
#elif DOLPHIN
|
|
||||||
if(INPUT.padState[0] & button.gpButton) return 1.0f;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
case INPUT_BUTTON_TYPE_GAMEPAD_AXIS: {
|
|
||||||
float_t value = 0.0f;
|
|
||||||
|
|
||||||
#if INPUT_SDL2 == 1
|
|
||||||
Sint16 axis = SDL_GameControllerGetAxis(INPUT.controller, button.gpAxis.axis);
|
|
||||||
value = (float_t)axis / 32767.0f;
|
|
||||||
|
|
||||||
#elif DOLPHIN
|
|
||||||
value = INPUT.pads[0][button.gpAxis.axis];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!button.gpAxis.positive) value = -value;
|
|
||||||
if(value >= INPUT.deadzone) return value;
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default: {
|
|
||||||
assertUnreachable("Unknown input button type");
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,50 +9,41 @@
|
|||||||
#include "util/memory.h"
|
#include "util/memory.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
|
|
||||||
#if TIME_SDL2
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dusktime_t TIME;
|
dusktime_t TIME;
|
||||||
|
|
||||||
void timeInit(void) {
|
void timeInit(void) {
|
||||||
memoryZero(&TIME, sizeof(TIME));
|
memoryZero(&TIME, sizeof(TIME));
|
||||||
|
|
||||||
// Set these to something non-zero.
|
// Set these to something non-zero.
|
||||||
TIME.time = TIME_STEP;
|
TIME.time = DUSK_TIME_STEP;
|
||||||
TIME.delta = TIME_STEP;
|
TIME.delta = DUSK_TIME_STEP;
|
||||||
|
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
TIME.dynamicTime = TIME_STEP;
|
TIME.dynamicTime = DUSK_TIME_STEP;
|
||||||
TIME.dynamicDelta = TIME_STEP;
|
TIME.dynamicDelta = DUSK_TIME_STEP;
|
||||||
TIME.dynamicUpdate = false;
|
TIME.dynamicUpdate = false;
|
||||||
TIME.lastNonDynamic = TIME.dynamicTime;
|
TIME.lastNonDynamic = TIME.dynamicTime;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void timeUpdate(void) {
|
void timeUpdate(void) {
|
||||||
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
#if TIME_FIXED == 0
|
timeTickPlatform();
|
||||||
#if TIME_SDL2
|
TIME.dynamicDelta = timeGetDeltaPlatform();
|
||||||
float_t msElapsed = ((float_t)SDL_GetTicks64() / 1000.0f) + TIME_STEP;
|
TIME.dynamicTime += TIME.dynamicDelta;
|
||||||
TIME.dynamicDelta = msElapsed - TIME.dynamicTime;
|
TIME.dynamicUpdate = true;
|
||||||
TIME.dynamicTime = msElapsed;
|
|
||||||
TIME.dynamicUpdate = true;
|
|
||||||
#else
|
|
||||||
#error "No time platform defined"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
assertTrue(TIME.dynamicDelta >= 0.0f, "Time delta is negative");
|
assertTrue(TIME.dynamicDelta >= 0.0f, "Time delta is negative");
|
||||||
|
|
||||||
// Is within 1ms of a full step?
|
// Is within 1ms of a full step?
|
||||||
if(TIME.dynamicTime - TIME.lastNonDynamic >= TIME_STEP * 0.999f) {
|
if(TIME.dynamicTime - TIME.lastNonDynamic >= DUSK_TIME_STEP * 0.999f) {
|
||||||
TIME.dynamicUpdate = false;
|
TIME.dynamicUpdate = false;
|
||||||
TIME.lastNonDynamic = TIME.dynamicTime;
|
TIME.lastNonDynamic = TIME.dynamicTime;
|
||||||
TIME.delta = TIME_STEP;
|
TIME.delta = DUSK_TIME_STEP;
|
||||||
TIME.time += TIME_STEP;
|
TIME.time += DUSK_TIME_STEP;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
TIME.delta = TIME_STEP;
|
TIME.delta = DUSK_TIME_STEP;
|
||||||
TIME.time += TIME_STEP;
|
TIME.time += DUSK_TIME_STEP;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -7,17 +7,26 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dusk.h"
|
#include "dusk.h"
|
||||||
|
#include "time/timeplatform.h"
|
||||||
|
|
||||||
#define TIME_STEP (16.0f / 1000.0f)
|
#ifndef DUSK_TIME_STEP
|
||||||
#ifndef TIME_FIXED
|
#define DUSK_TIME_STEP (16.0f / 1000.0f)
|
||||||
#define TIME_FIXED 0
|
#endif
|
||||||
|
|
||||||
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
|
#ifndef timeTickPlatform
|
||||||
|
#error "DUSK_TIME_DYNAMIC needs tick method defined"
|
||||||
|
#endif
|
||||||
|
#ifndef timeGetDeltaPlatform
|
||||||
|
#error "DUSK_TIME_DYNAMIC needs delta method defined"
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float_t delta;
|
float_t delta;
|
||||||
float_t time;
|
float_t time;
|
||||||
|
|
||||||
#if TIME_FIXED == 0
|
#ifdef DUSK_TIME_DYNAMIC
|
||||||
float_t lastNonDynamic;
|
float_t lastNonDynamic;
|
||||||
bool_t dynamicUpdate;
|
bool_t dynamicUpdate;
|
||||||
float_t dynamicDelta;
|
float_t dynamicDelta;
|
||||||
|
|||||||
@@ -8,9 +8,8 @@
|
|||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "util/memory.h"
|
#include "util/memory.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
#include "display/spritebatch.h"
|
#include "display/spritebatch/spritebatch.h"
|
||||||
#include "display/screen.h"
|
#include "display/screen/screen.h"
|
||||||
|
|
||||||
#include "debug/debug.h"
|
#include "debug/debug.h"
|
||||||
|
|
||||||
ui_t UI;
|
ui_t UI;
|
||||||
|
|||||||
@@ -28,4 +28,5 @@ errorret_t displayOpenGLInit(void) {
|
|||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
errorChain(errorGLCheck());
|
errorChain(errorGLCheck());
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
@@ -8,12 +8,13 @@
|
|||||||
#include "display/display.h"
|
#include "display/display.h"
|
||||||
#include "display/framebuffer/framebuffer.h"
|
#include "display/framebuffer/framebuffer.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
|
#include "util/memory.h"
|
||||||
|
|
||||||
errorret_t frameBufferGLInitBackBuffer(void) {
|
errorret_t frameBufferGLInitBackBuffer(void) {
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t frameBufferGetWidth(const framebuffer_t *framebuffer) {
|
uint32_t frameBufferGLGetWidth(const framebuffer_t *framebuffer) {
|
||||||
if(framebuffer == NULL) {
|
if(framebuffer == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ typedef enum {
|
|||||||
} meshprimitivetypegl_t;
|
} meshprimitivetypegl_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
const meshvertex_t *vertices;
|
||||||
|
int32_t vertexCount;
|
||||||
|
meshprimitivetypegl_t primitiveType;
|
||||||
} meshgl_t;
|
} meshgl_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ errorret_t textureInitGL(
|
|||||||
);
|
);
|
||||||
errorChain(errorGLCheck());
|
errorChain(errorGLCheck());
|
||||||
|
|
||||||
glColorTableEXT(
|
// glColorTableEXT(
|
||||||
GL_TEXTURE_2D, GL_RGBA, data.palette.palette->colorCount, GL_RGBA,
|
// GL_TEXTURE_2D, GL_RGBA, data.palette.palette->colorCount, GL_RGBA,
|
||||||
GL_UNSIGNED_BYTE, (const void*)data.palette.palette->colors
|
// GL_UNSIGNED_BYTE, (const void*)data.palette.palette->colors
|
||||||
);
|
// );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ target_include_directories(${DUSK_LIBRARY_TARGET_NAME}
|
|||||||
|
|
||||||
# Subdirs
|
# Subdirs
|
||||||
add_subdirectory(display)
|
add_subdirectory(display)
|
||||||
add_subdirectory(input)
|
add_subdirectory(input)
|
||||||
|
add_subdirectory(time)
|
||||||
@@ -8,10 +8,11 @@
|
|||||||
#include "display/display.h"
|
#include "display/display.h"
|
||||||
#include "engine/engine.h"
|
#include "engine/engine.h"
|
||||||
#include "display/displaygl.h"
|
#include "display/displaygl.h"
|
||||||
|
#include "error/errorgl.h"
|
||||||
|
|
||||||
erroret_t displaySDL2Init(void) {
|
errorret_t displaySDL2Init(void) {
|
||||||
uint32_t flags = SDL_INIT_VIDEO;
|
uint32_t flags = SDL_INIT_VIDEO;
|
||||||
#if INPUT_GAMEPAD == 1
|
#ifdef DUSK_INPUT_GAMEPAD
|
||||||
flags |= SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK;
|
flags |= SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK;
|
||||||
#endif
|
#endif
|
||||||
if(SDL_Init(flags) != 0) {
|
if(SDL_Init(flags) != 0) {
|
||||||
@@ -26,8 +27,8 @@ erroret_t displaySDL2Init(void) {
|
|||||||
"Dusk",
|
"Dusk",
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED,
|
||||||
DUSK_WINDOW_WIDTH_DEFAULT,
|
DUSK_DISPLAY_WIDTH_DEFAULT,
|
||||||
DUSK_WINDOW_HEIGHT_DEFAULT,
|
DUSK_DISPLAY_HEIGHT_DEFAULT,
|
||||||
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI |
|
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI |
|
||||||
SDL_WINDOW_OPENGL
|
SDL_WINDOW_OPENGL
|
||||||
);
|
);
|
||||||
@@ -48,12 +49,12 @@ erroret_t displaySDL2Init(void) {
|
|||||||
|
|
||||||
errorChain(displayOpenGLInit());
|
errorChain(displayOpenGLInit());
|
||||||
|
|
||||||
|
|
||||||
// #if DUSK_PSP
|
// #if DUSK_PSP
|
||||||
// errorChain(displayPSPInit());
|
// errorChain(displayPSPInit());
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
errorChain(errorGLCheck());
|
errorChain(errorGLCheck());
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
errorret_t displaySDL2Update(void) {
|
errorret_t displaySDL2Update(void) {
|
||||||
@@ -90,11 +91,7 @@ errorret_t displaySDL2Update(void) {
|
|||||||
|
|
||||||
errorret_t displaySDL2Swap(void) {
|
errorret_t displaySDL2Swap(void) {
|
||||||
SDL_GL_SwapWindow(DISPLAY.window);
|
SDL_GL_SwapWindow(DISPLAY.window);
|
||||||
|
errorChain(errorGLCheck());
|
||||||
GLenum err;
|
|
||||||
while((err = glGetError()) != GL_NO_ERROR) {
|
|
||||||
debugPrint("GL Error: %d\n", err);
|
|
||||||
}
|
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
typedef inputpointeraxissdl2_t inputpointeraxisplatform_t;
|
typedef inputpointeraxissdl2_t inputpointeraxisplatform_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define inputUpdatePlatform inputUpdateSDL2
|
||||||
#define inputButtonGetValuePlatform inputButtonGetValueSDL2
|
#define inputButtonGetValuePlatform inputButtonGetValueSDL2
|
||||||
|
|
||||||
typedef inputsdl2_t inputplatform_t;
|
typedef inputsdl2_t inputplatform_t;
|
||||||
@@ -6,12 +6,40 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
|
#include "assert/assert.h"
|
||||||
|
|
||||||
|
void inputUpdateSDL2(void) {
|
||||||
|
#if INPUT_GAMEPAD == 1
|
||||||
|
INPUT.controller = NULL;
|
||||||
|
|
||||||
|
for(int32_t i = 0; i < SDL_NumJoysticks(); i++) {
|
||||||
|
if(!SDL_IsGameController(i)) continue;
|
||||||
|
INPUT.controller = SDL_GameControllerOpen(i);
|
||||||
|
if(INPUT.controller) break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INPUT_KEYBOARD == 1
|
||||||
|
INPUT.keyboardState = SDL_GetKeyboardState(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INPUT_POINTER == 1
|
||||||
|
int pointerX, pointerY;
|
||||||
|
SDL_GetMouseState(&pointerX, &pointerY);
|
||||||
|
|
||||||
|
int windowWidth, windowHeight;
|
||||||
|
SDL_GetWindowSize(DISPLAY.window, &windowWidth, &windowHeight);
|
||||||
|
|
||||||
|
INPUT.mouseX = (float_t)pointerX / (float_t)windowWidth;
|
||||||
|
INPUT.mouseY = (float_t)pointerY / (float_t)windowHeight;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
float_t inputButtonGetValue(const inputbutton_t button) {
|
float_t inputButtonGetValue(const inputbutton_t button) {
|
||||||
switch(button.type) {
|
switch(button.type) {
|
||||||
#ifdef DUSK_INPUT_KEYBOARD
|
#ifdef DUSK_INPUT_KEYBOARD
|
||||||
case INPUT_BUTTON_TYPE_KEYBOARD: {
|
case INPUT_BUTTON_TYPE_KEYBOARD: {
|
||||||
return INPUT.keyboardState[button.scancode] ? 1.0f : 0.0f;
|
return INPUT.platform.keyboardState[button.scancode] ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -19,10 +47,10 @@ float_t inputButtonGetValue(const inputbutton_t button) {
|
|||||||
case INPUT_BUTTON_TYPE_POINTER: {
|
case INPUT_BUTTON_TYPE_POINTER: {
|
||||||
switch(button.pointerAxis) {
|
switch(button.pointerAxis) {
|
||||||
case INPUT_POINTER_AXIS_X:
|
case INPUT_POINTER_AXIS_X:
|
||||||
return INPUT.mouseX;
|
return INPUT.platform.mouseX;
|
||||||
|
|
||||||
case INPUT_POINTER_AXIS_Y:
|
case INPUT_POINTER_AXIS_Y:
|
||||||
return INPUT.mouseY;
|
return INPUT.platform.mouseY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assertUnreachable("Unknown pointer axis");
|
assertUnreachable("Unknown pointer axis");
|
||||||
@@ -33,7 +61,9 @@ float_t inputButtonGetValue(const inputbutton_t button) {
|
|||||||
|
|
||||||
#ifdef DUSK_INPUT_GAMEPAD
|
#ifdef DUSK_INPUT_GAMEPAD
|
||||||
case INPUT_BUTTON_TYPE_GAMEPAD: {
|
case INPUT_BUTTON_TYPE_GAMEPAD: {
|
||||||
if(SDL_GameControllerGetButton(INPUT.controller, button.gpButton)) {
|
if(SDL_GameControllerGetButton(
|
||||||
|
INPUT.platform.controller, button.gpButton
|
||||||
|
)) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@@ -42,7 +72,9 @@ float_t inputButtonGetValue(const inputbutton_t button) {
|
|||||||
case INPUT_BUTTON_TYPE_GAMEPAD_AXIS: {
|
case INPUT_BUTTON_TYPE_GAMEPAD_AXIS: {
|
||||||
float_t value = 0.0f;
|
float_t value = 0.0f;
|
||||||
|
|
||||||
Sint16 axis = SDL_GameControllerGetAxis(INPUT.controller, button.gpAxis.axis);
|
Sint16 axis = SDL_GameControllerGetAxis(
|
||||||
|
INPUT.platform.controller, button.gpAxis.axis
|
||||||
|
);
|
||||||
value = (float_t)axis / 32767.0f;
|
value = (float_t)axis / 32767.0f;
|
||||||
|
|
||||||
if(!button.gpAxis.positive) value = -value;
|
if(!button.gpAxis.positive) value = -value;
|
||||||
|
|||||||
@@ -30,21 +30,24 @@ typedef struct inputbutton_s inputbutton_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if INPUT_GAMEPAD == 1
|
#ifdef DUSK_INPUT_GAMEPAD
|
||||||
SDL_GameController *controller;
|
SDL_GameController *controller;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if INPUT_KEYBOARD == 1
|
#ifdef DUSK_INPUT_KEYBOARD
|
||||||
const uint8_t *keyboardState;
|
const uint8_t *keyboardState;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if INPUT_POINTER == 1
|
#ifdef DUSK_INPUT_POINTER
|
||||||
#if INPUT_SDL2 == 1
|
float_t mouseX, mouseY;
|
||||||
float_t mouseX, mouseY;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
} inputsdl2_t;
|
} inputsdl2_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the input state for SDL2.
|
||||||
|
*/
|
||||||
|
void inputUpdateSDL2(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the input value (between 0 and 1) of the given button.
|
* Returns the input value (between 0 and 1) of the given button.
|
||||||
*
|
*
|
||||||
|
|||||||
12
src/dusksdl2/time/CMakeLists.txt
Normal file
12
src/dusksdl2/time/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (c) 2026 Dominic Masters
|
||||||
|
#
|
||||||
|
# This software is released under the MIT License.
|
||||||
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
# Sources
|
||||||
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
timesdl2.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Subdirs
|
||||||
12
src/dusksdl2/time/timeplatform.h
Normal file
12
src/dusksdl2/time/timeplatform.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "timesdl2.h"
|
||||||
|
|
||||||
|
#define timeTickPlatform timeTickSDL2
|
||||||
|
#define timeGetDeltaPlatform timeGetDeltaSDL2
|
||||||
17
src/dusksdl2/time/timesdl2.c
Normal file
17
src/dusksdl2/time/timesdl2.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "timesdl2.h"
|
||||||
|
|
||||||
|
void timeTickSDL2(void) {
|
||||||
|
TIME_TICKS_LAST_SDL2 = TIME_TICKS_SDL2;
|
||||||
|
TIME_TICKS_SDL2 = SDL_GetTicks64();
|
||||||
|
}
|
||||||
|
|
||||||
|
float_t timeGetDeltaSDL2(void) {
|
||||||
|
return (float_t)(TIME_TICKS_SDL2 - TIME_TICKS_LAST_SDL2) / 1000.0f;
|
||||||
|
}
|
||||||
24
src/dusksdl2/time/timesdl2.h
Normal file
24
src/dusksdl2/time/timesdl2.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "dusk.h"
|
||||||
|
|
||||||
|
static uint64_t TIME_TICKS_SDL2 = 0;
|
||||||
|
static uint64_t TIME_TICKS_LAST_SDL2 = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests SDL2 to update its internal game ticks.
|
||||||
|
*/
|
||||||
|
void timeTickSDL2(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the time delta for this tick in seconds.
|
||||||
|
*
|
||||||
|
* @return The time delta for this tick in seconds.
|
||||||
|
*/
|
||||||
|
float_t timeGetDeltaSDL2(void);
|
||||||
Reference in New Issue
Block a user