void CInput::renderOverlay() { #ifdef USE_OPENGL // only ogl supported yet (and probably worth) #if defined(MOUSEWRAPPER) static bool showControls = true; static bool buttonShowHideCtrlWasDown = false; TouchButton* phoneButtons = getPhoneButtons(InputCommand); for(int i = phoneButtonN - 1; i >= 0; --i) { TouchButton& b = phoneButtons[i]; bool down = phoneButton_MouseIndex[i].size() > 0; if(i==0) { if (phoneButton_MouseIndex[1].size() > 0 || phoneButton_MouseIndex[7].size() > 0) down = true; } if(i==2 || i==4 || i == 6) { if (phoneButton_MouseIndex[i-1].size() > 0 || phoneButton_MouseIndex[i+1].size() > 0) down = true; } if((showControls && !b.invisible) || b.immediateIndex == KSHOWHIDECTRLS) drawButton(b, down); if(b.immediateIndex == KSHOWHIDECTRLS) { if(buttonShowHideCtrlWasDown && !down) showControls = !showControls; buttonShowHideCtrlWasDown = down; } } #endif #endif }
void CInput::processMouse(int x, int y, bool down, int mouseindex) { TouchButton* phoneButtons = getPhoneButtons(InputCommand); for(int i = 0; i < phoneButtonN; ++i) { TouchButton& b = phoneButtons[i]; if(b.isInside(x, y)) { phoneButtonLasttime[i] = down ? SDL_GetTicks() : 0; if(down) phoneButton_MouseIndex[i].insert(mouseindex); else phoneButton_MouseIndex[i].erase(mouseindex); break; } } }
void CInput::processMouse() { TouchButton* phoneButtons = getPhoneButtons(InputCommand); for(int i = 0; i < phoneButtonN; ++i) { bool down = phoneButton_MouseIndex[i].size() > 0; TouchButton& b = phoneButtons[i]; if(b.cmd) b.cmd->active = down; // handle immediate keys if(b.immediateIndex >= 0) immediate_keytable[b.immediateIndex] = down; } }