feat: gui hotkey released

This commit is contained in:
pavanvo 2022-09-04 13:09:32 +04:00
parent d2d691024e
commit 35f755841d
No known key found for this signature in database
GPG Key ID: 34C1C36681B4AD84
3 changed files with 16 additions and 2 deletions

View File

@ -5005,7 +5005,10 @@ void Game::keyUp(SDL_KeyboardEvent key) {
gameCamera.setMoveX(0);
camRightButtonDown= false;
calcCameraMoveX();
} else {
gui.hotKeyReleased(key);
}
}
}
catch(const exception &ex) {

View File

@ -447,6 +447,16 @@ void Gui::hotKey(SDL_KeyboardEvent key) {
else if(isKeyPressed(configKeys.getSDLKey("HotKeySelectedUnitsStop"),key) == true) {
clickCommonCommand(ccStop);
}
if(isKeyDown(queueCommandKey)) {
computeDisplay();
}
}
void Gui::hotKeyReleased(SDL_KeyboardEvent key) {
if(!isKeyDown(queueCommandKey)) {
computeDisplay();
}
}
void Gui::switchToNextDisplayColor(){
@ -975,7 +985,7 @@ void Gui::computeDisplay(){
auto mct = u->getCurrMorphCt();
if(mct && isKeyDown(queueCommandKey)) {//Morph Queue
ut=mct->getMorphUnit();
}//TODO subscribe on queueCommandKey presed => resetState() and may remove stop cmd
}//TODO on queueCommandKey presed disable stop cmd
int morphPos= 8;
for(int i= 0; i < ut->getCommandTypeCount(); ++i){
@ -996,7 +1006,7 @@ void Gui::computeDisplay(){
display.setCommandType(displayPos, ct);
display.setCommandClass(displayPos, ct->getClass());
bool reqOk=u->getFaction()->reqsOk(ct);
display.setDownLighted(displayPos,reqOk);
display.setDownLighted(displayPos, reqOk && !(!ct->isQueueAppendable() && isKeyDown(queueCommandKey)));
if (reqOk && produced != NULL) {
if (possibleAmount == 0) {

View File

@ -196,6 +196,7 @@ public:
void mouseDoubleClickLeftGraphics(int x, int y);
void groupKey(int groupIndex);
void hotKey(SDL_KeyboardEvent key);
void hotKeyReleased(SDL_KeyboardEvent key);
//misc
void switchToNextDisplayColor();