diff --git a/.gitmodules b/.gitmodules index 020a34e..c253742 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "src/gilles/simulatorapi/simapi"] path = src/gilles/simulatorapi/simapi url = https://github.com/Spacefreak18/simapi +[submodule "src/gilles/GUIslice"] + path = src/gilles/GUIslice + url = https://github.com/spacefreak18/GUIslice.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 9eeee4c..59f1196 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ add_subdirectory(src/gilles/helper) add_subdirectory(src/gilles/slog) add_executable(gilles src/gilles/gilles.c) -target_link_libraries(gilles m ncursesw argtable2 config gameloop helper slog simulatorapi eclipse-paho-mqtt-c::paho-mqtt3c pthread json-c) +target_link_libraries(gilles m ncursesw argtable2 config gameloop helper slog simulatorapi eclipse-paho-mqtt-c::paho-mqtt3c pthread json-c SDL SDL_ttf SDL_gfx) # used for enabling additional compiler options if supported include(CheckCXXCompilerFlag) diff --git a/src/gilles/GUIslice b/src/gilles/GUIslice new file mode 160000 index 0000000..8899915 --- /dev/null +++ b/src/gilles/GUIslice @@ -0,0 +1 @@ +Subproject commit 8899915eff8f390b62af7f1f9d1b26ca820c06ee diff --git a/src/gilles/gameloop/CMakeLists.txt b/src/gilles/gameloop/CMakeLists.txt index d645471..a40d943 100644 --- a/src/gilles/gameloop/CMakeLists.txt +++ b/src/gilles/gameloop/CMakeLists.txt @@ -1,10 +1,16 @@ set(gameloop_source_files gameloop.c gameloop.h + wheeldash.c + wheeldash.h + + ../GUIslice/src/GUIslice.c + ../GUIslice/src/GUIslice.h + ../GUIslice/src/GUIslice_config.h + ../GUIslice/src/GUIslice_drv_sdl.h + ../GUIslice/src/GUIslice_drv_sdl.c ) -set(LIBXML_INCLUDE_DIR /usr/include/libxml2) -include_directories("." ${LIBXML_INCLUDE_DIR}) add_library(gameloop STATIC ${gameloop_source_files}) diff --git a/src/gilles/gameloop/wheeldash.c b/src/gilles/gameloop/wheeldash.c new file mode 100644 index 0000000..5ae58bb --- /dev/null +++ b/src/gilles/gameloop/wheeldash.c @@ -0,0 +1,287 @@ +#include + +#include "SDL/SDL.h" +#include "SDL/SDL_getenv.h" + +// Define the primary surface for display +SDL_Surface* scrMain = NULL; +// +// FILE: [FerrariF1Wheel.c] +// Created by GUIslice Builder version: [0.17.b20] +// +// GUIslice Builder Generated File +// +// For the latest guides, updates and support view: +// https://github.com/ImpulseAdventure/GUIslice +// +// +// + +// ------------------------------------------------ +// Headers to include +// ------------------------------------------------ +#include "../GUIslice/src/GUIslice.h" +#include "../GUIslice/src/GUIslice_drv.h" + +// Include any extended elements +// +// + +// ------------------------------------------------ +// Defines for resources +// ------------------------------------------------ +#define MAX_PATH 255 +// +// + +// ------------------------------------------------ +// Headers and Defines for fonts +// ------------------------------------------------ +// +#define FONT_FREE_MONOB96 "/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf" +// + +// ------------------------------------------------ +// Defines for resources +// ------------------------------------------------ +// +// + +// ------------------------------------------------ +// Enumerations for pages, elements, fonts, images +// ------------------------------------------------ +// +enum {E_PG_MAIN}; +enum {E_GEAR_TEXT}; +// Must use separate enum for fonts with MAX_FONT at end to use gslc_FontSet. +enum {E_FREEMONOBOLD96PT,MAX_FONT}; +// + +// ------------------------------------------------ +// Instantiate the GUI +// ------------------------------------------------ + +// ------------------------------------------------ +// Define the maximum number of elements and pages +// ------------------------------------------------ +// +#define MAX_PAGE 1 + +#define MAX_ELEM_PG_MAIN 1 // # Elems total on page +#define MAX_ELEM_PG_MAIN_RAM MAX_ELEM_PG_MAIN // # Elems in RAM +// + +// ------------------------------------------------ +// Create element storage +// ------------------------------------------------ +// GUI Elements +gslc_tsGui m_gui; +gslc_tsDriver m_drv; +gslc_tsFont m_asFont[MAX_FONT]; +gslc_tsPage m_asPage[MAX_PAGE]; + +// +gslc_tsElem m_asPage1Elem[MAX_ELEM_PG_MAIN_RAM]; +gslc_tsElemRef m_asPage1ElemRef[MAX_ELEM_PG_MAIN]; + + +gslc_tsElemRef* pElemRef = NULL; + +#define MAX_STR 100 + +// + +// ------------------------------------------------ +// Program Globals +// ------------------------------------------------ +bool m_bQuit = false; + +// Save some element references for direct access +// +// + + +// Configure environment variables suitable for display +// - These may need modification to match your system +// environment and display type +// - Defaults for GSLC_DEV_FB and GSLC_DEV_TOUCH are in GUIslice_config.h +// - Note that the environment variable settings can +// also be set directly within the shell via export +// (or init script). +// - eg. export TSLIB_FBDEVICE=/dev/fb1 +void UserInitEnv() +{ +#if defined(DRV_DISP_SDL1) || defined(DRV_DISP_SDL2) + setenv((char*)"FRAMEBUFFER",GSLC_DEV_FB,1); + setenv((char*)"SDL_FBDEV",GSLC_DEV_FB,1); + setenv((char*)"SDL_VIDEODRIVER",GSLC_DEV_VID_DRV,1); +#endif + +#if defined(DRV_TOUCH_TSLIB) + setenv((char*)"TSLIB_FBDEVICE",GSLC_DEV_FB,1); + setenv((char*)"TSLIB_TSDEVICE",GSLC_DEV_TOUCH,1); + setenv((char*)"TSLIB_CALIBFILE",(char*)"/etc/pointercal",1); + setenv((char*)"TSLIB_CONFFILE",(char*)"/etc/ts.conf",1); + setenv((char*)"TSLIB_PLUGINDIR",(char*)"/usr/local/lib/ts",1); +#endif +} + +// Define debug message function +static int16_t DebugOut(char ch) { fputc(ch,stderr); return 0; } + +// ------------------------------------------------ +// Callback Methods +// ------------------------------------------------ +//