From 3a68c6f700eba8a985f118febfcdd5ba07ee7477 Mon Sep 17 00:00:00 2001 From: marouault Date: Sat, 11 Dec 2021 17:11:42 +0100 Subject: [PATCH] Slightly changed the main to make the app run correctly --- Pontu/CMakeLists.txt | 3 ++- Pontu/{src => entryPoints}/main.c | 39 +++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) rename Pontu/{src => entryPoints}/main.c (51%) diff --git a/Pontu/CMakeLists.txt b/Pontu/CMakeLists.txt index 236b4d2..3f40f38 100644 --- a/Pontu/CMakeLists.txt +++ b/Pontu/CMakeLists.txt @@ -5,7 +5,8 @@ SET(PROJECT_NAME Pontu) project(${PROJECT_NAME}) file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c) -add_executable(${PROJECT_NAME} ${MY_SOURCES}) +add_executable(${PROJECT_NAME} ${MY_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/entryPoints/main.c) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/Pontu/src/main.c b/Pontu/entryPoints/main.c similarity index 51% rename from Pontu/src/main.c rename to Pontu/entryPoints/main.c index 921d546..3320b8f 100644 --- a/Pontu/src/main.c +++ b/Pontu/entryPoints/main.c @@ -1,5 +1,8 @@ #include #include +#include +#include "engine/InputProcessor.h" +#include "engine/InputElement.h" int main(int argc, char* argv[]) { @@ -27,12 +30,44 @@ int main(int argc, char* argv[]) goto Quit; } - SDL_bool quit = SDL_FALSE; + InputProcessor inputProcessor = {.selectedCase = {.x=-1, .y=-1}}; + SDL_Rect rectBoard = {.x=20, .y=20, .w=99, .h=99}; + + bool quit = false; while(!quit) { // Event handling + InputElement inputElement; + while (InputType_None != (inputElement = proccessInput(&inputProcessor, &rectBoard)).type) { + + switch (inputElement.type) + { + case InputType_ActivateUI: + switch (inputElement.data.uiAction) + { + case UIAction_Quit: + quit = true; + break; + case UIAction_Validate: + break; + case UIAction_Cancel: + break; + default: + break; + } + break; + case InputType_MoveGame: + + break; + case InputType_ClickGame: + break; + case InputType_None: + default: + break; + } + } - + // Drawing