นิ้วคุณคือเมาส์. แต่ RTS ต้องการ "selection box หรือ camera pan" — เราสอน gesture ให้รู้จัก: tap-select, drag-box, long-press = right-click, 2-finger pan, pinch zoom.
= LEFT-CLICK
select unit / place waypoint
= BOX-SELECT
rubber-band selection rect
= RIGHT-CLICK
deselect / context menu
= CAMERA PAN
scroll the map
= ZOOM
camera zoom in / out
= CANCEL HOVER
second touch kills gesture
Engine เก่าของ C&C ถูกออกแบบมาให้เมาส์ทำงานเป็นหลัก — ทุก UI hit-test, ทุก game state ผูกกับ mouse event. แทนที่จะ rewrite UI layer (เดือนนับ), เราส่ง touch event ผ่าน SDL3 เป็น synthetic mouse event โดยตรง:
SDL3 มี fake mouse API — เรา map touch state เป็น mouse down/move/up ตาม gesture type.
// pseudocode — real code lives in Core/GameEngine/Source/GameClient/Input/Mouse.cpp if (touchType == TOUCH_DOWN) SDL_SendFakeMouseMotion(0, x, y); if (touchType == TOUCH_UP) SDL_SendFakeMouseButton(0, SDL_BUTTON_LEFT, SDL_RELEASED); if (gesture == LONG_PRESS) SDL_SendFakeMouseButton(0, SDL_BUTTON_RIGHT, SDL_PRESSED);
The hard part: a drag could be a selection-box OR a camera pan. We disambiguate by: