diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7ea0e25..1847afd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,7 +36,6 @@ add_subdirectory(error) add_subdirectory(input) # add_subdirectory(locale) add_subdirectory(physics) -add_subdirectory(platform) add_subdirectory(rpg) add_subdirectory(scene) add_subdirectory(thread) diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt index b2a4822..7a4f84c 100644 --- a/src/display/CMakeLists.txt +++ b/src/display/CMakeLists.txt @@ -25,6 +25,7 @@ if(DUSK_TARGET_SYSTEM STREQUAL "linux") DISPLAY_SDL2=1 DISPLAY_WINDOW_WIDTH_DEFAULT=1080 DISPLAY_WINDOW_HEIGHT_DEFAULT=810 + DISPLAY_SCREEN_HEIGHT_DEFAULT=270 ) elseif(DUSK_TARGET_SYSTEM STREQUAL "psp") target_compile_definitions(${DUSK_TARGET_NAME} diff --git a/src/display/screen.c b/src/display/screen.c index 562da05..5410066 100644 --- a/src/display/screen.c +++ b/src/display/screen.c @@ -15,7 +15,11 @@ screen_t SCREEN; void screenInit() { memoryZero(&SCREEN, sizeof(screen_t)); + #if DISPLAY_SIZE_DYNAMIC == 1 + SCREEN.mode = SCREEN_MODE_FIXED_HEIGHT; + SCREEN.fixedHeight.height = DISPLAY_SCREEN_HEIGHT_DEFAULT; + cameraInitOrthographic(&SCREEN.framebufferCamera); SCREEN.framebufferCamera.viewType = CAMERA_VIEW_TYPE_2D; SCREEN.framebufferCamera._2d.position[0] = 0; diff --git a/src/display/screen.h b/src/display/screen.h index 397aee8..925ef65 100644 --- a/src/display/screen.h +++ b/src/display/screen.h @@ -11,6 +11,12 @@ #include "display/camera.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 { SCREEN_MODE_BACKBUFFER, diff --git a/src/engine/engine.c b/src/engine/engine.c index 7a34b2e..81514f5 100644 --- a/src/engine/engine.c +++ b/src/engine/engine.c @@ -46,6 +46,8 @@ errorret_t engineUpdate(void) { sceneManagerUpdate(); errorChain(displayUpdate()); + if(inputPressed(INPUT_ACTION_RAGEQUIT)) ENGINE.running = false; + errorOk(); } diff --git a/src/input/input.c b/src/input/input.c index 0d143b9..881a263 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -23,6 +23,41 @@ void inputInit(void) { } 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) { diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 9b042f8..07bf400 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -16,6 +16,7 @@ typedef enum { INPUT_ACTION_RIGHT, INPUT_ACTION_ACCEPT, INPUT_ACTION_CANCEL, + INPUT_ACTION_RAGEQUIT, INPUT_ACTION_COUNT } inputaction_t;