project_files/Android-build/SDL-android-project/jni/SDL/src/video/android/SDL_androidtouch.c
branchhedgeroid
changeset 5550 50650032c251
parent 5540 76392a62da2f
equal deleted inserted replaced
5548:73f2fec65257 5550:50650032c251
    25 
    25 
    26 #include "SDL_events.h"
    26 #include "SDL_events.h"
    27 #include "../../events/SDL_touch_c.h"
    27 #include "../../events/SDL_touch_c.h"
    28 
    28 
    29 #include "SDL_androidtouch.h"
    29 #include "SDL_androidtouch.h"
    30 
    30 #include "stdlib.h"
    31 
    31 
    32 #define ACTION_DOWN 0
    32 #define ACTION_DOWN 0
    33 #define ACTION_UP 1
    33 #define ACTION_UP 1
    34 #define ACTION_MOVE 2
    34 #define ACTION_MOVE 2
    35 #define ACTION_CANCEL 3
    35 #define ACTION_CANCEL 3
    36 #define ACTION_OUTSIDE 4
    36 #define ACTION_OUTSIDE 4
    37 #define ACTION_POINTER_DOWN 5
    37 #define ACTION_POINTER_DOWN 5
    38 #define ACTION_POINTER_UP 6
    38 #define ACTION_POINTER_UP 6
    39 
    39 
    40 
    40 
    41 void Android_OnTouch(int action, int pointerId, float x, float y, float p)
    41 void Android_OnTouch(int action, SDL_FingerID pointerId, float x, float y, float p)
    42 {
    42 {
    43     if (!Android_Window) {
    43     if (!Android_Window) {
    44         return;
    44         return;
    45     }
    45     }
    46 
    46 
    59         touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    59         touch.native_pressureres = touch.pressure_max - touch.pressure_min;
    60 
    60 
    61         if(SDL_AddTouch(&touch, "") < 0) return;
    61         if(SDL_AddTouch(&touch, "") < 0) return;
    62     }
    62     }
    63 
    63 
    64 
       
    65     switch(action){
    64     switch(action){
    66         case ACTION_DOWN:
    65         case ACTION_DOWN:
    67         case ACTION_POINTER_DOWN:
    66         case ACTION_POINTER_DOWN:
    68             SDL_SetTouchFocus(pointerId, Android_Window);
    67             SDL_SetTouchFocus(pointerId, Android_Window);
    69             SDL_SendFingerDown(1, pointerId, SDL_TRUE, x, y, p);
    68             SDL_SendFingerDown(1, pointerId, SDL_TRUE, x, y, p);