Gamedev Framework (gf)  0.6.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::Control Class Referenceabstract

A physical control. More...

#include <gf/Control.h>

Inheritance diagram for gf::Control:
Inheritance graph
[legend]

Public Member Functions

 Control ()
 Construct a control. More...
 
virtual ~Control ()
 Destroy the control. More...
 
bool isActive ()
 Check if the control is active. More...
 
void setActive (bool active=true)
 Change the active state of the control. More...
 
void reset ()
 Desactivate the control. More...
 
virtual void processEvent (const Event &event)=0
 Update the state of the control thanks to an event. More...
 

Detailed Description

A physical control.

Constructor & Destructor Documentation

◆ Control()

gf::Control::Control ( )
inline

Construct a control.

◆ ~Control()

virtual gf::Control::~Control ( )
virtual

Destroy the control.

Member Function Documentation

◆ isActive()

bool gf::Control::isActive ( )
inline

Check if the control is active.

Returns
true if the control is active.
See also
Action::isActive()

◆ processEvent()

virtual void gf::Control::processEvent ( const Event event)
pure virtual

Update the state of the control thanks to an event.

Parameters
eventThe event to update the control.
See also
Action::processEvent()

Implemented in gf::CloseControl, gf::GamepadAxisControl, gf::GamepadButtonControl, gf::MouseButtonControl, gf::ScancodeKeyControl, and gf::KeycodeKeyControl.

◆ reset()

void gf::Control::reset ( )
inline

Desactivate the control.

This call is equivalent to:

this.setActive(false);
See also
Action::reset()

◆ setActive()

void gf::Control::setActive ( bool  active = true)
inline

Change the active state of the control.

Parameters
activeThe new state of the control.