Changeset 2618


Ignore:
Timestamp:
Mar 29, 2013, 7:03:57 PM (9 years ago)
Author:
sam
Message:

android: add a temporary hack for mouse emulation on Android devices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/platform/android/androidapp.cpp

    r2584 r2618  
    9191
    9292    android_app* m_native_app;
     93
     94    /* The resolution that was asked (not the one we got) */
     95    /* FIXME: we need proper unproject or at least screen space events!! */
     96    ivec2 m_wanted_resolution;
    9397
    9498    SavedState m_state;
     
    201205    {
    202206    case AINPUT_EVENT_TYPE_MOTION:
    203         Input::SetMousePos(ivec2(AMotionEvent_getX(event, 0),
    204                                  AMotionEvent_getY(event, 0)));
     207        /* FIXME: we flip the Y axis here, but is it the right place? */
     208        ivec2 pos(AMotionEvent_getX(event, 0),
     209                  AMotionEvent_getY(event, 0));
     210        pos = pos * m_wanted_resolution / Video::GetSize();
     211        pos.y = m_wanted_resolution.y - 1 - pos.y;
     212        Input::SetMousePos(pos);
    205213        switch (AKeyEvent_getAction(event) & AMOTION_EVENT_ACTION_MASK)
    206214        {
     
    285293  : m_data(g_data)
    286294{
    287     ;
     295    m_data->m_wanted_resolution = res;
    288296}
    289297
Note: See TracChangeset for help on using the changeset viewer.