Skip to content

Commit

Permalink
Android: Added mouse initialization to reset state.
Browse files Browse the repository at this point in the history
If the app is launched again then the shared object may be reused (on Android).
  • Loading branch information
philippwiesemann committed Jan 12, 2016
1 parent 46cb851 commit 8d035b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/video/android/SDL_androidmouse.c
Expand Up @@ -40,9 +40,15 @@
#define BUTTON_BACK 8
#define BUTTON_FORWARD 16

void Android_OnMouse( int androidButton, int action, float x, float y) {
static Uint8 SDLButton;
static Uint8 SDLButton;

void
Android_InitMouse(void)
{
SDLButton = 0;
}

void Android_OnMouse( int androidButton, int action, float x, float y) {
if (!Android_Window) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/video/android/SDL_androidmouse.h
Expand Up @@ -24,6 +24,7 @@

#include "SDL_androidvideo.h"

extern void Android_InitMouse(void);
extern void Android_OnMouse( int button, int action, float x, float y);

#endif /* _SDL_androidmouse_h */
Expand Down
3 changes: 3 additions & 0 deletions src/video/android/SDL_androidvideo.c
Expand Up @@ -36,6 +36,7 @@
#include "SDL_androidclipboard.h"
#include "SDL_androidevents.h"
#include "SDL_androidkeyboard.h"
#include "SDL_androidmouse.h"
#include "SDL_androidtouch.h"
#include "SDL_androidwindow.h"

Expand Down Expand Up @@ -181,6 +182,8 @@ Android_VideoInit(_THIS)

Android_InitTouch();

Android_InitMouse();

/* We're done! */
return 0;
}
Expand Down

0 comments on commit 8d035b1

Please sign in to comment.