Fix ItemAction

svn-id: r12627
This commit is contained in:
Nicolas Bacca 2004-01-26 20:32:29 +00:00
parent a5aba18abf
commit 511e8ded4e
4 changed files with 16 additions and 2 deletions

View File

@ -129,7 +129,7 @@ bool CEActions::perform(ActionType action) {
case ACTION_PAUSE:
case ACTION_SAVE:
case ACTION_SKIP:
KeysBuffer::Instance()->add(&_key_action[action]);
KeysBuffer::Instance()->simulate(&_key_action[action]);
return true;
case ACTION_KEYBOARD:
_mainSystem->swap_panel();

View File

@ -37,7 +37,7 @@ namespace CEGUI {
bool ItemAction::action(int x, int y, bool pushed) {
if (checkInside(x, y) && _visible) {
if (checkInside(x, y) && _visible && pushed) {
CEActions::Instance()->perform(_action);
return true;
}

View File

@ -38,6 +38,19 @@ namespace CEKEYS {
return true;
}
bool KeysBuffer::simulate(const Key *key) {
if (_currentAdd == _capacity - 2)
return false;
_currentGet = _currentAdd;
_buffer[_currentAdd] = *key;
_buffer[_currentAdd++].setPushed(true);
_buffer[_currentAdd] = *key;
_buffer[_currentAdd++].setPushed(false);
return true;
}
KeysBuffer* KeysBuffer::Instance(int capacity) {
if (!_instance)
_instance = new KeysBuffer(capacity);

View File

@ -35,6 +35,7 @@ namespace CEKEYS {
public:
static KeysBuffer* Instance(int capacity = 5);
bool add(const Key *key);
bool simulate(const Key *key);
Key* get();
~KeysBuffer();
private: