fysxasteroids/engine/EntityBase.cc

58 lines
1.4 KiB
C++
Raw Permalink Normal View History

2010-04-05 23:38:59 +02:00
#include "EntityBase.h"
#include "coll2d.h"
namespace Engine {
bool EntityControllerState::GetKey (int state) {
assert (state < EntityControllerMaxKeyStates && state >= 0);
2010-04-05 23:38:59 +02:00
return mKeyState.test (state);
}
void EntityControllerState::SetKey (int state) {
assert (state < EntityControllerMaxKeyStates && state >= 0);
2010-04-05 23:38:59 +02:00
LogDebug ("Entity %d: Setting Entity Key State %d", mId, state);
2010-04-05 23:38:59 +02:00
mKeyState.set (state);
}
void EntityControllerState::UnsetKey (int state) {
assert (state < EntityControllerMaxKeyStates && state >= 0);
2010-04-05 23:38:59 +02:00
LogDebug ("Entity %d: Unsetting Entity Key State %d", mId, state);
2010-04-05 23:38:59 +02:00
mKeyState.reset (state);
}
void EntityControllerState::Reset () {
LogDebug ("Entity %d: Resetting all key states", mId);
mKeyState.reset ();
}
2010-04-05 23:38:59 +02:00
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);
}
void EntityBase::ResetControllerKeyState () {
if (!mControllerState) {
LogError ("Error when trying to send a KeyState to an Entity that has no EntityControllerState!");
}
LogDebug ("Entity %d: Resetting key states", mId);
mControllerState->Reset ();
}
2010-04-05 23:38:59 +02:00
}