diff --git a/griffin/griffin.c b/griffin/griffin.c index 31be462e05..376e7ffe10 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -242,7 +242,7 @@ INPUT #include "../android/native/jni/input_autodetect.c" #include "../android/native/jni/input_android.c" #elif defined(__BLACKBERRY_QNX__) -#include "../playbook/src/qnx_input.c" +#include "../playbook/qnx_input.c" #endif #if defined(HAVE_NULLINPUT) diff --git a/playbook/qnx_input.c b/playbook/qnx_input.c new file mode 100644 index 0000000000..9da26ae27d --- /dev/null +++ b/playbook/qnx_input.c @@ -0,0 +1,276 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "../general.h" +#include "../driver.h" +#include + +#define MAX_TOUCH 16 + +struct touches +{ + int16_t x, y; + int16_t full_x, full_y; + int contact_id; +}; + +static struct touches touch[MAX_TOUCH]; +static unsigned touch_count; + +//Internal helper functions +static void process_touch_event(screen_event_t event, int type) +{ + int contact_id; + int pos[2]; + int i; + + screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, (int*)&contact_id); + screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, pos); + + switch(type) + { + case SCREEN_EVENT_MTOUCH_TOUCH: + touch[touch_count].contact_id = contact_id; + input_translate_coord_viewport(pos[0], pos[1], + &touch[touch_count].x, &touch[touch_count].y, + &touch[touch_count].full_x, &touch[touch_count].full_y); + touch_count++; + //printf("New Touch: x:%d, y:%d, id:%d\n", pos[0], pos[1], contact_id);fflush(stdout); + break; + case SCREEN_EVENT_MTOUCH_RELEASE: + //Invalidate the finger + touch_count--; + touch[touch_count].contact_id = -1; + input_translate_coord_viewport(pos[0], pos[1], + &touch[touch_count].x, &touch[touch_count].y, + &touch[touch_count].full_x, &touch[touch_count].full_y); + //printf("Release: x:%d, y:%d, id:%d\n", pos[0], pos[1], contact_id);fflush(stdout); + break; + case SCREEN_EVENT_MTOUCH_MOVE: + //Find the finger we're tracking and update + for(i=0; i. - */ - -#include "../../general.h" -#include "../../driver.h" -#include - -#define MAX_TOUCH 16 - -struct touches -{ - int16_t x, y; - int16_t full_x, full_y; - int contact_id; -}; - -static struct touches touch[MAX_TOUCH]; -static unsigned touch_count; - -//Internal helper functions -static void process_touch_event(screen_event_t event, int type){ - int contact_id; - int pos[2]; - int i; - - screen_get_event_property_iv(event, SCREEN_PROPERTY_TOUCH_ID, (int*)&contact_id); - screen_get_event_property_iv(event, SCREEN_PROPERTY_SOURCE_POSITION, pos); - - switch(type){ - case SCREEN_EVENT_MTOUCH_TOUCH: - touch[touch_count].contact_id = contact_id; - input_translate_coord_viewport(pos[0], pos[1], - &touch[touch_count].x, &touch[touch_count].y, - &touch[touch_count].full_x, &touch[touch_count].full_y); - touch_count++; - //printf("New Touch: x:%d, y:%d, id:%d\n", pos[0], pos[1], contact_id);fflush(stdout); - break; - case SCREEN_EVENT_MTOUCH_RELEASE: - //Invalidate the finger - touch_count--; - touch[touch_count].contact_id = -1; - input_translate_coord_viewport(pos[0], pos[1], - &touch[touch_count].x, &touch[touch_count].y, - &touch[touch_count].full_x, &touch[touch_count].full_y); - //printf("Release: x:%d, y:%d, id:%d\n", pos[0], pos[1], contact_id);fflush(stdout); - break; - case SCREEN_EVENT_MTOUCH_MOVE: - //Find the finger we're tracking and update - for(i=0; i