|
GlistEngine
|
#include <gCameraController.h>


Public Member Functions | |
| gCameraController () | |
| gCameraController (gCamera *camera) | |
| ~gCameraController () | |
| void | setCamera (gCamera *camera) |
| gCamera * | getCamera () const |
| void | update () |
| void | setEnabled (bool enabled) |
| bool | isEnabled () const |
| void | setPlayerIndex (int playerIndex) |
| int | getPlayerIndex () const |
| void | registerInputs () |
| void | setMoveSpeed (float speed) |
| float | getMoveSpeed () const |
| void | setMouseSensitivity (float sensitivity) |
| float | getMouseSensitivity () const |
| void | setGamepadLookSensitivity (float sensitivity) |
| float | getGamepadLookSensitivity () const |
Public Member Functions inherited from gRenderObject | |
| gRenderObject () | |
| int | getScreenWidth () |
| int | getScreenHeight () |
| void | pushMatrix () |
| void | popMatrix () |
Public Member Functions inherited from gObject | |
| gObject () | |
| void | logi (std::string message) |
| void | logd (std::string message) |
| void | logw (std::string message) |
| void | loge (std::string message) |
| void | logi (std::string tag, std::string message) |
| void | logd (std::string tag, std::string message) |
| void | logw (std::string tag, std::string message) |
| void | loge (std::string tag, std::string message) |
Static Public Attributes | |
| static const std::string | AXIS_HORIZONTAL |
| Strafe. Default: A(-)/D(+), Left Stick X. | |
| static const std::string | AXIS_VERTICAL |
| Forward/back. Default: S(-)/W(+), Left Stick Y. | |
| static const std::string | AXIS_ELEVATION |
| Up/down. Default: LShift(-)/Space(+), LB(-)/RB(+) | |
| static const std::string | AXIS_LOOK_HORIZONTAL |
| Gamepad look horizontal. Default: Right Stick X. | |
| static const std::string | AXIS_LOOK_VERTICAL |
| Gamepad look vertical. Default: Right Stick Y. | |
| static const std::string | ACTION_TOGGLE |
| Toggle on/off. Default: ESC, Start. | |
Static Public Attributes inherited from gObject | |
| static const int | LOGLEVEL_SILENT |
| static const int | LOGLEVEL_DEBUG |
| static const int | LOGLEVEL_INFO |
| static const int | LOGLEVEL_WARNING |
| static const int | LOGLEVEL_ERROR |
Additional Inherited Members | |
Static Public Member Functions inherited from gRenderObject | |
| static void | setScreenSize (int screenWidth, int screenHeight) |
| static void | setUnitScreenSize (int unitWidth, int unitHeight) |
| static void | setScreenScaling (int screenScaling) |
| static void | enableShadowMapping () |
| static void | disableShadowMapping () |
| static bool | isShadowMappingEnabled () |
| static gRenderer * | getRenderer () |
| static void | destroyRenderer () |
| static void | createRenderer () |
Static Public Member Functions inherited from gObject | |
| static std::string | gGetAppDir () |
| static std::string | gGetAssetsDir () |
| static void | gSetAssetsDir (std::string assetsDir) |
| static std::string | gGetFilesDir () |
| static std::string | gGetImagesDir () |
| static std::string | gGetFontsDir () |
| static std::string | gGetModelsDir () |
| static std::string | gGetTexturesDir () |
| static std::string | gGetShadersDir () |
| static std::string | gGetSoundsDir () |
| static std::string | gGetDatabasesDir () |
| static std::string | gGetVideosDir () |
| static void | setCurrentResolution (int scalingNo, int currentResolutionNo) |
Static Protected Attributes inherited from gRenderObject | |
| static bool | isshadowmappingenabled |
Static Protected Attributes inherited from gObject | |
| static int | renderpassnum |
| static int | renderpassno |
| static int | releasescaling |
| static int | releaseresolution |
First-person camera controller with configurable input bindings.
Uses gInputManager player-based axes for movement, mouse look, and gamepad right-stick look. All bindings can be rebound at runtime.
Default keyboard bindings (player 0): AXIS_HORIZONTAL : A(-) / D(+) AXIS_VERTICAL : S(-) / W(+) AXIS_ELEVATION : LShift(-) / Space(+) ACTION_TOGGLE : ESC
Default gamepad bindings (when gamepad assigned): AXIS_HORIZONTAL : Left Stick X AXIS_VERTICAL : Left Stick Y (inverted) AXIS_ELEVATION : LB(-) / RB(+) AXIS_LOOK_HORIZONTAL : Right Stick X AXIS_LOOK_VERTICAL : Right Stick Y (inverted) ACTION_TOGGLE : Start
Example - basic usage:
Example - local co-op with gamepad:
Example - rebinding axes:
| gCameraController::gCameraController | ( | ) |
| gCameraController::gCameraController | ( | gCamera * | camera | ) |
| gCameraController::~gCameraController | ( | ) |
| gCamera * gCameraController::getCamera | ( | ) | const |
| float gCameraController::getGamepadLookSensitivity | ( | ) | const |
| float gCameraController::getMouseSensitivity | ( | ) | const |
| float gCameraController::getMoveSpeed | ( | ) | const |
| int gCameraController::getPlayerIndex | ( | ) | const |
| bool gCameraController::isEnabled | ( | ) | const |
| void gCameraController::registerInputs | ( | ) |
Registers default keyboard and gamepad bindings on the current player. Called automatically in the constructor. Call manually after changing the player index if you want the defaults re-registered.
| void gCameraController::setCamera | ( | gCamera * | camera | ) |
| void gCameraController::setEnabled | ( | bool | enabled | ) |
Enables or disables the controller. When enabled and the player has KB+M assigned, the cursor switches to relative mode for mouse look.
| void gCameraController::setGamepadLookSensitivity | ( | float | sensitivity | ) |
Gamepad right-stick look speed in radians per second at full deflection. Default: 3.0
| void gCameraController::setMouseSensitivity | ( | float | sensitivity | ) |
Mouse look sensitivity multiplier. Default: 2.0
| void gCameraController::setMoveSpeed | ( | float | speed | ) |
Movement speed in units per second. Default: 2.0
| void gCameraController::setPlayerIndex | ( | int | playerIndex | ) |
Which player index this controller reads input from. Default: 0. Set before calling update() for the first time, or call registerInputs() after changing to re-register default bindings on the new player.
| void gCameraController::update | ( | ) |
Updates camera position and orientation based on current input state. Call this once per frame from your canvas update().
|
static |
Toggle on/off. Default: ESC, Start.
|
static |
Up/down. Default: LShift(-)/Space(+), LB(-)/RB(+)
|
static |
Strafe. Default: A(-)/D(+), Left Stick X.
|
static |
Gamepad look horizontal. Default: Right Stick X.
|
static |
Gamepad look vertical. Default: Right Stick Y.
|
static |
Forward/back. Default: S(-)/W(+), Left Stick Y.