Slippers Engine
 
Loading...
Searching...
No Matches
Inputable Class Reference

Responsible for Input functions. More...

#include <Inputable.h>

Collaboration diagram for Inputable:
Collaboration graph

Protected Member Functions

void SubmitRegistration (AZUL_KEY k, EVENT_TYPE e)
 Called when wanting to check for a specific key.
 
void SubmitDeregistration (AZUL_KEY k, EVENT_TYPE e)
 Called when wanting to stop checking for a specific key.
 

Private Member Functions

virtual void KeyPress (AZUL_KEY k)
 Fill this with code that occurs on a key press.
 
virtual void KeyRelease (AZUL_KEY k)
 Fill this with code that occurs on a key release.
 

Detailed Description

Responsible for Input functions.

Member Function Documentation

◆ KeyPress()

virtual void Inputable::KeyPress ( AZUL_KEY k)
privatevirtual

Fill this with code that occurs on a key press.

This function will only be called when a registered key is pressed. k represents which key has been pressed.

Example:

void DemoObj::KeyPress(AZUL_KEY k) {
switch (k) {
case AZUL_KEY::KEY_SPACE:
//Fire Bullet
break;
case AZUL_KEY::KEY_C:
//Shrink object by half of its current size
MathTools::ChangeScale(demoGraphicsObjOne->getWorld(), 0.5f);
break;
}
}
static void ChangeScale(Matrix &world, float scaleFactor)
Uniformly scales object, based on the objects current size * ScaleFactor.
Definition MathTools.cpp:128
Parameters
k

◆ KeyRelease()

virtual void Inputable::KeyRelease ( AZUL_KEY k)
privatevirtual

Fill this with code that occurs on a key release.

This function will only be called when a registered key is released. k represents which key has been released.

Example:

void DemoObj::KeyRelease(AZUL_KEY k) {
switch (k) {
case AZUL_KEY::KEY_N:
//Next Scene
SceneManager::SetNextScene(new SceneDemoTwo());
break;
case AZUL_KEY::KEY_C:
//Grow object by twice its current size
MathTools::ChangeScale(demoGraphicsObjOne->getWorld(), 2.0f);
break;
}
}
static void SetNextScene(Scene *next)
Changes to new Scene.
Definition SceneManager.h:77
Parameters
k

◆ SubmitDeregistration()

void Inputable::SubmitDeregistration ( AZUL_KEY k,
EVENT_TYPE e )
protected

Called when wanting to stop checking for a specific key.

Event types can be either EVENT_TYPE::KEY_PRESS or EVENT_TYPE::KEY_RELEASE.

Example:

@ KEY_RELEASE
Definition KeyStateCommon.h:7
@ KEY_PRESS
Definition KeyStateCommon.h:6
void SubmitDeregistration(AZUL_KEY k, EVENT_TYPE e)
Called when wanting to stop checking for a specific key.
Definition Inputable.cpp:86

◆ SubmitRegistration()

void Inputable::SubmitRegistration ( AZUL_KEY k,
EVENT_TYPE e )
protected

Called when wanting to check for a specific key.

Keys can be registered for checking both press and release. Event types can be either EVENT_TYPE::KEY_PRESS or EVENT_TYPE::KEY_RELEASE.

Example:

void SubmitRegistration(AZUL_KEY k, EVENT_TYPE e)
Called when wanting to check for a specific key.
Definition Inputable.cpp:49