add vgui touch panel, touch logic

This commit is contained in:
nillerusr
2021-10-09 15:22:16 +03:00
parent 81b976c384
commit 63e458ef84
12 changed files with 617 additions and 28 deletions

View File

@@ -23,11 +23,11 @@ int TouchSDLWatcher( void *userInfo, SDL_Event *event )
SDL_Window *window = SDL_GetWindowFromID(event->tfinger.windowID);
if( !window )
return 0;
int width, height;
width = height = 0;
SDL_GetWindowSize(window, &width, &height);
switch ( event->type ) {
case SDL_FINGERDOWN:
pInputSystem->FingerDown( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height );
@@ -73,7 +73,7 @@ void CInputSystem::FingerDown(int fingerId, int x, int y)
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerDown, m_nLastSampleTick, fingerId, x, y);
}
@@ -83,16 +83,16 @@ void CInputSystem::FingerUp(int fingerId, int x, int y)
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerUp, m_nLastSampleTick, fingerId, x, y);
PostEvent(IE_FingerUp, m_nLastSampleTick, fingerId, x, y);
}
void CInputSystem::FingerMotion(int fingerId, int x, int y)
{
m_touchAccumEvent = IE_FingerMotion;
m_touchAccumEvent = IE_FingerMotion;
m_touchAccumFingerId = fingerId;
m_touchAccumX = x;
m_touchAccumY = y;
PostEvent(IE_FingerMotion, m_nLastSampleTick, fingerId, x, y);
PostEvent(IE_FingerMotion, m_nLastSampleTick, fingerId, x, y);
}

View File

@@ -18,6 +18,7 @@ def build(bld):
source = [
'inputsystem.cpp',
'joystick_sdl.cpp',
'touch_sdl.cpp',
#'novint.cpp', # [$WIN32]
'key_translation.cpp',
'steamcontroller.cpp'