default binds

This commit is contained in:
2025-11-03 14:33:42 -06:00
parent 3ef6205ea3
commit b4fb7bf99f
7 changed files with 49 additions and 1 deletions

View File

@@ -36,7 +36,6 @@ add_subdirectory(error)
add_subdirectory(input) add_subdirectory(input)
# add_subdirectory(locale) # add_subdirectory(locale)
add_subdirectory(physics) add_subdirectory(physics)
add_subdirectory(platform)
add_subdirectory(rpg) add_subdirectory(rpg)
add_subdirectory(scene) add_subdirectory(scene)
add_subdirectory(thread) add_subdirectory(thread)

View File

@@ -25,6 +25,7 @@ if(DUSK_TARGET_SYSTEM STREQUAL "linux")
DISPLAY_SDL2=1 DISPLAY_SDL2=1
DISPLAY_WINDOW_WIDTH_DEFAULT=1080 DISPLAY_WINDOW_WIDTH_DEFAULT=1080
DISPLAY_WINDOW_HEIGHT_DEFAULT=810 DISPLAY_WINDOW_HEIGHT_DEFAULT=810
DISPLAY_SCREEN_HEIGHT_DEFAULT=270
) )
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp") elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
target_compile_definitions(${DUSK_TARGET_NAME} target_compile_definitions(${DUSK_TARGET_NAME}

View File

@@ -15,7 +15,11 @@ screen_t SCREEN;
void screenInit() { void screenInit() {
memoryZero(&SCREEN, sizeof(screen_t)); memoryZero(&SCREEN, sizeof(screen_t));
#if DISPLAY_SIZE_DYNAMIC == 1 #if DISPLAY_SIZE_DYNAMIC == 1
SCREEN.mode = SCREEN_MODE_FIXED_HEIGHT;
SCREEN.fixedHeight.height = DISPLAY_SCREEN_HEIGHT_DEFAULT;
cameraInitOrthographic(&SCREEN.framebufferCamera); cameraInitOrthographic(&SCREEN.framebufferCamera);
SCREEN.framebufferCamera.viewType = CAMERA_VIEW_TYPE_2D; SCREEN.framebufferCamera.viewType = CAMERA_VIEW_TYPE_2D;
SCREEN.framebufferCamera._2d.position[0] = 0; SCREEN.framebufferCamera._2d.position[0] = 0;

View File

@@ -11,6 +11,12 @@
#include "display/camera.h" #include "display/camera.h"
#include "display/mesh/quad.h" #include "display/mesh/quad.h"
#if DISPLAY_SIZE_DYNAMIC == 1
#ifndef DISPLAY_SCREEN_HEIGHT_DEFAULT
#error "DISPLAY_SCREEN_HEIGHT_DEFAULT must be defined when DISPLAY_SIZE_DYNAMIC is enabled."
#endif
#endif
typedef enum { typedef enum {
SCREEN_MODE_BACKBUFFER, SCREEN_MODE_BACKBUFFER,

View File

@@ -46,6 +46,8 @@ errorret_t engineUpdate(void) {
sceneManagerUpdate(); sceneManagerUpdate();
errorChain(displayUpdate()); errorChain(displayUpdate());
if(inputPressed(INPUT_ACTION_RAGEQUIT)) ENGINE.running = false;
errorOk(); errorOk();
} }

View File

@@ -23,6 +23,41 @@ void inputInit(void) {
} }
INPUT.deadzone = 0.1f; INPUT.deadzone = 0.1f;
// Setup Default Binds
#if INPUT_SDL2 == 1
#if INPUT_KEYBOARD == 1
inputBind(inputButtonGetByName("up"), INPUT_ACTION_UP);
inputBind(inputButtonGetByName("down"), INPUT_ACTION_DOWN);
inputBind(inputButtonGetByName("left"), INPUT_ACTION_LEFT);
inputBind(inputButtonGetByName("right"), INPUT_ACTION_RIGHT);
inputBind(inputButtonGetByName("w"), INPUT_ACTION_UP);
inputBind(inputButtonGetByName("s"), INPUT_ACTION_DOWN);
inputBind(inputButtonGetByName("a"), INPUT_ACTION_LEFT);
inputBind(inputButtonGetByName("d"), INPUT_ACTION_RIGHT);
inputBind(inputButtonGetByName("enter"), INPUT_ACTION_ACCEPT);
inputBind(inputButtonGetByName("escape"), INPUT_ACTION_RAGEQUIT);
inputBind(inputButtonGetByName("space"), INPUT_ACTION_ACCEPT);
inputBind(inputButtonGetByName("backspace"), INPUT_ACTION_CANCEL);
inputBind(inputButtonGetByName("e"), INPUT_ACTION_ACCEPT);
inputBind(inputButtonGetByName("q"), INPUT_ACTION_CANCEL);
#endif
#if INPUT_GAMEPAD == 1
#if PSP
inputBind(inputButtonGetByName("up"), INPUT_ACTION_UP);
inputBind(inputButtonGetByName("down"), INPUT_ACTION_DOWN);
inputBind(inputButtonGetByName("left"), INPUT_ACTION_LEFT);
inputBind(inputButtonGetByName("right"), INPUT_ACTION_RIGHT);
inputBind(inputButtonGetByName("circle"), INPUT_ACTION_CANCEL);
inputBind(inputButtonGetByName("cross"), INPUT_ACTION_ACCEPT);
inputBind(inputButtonGetByName("lstick_negative_y"), INPUT_ACTION_UP);
inputBind(inputButtonGetByName("lstick_positive_y"), INPUT_ACTION_DOWN);
inputBind(inputButtonGetByName("lstick_negative_x"), INPUT_ACTION_LEFT);
inputBind(inputButtonGetByName("lstick_positive_x"), INPUT_ACTION_RIGHT);
#endif
#endif
#endif
} }
void inputUpdate(void) { void inputUpdate(void) {

View File

@@ -16,6 +16,7 @@ typedef enum {
INPUT_ACTION_RIGHT, INPUT_ACTION_RIGHT,
INPUT_ACTION_ACCEPT, INPUT_ACTION_ACCEPT,
INPUT_ACTION_CANCEL, INPUT_ACTION_CANCEL,
INPUT_ACTION_RAGEQUIT,
INPUT_ACTION_COUNT INPUT_ACTION_COUNT
} inputaction_t; } inputaction_t;