44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
|
#include "EntityBase.h"
|
||
|
|
||
|
#include "coll2d.h"
|
||
|
|
||
|
namespace Engine {
|
||
|
|
||
|
bool EntityControllerState::GetKey (int state) {
|
||
|
assert (state < ENTITY_CONTROLLER_MAX_KEY_STATES && state >= 0);
|
||
|
|
||
|
return mKeyState.test (state);
|
||
|
}
|
||
|
|
||
|
void EntityControllerState::SetKey (int state) {
|
||
|
assert (state < ENTITY_CONTROLLER_MAX_KEY_STATES && state >= 0);
|
||
|
|
||
|
LogDebug ("Setting Entity Key State %d", state);
|
||
|
mKeyState.set (state);
|
||
|
}
|
||
|
|
||
|
void EntityControllerState::UnsetKey (int state) {
|
||
|
assert (state < ENTITY_CONTROLLER_MAX_KEY_STATES && state >= 0);
|
||
|
|
||
|
LogDebug ("Unsetting Entity Key State %d", state);
|
||
|
mKeyState.reset (state);
|
||
|
}
|
||
|
|
||
|
void EntityBase::SetControllerKeyState (int state) {
|
||
|
if (!mControllerState) {
|
||
|
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
|
||
|
}
|
||
|
|
||
|
mControllerState->SetKey (state);
|
||
|
}
|
||
|
|
||
|
void EntityBase::UnsetControllerKeyState (int state) {
|
||
|
if (!mControllerState) {
|
||
|
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
|
||
|
}
|
||
|
|
||
|
mControllerState->UnsetKey (state);
|
||
|
}
|
||
|
|
||
|
}
|