UDN
Search public documentation:

MOBAKitTouchpad
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Unreal Development Kit Gems > MOBA Starter Kit > Touch pad

MOBA Starter Kit - Touch pad


Last tested against UDK May, 2012

Overview


This starter kit also comes with another type of interface which allows the game to be controlled via a touch pad. This is automatically used when either the platform is forced to be Mobile (done by setting the debug option in UDKMOBAMapInfo) or by running the game on an mobile device such as an iPad2. Having the game controlled presents many problems as the only real information you can deduce from touch events are related to positions or to movements of the same touch event. Thus, the touch pad interface is not merely a mapping of the keyboard and mouse to the touch pad. It was also desired not to simply solve this by using directional virtual pads. Thus, a new set of classes were created to interpret the touch pad and present a simpler interface to players. Because a simpler interface is required, the in game UI also had to change accordingly.

UDKMOBAHUD_Mobile


Functions

  • PostRender() - This event is called every frame by the engine to update the HUD. This calls UDKMOBAHUD_Mobile::ProcessTouchEvents().
  • ProcessTouchEvents() - This function iterates over the UDKMOBAPlayerController_Mobile::TouchEvents array and looks for touch events that had not yet been processed. If they haven't been processed, then UDKMOBAPlayerController_Mobile::HandlePendingRightClickCommand() is called and then flagged as processed.

UDKMOBAPlayerController_Mobile


This class handles the main touch interface by using the native delegates provided via MobilePlayerInput::OnInputTouch(). This delegate is bound when the input system has been initialized. This delegate is unbound when the player controller is destroyed. The player controller must be in the PlayerCommanding state, as the function that is bound to MobilePlayerInput::OnInputTouch() is simply a stub outside of this state.

PlayerCommanding::InternalOnInputTouch()

This function simply creates, destroys and updates the touch events stored within the player controller. The player controller is not directly responsible for handling the touch to game logic as this is done in UDKMOBAHUD_Mobile. This is because the Canvas instance is required.

PlayerAimingSpell::InternalOnInputTouch()

This function variation only keeps track of touch events as if they were button presses. The player controller is not directly responsible for handling the touch to game logic as this is done in UDKMOBAHUD_Mobile. This is because the Canvas instance is required.