Our final class that we need to implement for this chapter is PlayerController
. PlayerController
is responsible for handling all of the input events and providing mechanisms to process these events in the queue. This class can be found at core/src/com/packtpub/libgdx/bludbourne/PlayerController.java
.
A class diagram of this class is shown in the following screenshot (Figure 14):
The source for PlayerController
is listed here:
package com.packtpub.libgdx.bludbourne; import java.util.HashMap; import java.util.Map; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.InputProcessor; import com.badlogic.gdx.math.Vector3;
InputProcessor
is an interface that you should implement in order to process input events such as mouse cursor location changes, mouse button presses, and keyboard key presses from the input event handler. Your game will usually instantiate this class and set it in...