diff options
author | ptitSeb | 2017-12-02 12:26:09 +0100 |
---|---|---|
committer | ptitSeb | 2017-12-02 12:26:09 +0100 |
commit | b8de876ec0175eaff41075bb5952ef9b09d4f438 (patch) | |
tree | 37715d7ba5f65a0ba5cf2524f656becd35f3ae1a /src/sdl/graphics.c | |
parent | 8b0a7091f58ee0b5ff68af9e4b14afc0ea6d6fe8 (diff) | |
download | hydracastlelabyrinth-b8de876ec0175eaff41075bb5952ef9b09d4f438.tar.gz hydracastlelabyrinth-b8de876ec0175eaff41075bb5952ef9b09d4f438.tar.bz2 hydracastlelabyrinth-b8de876ec0175eaff41075bb5952ef9b09d4f438.zip |
Added Joystick support (only 1st joystick, better use a XBox360 type)
Diffstat (limited to 'src/sdl/graphics.c')
-rwxr-xr-x | src/sdl/graphics.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sdl/graphics.c b/src/sdl/graphics.c index b25d081..937fea6 100755 --- a/src/sdl/graphics.c +++ b/src/sdl/graphics.c @@ -13,6 +13,9 @@ int screenScale = 2; static uint32_t tframe; +extern void Input_InitJoystick(); +extern void Input_CloseJoystick(); + SDL_Color PHL_NewRGB(uint8_t r, uint8_t g, uint8_t b) { SDL_Color ret = {.r = r, .b = b, .g = g}; @@ -21,13 +24,15 @@ SDL_Color PHL_NewRGB(uint8_t r, uint8_t g, uint8_t b) void PHL_GraphicsInit() { - if ( SDL_Init(SDL_INIT_VIDEO) < 0) { + if ( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0) { fprintf(stderr, "Error"); SDL_Delay(5000); exit(EXIT_FAILURE); } SDL_ShowCursor(SDL_DISABLE); + + Input_InitJoystick(); uint32_t flags = SDL_HWSURFACE|SDL_DOUBLEBUF; if(wantFullscreen) @@ -40,6 +45,7 @@ void PHL_GraphicsInit() void PHL_GraphicsExit() { + Input_CloseJoystick(); SDL_FreeSurface(backbuffer); SDL_Quit(); } |