Edit

kc3-lang/SDL/src/video/android/SDL_androidtouch.h

Branch :

  • Show log

    Commit

  • Author : Philipp Wiesemann
    Date : 2013-10-05 17:08:19
    Hash : 0db36f51
    Message : Added detection of touch devices before first touch events happen on Android. On Android available touch devices are now added with video initialization (like the keyboard). This fixes SDL_GetNumTouchDevices() returning 0 before any touch events happened although there is a touch screen available. The adding of touch devices after a touch event was received is still active to allow connecting devices later (if this is possible) and to provide a fallback if the new init did not work somehow. For the implementation JNI was used and API level 9 is required. There seems to be nothing in the Android NDK's input header (input.h) to implement everything on C side without communication with Java side.

  • src/video/android/SDL_androidtouch.h
  • /*
      Simple DirectMedia Layer
      Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    
      This software is provided 'as-is', without any express or implied
      warranty.  In no event will the authors be held liable for any damages
      arising from the use of this software.
    
      Permission is granted to anyone to use this software for any purpose,
      including commercial applications, and to alter it and redistribute it
      freely, subject to the following restrictions:
    
      1. The origin of this software must not be misrepresented; you must not
         claim that you wrote the original software. If you use this software
         in a product, an acknowledgment in the product documentation would be
         appreciated but is not required.
      2. Altered source versions must be plainly marked as such, and must not be
         misrepresented as being the original software.
      3. This notice may not be removed or altered from any source distribution.
    */
    #include "SDL_config.h"
    
    #include "SDL_androidvideo.h"
    
    extern void Android_InitTouch(void);
    extern void Android_OnTouch( int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p);
    
    /* vi: set ts=4 sw=4 expandtab: */