mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
14778 - Declare android helper before using it
This commit is contained in:
parent
2766378cf2
commit
3cee919733
1 changed files with 15 additions and 12 deletions
|
|
@ -34,6 +34,20 @@
|
|||
#define ACTION_HOVER_ENTER 9
|
||||
#define ACTION_HOVER_EXIT 10
|
||||
|
||||
/*
|
||||
* Helper function to map android pen buttons to SDL mouse buttons
|
||||
*/
|
||||
static inline Uint8 Android_PenToMouseButton(Uint8 pen_button)
|
||||
{
|
||||
switch (pen_button)
|
||||
{
|
||||
case 1: return SDL_BUTTON_RIGHT;
|
||||
case 2: return SDL_BUTTON_MIDDLE;
|
||||
case 5: return 0;
|
||||
default: return pen_button + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_type, int button, int action, float x, float y, float p)
|
||||
{
|
||||
if (!window) {
|
||||
|
|
@ -101,15 +115,4 @@ void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_t
|
|||
}
|
||||
}
|
||||
|
||||
static inline Uint8 Android_PenToMouseButton(Uint8 pen_button)
|
||||
{
|
||||
switch (pen_button)
|
||||
{
|
||||
case 1: return SDL_BUTTON_RIGHT;
|
||||
case 2: return SDL_BUTTON_MIDDLE;
|
||||
case 5: return 0;
|
||||
default: return pen_button + 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SDL_VIDEO_DRIVER_ANDROID
|
||||
#endif // SDL_VIDEO_DRIVER_ANDROID
|
||||
Loading…
Add table
Add a link
Reference in a new issue