Skip to content

Commit

Permalink
Disable controls using gyroscope
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeeynamo committed Jan 18, 2021
1 parent a145242 commit 9b4daf3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Sonic12Decomp/RetroEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ bool processEvents()
case SDL_APP_WILLENTERBACKGROUND: /*Engine.Callback(CALLBACK_ENTERBG);*/ break;
case SDL_APP_WILLENTERFOREGROUND: /*Engine.Callback(CALLBACK_ENTERFG);*/ break;
case SDL_APP_TERMINATING: break;

#ifdef RETRO_USING_MOUSE
case SDL_MOUSEMOTION:
if (SDL_GetNumTouchFingers(SDL_GetTouchDevice(1)) <= 0) { // Touch always takes priority over mouse
SDL_GetMouseState(&touchX[0], &touchY[0]);
Expand All @@ -73,6 +75,9 @@ bool processEvents()
touches = 1;
}
break;
#endif

#ifdef RETRO_USING_TOUCH
case SDL_FINGERMOTION:
touches = SDL_GetNumTouchFingers(SDL_GetTouchDevice(1));
for (int i = 0; i < touches; i++) {
Expand All @@ -94,6 +99,8 @@ bool processEvents()
}
break;
case SDL_FINGERUP: touches = SDL_GetNumTouchFingers(SDL_GetTouchDevice(1)); break;
#endif

case SDL_KEYDOWN:
switch (Engine.sdlEvents.key.keysym.sym) {
default: break;
Expand Down
10 changes: 7 additions & 3 deletions Sonic12Decomp/RetroEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef unsigned int uint;
#endif
#elif defined __vita__
#define RETRO_PLATFORM (RETRO_VITA)
#define RETRO_PLATTYPE (RETRO_STANDARD)
#else
#define RETRO_PLATFORM (RETRO_WIN)
#define RETRO_PLATTYPE (RETRO_STANDARD)
Expand All @@ -73,12 +74,15 @@ typedef unsigned int uint;

#else
#define BASE_PATH ""
#define DEFAULT_SCREEN_XSIZE 424
#define DEFAULT_SCREEN_XSIZE 424
#define DEFAULT_FULLSCREEN false
#define SCREEN_YSIZE (240)
#define RETRO_USING_MOUSE
#define RETRO_USING_TOUCH

#endif

#if RETRO_PLATFORM == RETRO_WINDOWS || RETRO_PLATFORM == RETRO_OSX
#if RETRO_PLATFORM == RETRO_WINDOWS || RETRO_PLATFORM == RETRO_OSX || RETRO_PLATFORM == RETRO_VITA
#define RETRO_USING_SDL (1)
#else //Since its an else & not an elif these platforms probably aren't supported yet
#define RETRO_USING_SDL (0)
Expand Down Expand Up @@ -148,7 +152,7 @@ enum RetroGameType {

#elif RETRO_USING_SDL
#include <SDL2/SDL.h>
#include <Vorbis/vorbisfile.h>
#include <vorbis/vorbisfile.h>

#else

Expand Down

0 comments on commit 9b4daf3

Please sign in to comment.