LAB: Some renaming in EventMan

This commit is contained in:
Strangerke 2015-12-13 20:15:24 +01:00 committed by Willem Jan Palenstijn
parent 99e09b2ca2
commit 2b91bf2f34
4 changed files with 32 additions and 32 deletions

View File

@ -147,7 +147,7 @@ void LabEngine::perFlipButton(uint16 buttonId) {
if (!_alternate) {
_event->mouseHide();
topButton->_image->drawImage(topButton->x, topButton->y);
topButton->_image->drawImage(topButton->_x, topButton->_y);
_event->mouseShow();
}

View File

@ -66,21 +66,21 @@ static const byte mouseData[] = {
Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) {
for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) {
Button *button = *buttonItr;
Common::Rect buttonRect(button->x, button->y, button->x + button->_image->_width - 1, button->y + button->_image->_height - 1);
Common::Rect buttonRect(button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1);
if (buttonRect.contains(pos) && button->isEnabled) {
if (buttonRect.contains(pos) && button->_isEnabled) {
if (_vm->_isHiRes) {
_hitButton = button;
} else {
mouseHide();
button->_altImage->drawImage(button->x, button->y);
button->_altImage->drawImage(button->_x, button->_y);
mouseShow();
for (uint16 i = 0; i < 3; i++)
_vm->waitTOF();
mouseHide();
button->_image->drawImage(button->x, button->y);
button->_image->drawImage(button->_x, button->_y);
mouseShow();
}
@ -152,14 +152,14 @@ void EventManager::updateMouse() {
if (_hitButton) {
mouseHide();
_hitButton->_altImage->drawImage(_hitButton->x, _hitButton->y);
_hitButton->_altImage->drawImage(_hitButton->_x, _hitButton->_y);
mouseShow();
for (uint16 i = 0; i < 3; i++)
_vm->waitTOF();
mouseHide();
_hitButton->_image->drawImage(_hitButton->x, _hitButton->y);
_hitButton->_image->drawImage(_hitButton->_x, _hitButton->_y);
mouseShow();
doUpdateDisplay = true;
_hitButton = nullptr;
@ -231,8 +231,8 @@ void EventManager::setMousePos(Common::Point pos) {
* co-ordinates of the button press. leftbutton tells whether to check the
* left or right button.
*/
bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftbutton) {
if (leftbutton) {
bool EventManager::mouseButton(uint16 *x, uint16 *y, bool leftButton) {
if (leftButton) {
if (_leftClick) {
*x = (!_vm->_isHiRes) ? (uint16)_mousePos.x / 2 : (uint16)_mousePos.x;
*y = (uint16)_mousePos.y;
@ -275,7 +275,7 @@ bool EventManager::haveNextChar() {
return _nextKeyIn != _nextKeyOut;
}
void EventManager::processInput(bool can_delay) {
void EventManager::processInput(bool canDelay) {
Common::Event event;
if (1) { //!g_IgnoreProcessInput
@ -358,21 +358,21 @@ void EventManager::processInput(bool can_delay) {
}
}
if (can_delay)
if (canDelay)
g_system->delayMillis(10);
}
uint16 EventManager::getNextChar() {
uint16 c = 0;
uint16 chr = 0;
processInput();
if (_nextKeyIn != _nextKeyOut) {
c = _keyBuf[_nextKeyOut];
chr = _keyBuf[_nextKeyOut];
_nextKeyOut = ((((unsigned int)((_nextKeyOut + 1) >> 31) >> 26) + (byte)_nextKeyOut + 1) & 0x3F)
- ((unsigned int)((_nextKeyOut + 1) >> 31) >> 26);
}
return c;
return chr;
}
Common::Point EventManager::updateAndGetMousePos() {

View File

@ -61,9 +61,9 @@ struct IntuiMessage {
struct Button {
uint16 x, y, _buttonID;
uint16 _x, _y, _buttonID;
uint16 _keyEquiv; // if not zero, a key that activates button
bool isEnabled;
bool _isEnabled;
Image *_image, *_altImage;
};
@ -103,10 +103,10 @@ public:
EventManager (LabEngine *vm);
void attachButtonList(ButtonList *buttonList);
Button *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image *imalt);
void disableButton(Button *curgad, uint16 pencolor);
Button *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *image, Image *altImage);
void disableButton(Button *button, uint16 penColor);
void drawButtonList(ButtonList *buttonList);
void enableButton(Button *curgad);
void enableButton(Button *button);
void freeButtonList(ButtonList *buttonList);
Button *getButton(uint16 id);
Common::Point getMousePos();
@ -114,7 +114,7 @@ public:
void initMouse();
void mouseShow();
void mouseHide();
void processInput(bool can_delay = false);
void processInput(bool canDelay = false);
void setMousePos(Common::Point pos);
void updateMouse();
Common::Point updateAndGetMousePos();

View File

@ -43,13 +43,13 @@ Button *EventManager::createButton(uint16 x, uint16 y, uint16 id, uint16 key, Im
Button *button = new Button();
if (button) {
button->x = _vm->_utils->vgaScaleX(x);
button->y = y;
button->_x = _vm->_utils->vgaScaleX(x);
button->_y = y;
button->_buttonID = id;
button->_keyEquiv = key;
button->_image = image;
button->_altImage = altImage;
button->isEnabled = true;
button->_isEnabled = true;
return button;
} else
@ -72,9 +72,9 @@ void EventManager::freeButtonList(ButtonList *buttonList) {
*/
void EventManager::drawButtonList(ButtonList *buttonList) {
for (ButtonList::iterator button = buttonList->begin(); button != buttonList->end(); ++button) {
(*button)->_image->drawImage((*button)->x, (*button)->y);
(*button)->_image->drawImage((*button)->_x, (*button)->_y);
if (!(*button)->isEnabled)
if (!(*button)->_isEnabled)
disableButton((*button), 1);
}
}
@ -83,16 +83,16 @@ void EventManager::drawButtonList(ButtonList *buttonList) {
* Dims a button, and makes it unavailable for using.
*/
void EventManager::disableButton(Button *button, uint16 penColor) {
_vm->_graphics->overlayRect(penColor, button->x, button->y, button->x + button->_image->_width - 1, button->y + button->_image->_height - 1);
button->isEnabled = false;
_vm->_graphics->overlayRect(penColor, button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1);
button->_isEnabled = false;
}
/**
* Undims a button, and makes it available again.
*/
void EventManager::enableButton(Button *button) {
button->_image->drawImage(button->x, button->y);
button->isEnabled = true;
button->_image->drawImage(button->_x, button->_y);
button->_isEnabled = true;
}
/**
@ -119,13 +119,13 @@ Button *EventManager::checkNumButtonHit(ButtonList *buttonList, uint16 key) {
Button *button = *buttonItr;
if ((gkey - 1 == button->_buttonID || (gkey == 0 && button->_buttonID == 9) ||
(button->_keyEquiv != 0 && makeButtonKeyEquiv(key) == button->_keyEquiv))
&& button->isEnabled) {
&& button->_isEnabled) {
mouseHide();
button->_altImage->drawImage(button->x, button->y);
button->_altImage->drawImage(button->_x, button->_y);
mouseShow();
g_system->delayMillis(80);
mouseHide();
button->_image->drawImage(button->x, button->y);
button->_image->drawImage(button->_x, button->_y);
mouseShow();
return button;