About to add scene rendering

This commit is contained in:
2025-08-12 00:05:58 -05:00
parent 7804cf75e6
commit b0cd37eeaa
13 changed files with 181 additions and 92 deletions

View File

@@ -0,0 +1,52 @@
/**
* Copyright (c) 2025 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusksdl2.h"
#include "input.h"
#ifndef INPUT_SUPPORT_GAMEPAD
#define INPUT_SUPPORT_GAMEPAD 1
#endif
#ifndef INPUT_SUPPORT_KEYBOARD
#define INPUT_SUPPORT_KEYBOARD 1
#endif
#if INPUT_SUPPORT_GAMEPAD
typedef struct {
const SDL_GameControllerButton button;
const uint8_t bind;
} inputsdlbuttonmap_t;
static const inputsdlbuttonmap_t INPUT_SDL_BUTTON_MAP[] = {
{ SDL_CONTROLLER_BUTTON_DPAD_UP, INPUT_BIND_UP },
{ SDL_CONTROLLER_BUTTON_DPAD_DOWN, INPUT_BIND_DOWN },
{ SDL_CONTROLLER_BUTTON_DPAD_LEFT, INPUT_BIND_LEFT },
{ SDL_CONTROLLER_BUTTON_DPAD_RIGHT, INPUT_BIND_RIGHT },
{ SDL_CONTROLLER_BUTTON_A, INPUT_BIND_ACTION },
{ SDL_CONTROLLER_BUTTON_B, INPUT_BIND_CANCEL },
{ 0, 0 }
};
#endif
#if INPUT_SUPPORT_KEYBOARD
typedef struct {
SDL_Scancode code;
uint8_t bind;
} inputsdlkbmap_t;
static const inputsdlkbmap_t INPUT_SDL_KEYBOARD_MAP[] = {
{ SDL_SCANCODE_W, INPUT_BIND_UP },
{ SDL_SCANCODE_S, INPUT_BIND_DOWN },
{ SDL_SCANCODE_A, INPUT_BIND_LEFT },
{ SDL_SCANCODE_D, INPUT_BIND_RIGHT },
{ SDL_SCANCODE_SPACE, INPUT_BIND_ACTION },
{ SDL_SCANCODE_ESCAPE, INPUT_BIND_CANCEL },
{ 0, 0 }
};
#endif