Angel 3.2
A 2D Game Prototyping Engine
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
ControllerManager Class Reference

(Internal) Manages multiple controllers (currently up to 2) More...

#include <Controller.h>

Public Member Functions

ControllerGetController (int controllerIndex=0)
void Setup ()
void UpdateState ()
 ~ControllerManager ()

Static Public Member Functions

static ControllerManagerGetInstance ()

Static Protected Attributes

static ControllerManagers_ControllerManager = NULL

Detailed Description

This internal class represents the coordinator for gamepad controllers. You should only have to deal with it if you're using it with multiple controllers, and even then, it's best to access them with the "controllerOne" and "controllerTwo" shortcuts.

Like the World, it uses the singleton pattern; you can't actually declare a new instance of a ControllerManager. To access controllers in your world, use "theControllerManager" to retrieve the singleton object. "theControllerManager" is defined in both C++ and Lua.

If you're not familiar with the singleton pattern, this paper is a good starting point. (Don't be afraid that it's written by Microsoft.)

Definition at line 91 of file Controller.h.

Constructor & Destructor Documentation

ControllerManager::~ControllerManager ( )

The destructor releases all the controller input handles.

Definition at line 106 of file Controller.cpp.

Member Function Documentation

ControllerManager & ControllerManager::GetInstance ( )

Used to access the singleton instance of this class. As a shortcut, you can just use "theControllerManager".

The singleton

Definition at line 88 of file Controller.cpp.

Controller& ControllerManager::GetController ( int  controllerIndex = 0)

Get a reference to one of the controllers.

controllerIndexThe index of the controller you want to retrieve. Since we only support 2 controllers, this needs to be either 0 or 1.
A Controller object

Definition at line 110 of file Controller.h.

void ControllerManager::Setup ( )

Attempt to initialize both controllers.

Definition at line 114 of file Controller.cpp.

void ControllerManager::UpdateState ( )

Called once per frame, reads all input data from the controller for polling by the rest of the game.

Definition at line 120 of file Controller.cpp.

The documentation for this class was generated from the following files: