From c6a5c6444886cd533f8f7d67a2979be570fd36da Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 19 Oct 2025 05:35:28 +0300 Subject: [PATCH] engine: client: touch: implement rotation support --- engine/client/in_touch.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engine/client/in_touch.c b/engine/client/in_touch.c index 79b253a7..1dd584c4 100644 --- a/engine/client/in_touch.c +++ b/engine/client/in_touch.c @@ -2071,6 +2071,25 @@ static int Touch_ControlsEvent( touchEventType type, int fingerID, float x, floa int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy ) { + if( ref.rotation & 1 ) + { + // swap x and y and invert y + float temp = x; + x = y; + if( ref.rotation == REF_ROTATE_CW ) + y = 1.0f - temp; + else + y = temp; + + temp = dx; + dx = dy; + if( ref.rotation == REF_ROTATE_CW ) + dy = -temp; + else + dy = temp; + } + + // Con_Printf("%f %f\n", TO_SCRN_X(x), TO_SCRN_Y(y)); // simulate menu mouse click if( cls.key_dest != key_game && !touch_in_menu.value )