feat: gui hotkey released
This commit is contained in:
parent
d2d691024e
commit
35f755841d
|
@ -5005,7 +5005,10 @@ void Game::keyUp(SDL_KeyboardEvent key) {
|
||||||
gameCamera.setMoveX(0);
|
gameCamera.setMoveX(0);
|
||||||
camRightButtonDown= false;
|
camRightButtonDown= false;
|
||||||
calcCameraMoveX();
|
calcCameraMoveX();
|
||||||
|
} else {
|
||||||
|
gui.hotKeyReleased(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
|
|
|
@ -447,6 +447,16 @@ void Gui::hotKey(SDL_KeyboardEvent key) {
|
||||||
else if(isKeyPressed(configKeys.getSDLKey("HotKeySelectedUnitsStop"),key) == true) {
|
else if(isKeyPressed(configKeys.getSDLKey("HotKeySelectedUnitsStop"),key) == true) {
|
||||||
clickCommonCommand(ccStop);
|
clickCommonCommand(ccStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isKeyDown(queueCommandKey)) {
|
||||||
|
computeDisplay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gui::hotKeyReleased(SDL_KeyboardEvent key) {
|
||||||
|
if(!isKeyDown(queueCommandKey)) {
|
||||||
|
computeDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::switchToNextDisplayColor(){
|
void Gui::switchToNextDisplayColor(){
|
||||||
|
@ -975,7 +985,7 @@ void Gui::computeDisplay(){
|
||||||
auto mct = u->getCurrMorphCt();
|
auto mct = u->getCurrMorphCt();
|
||||||
if(mct && isKeyDown(queueCommandKey)) {//Morph Queue
|
if(mct && isKeyDown(queueCommandKey)) {//Morph Queue
|
||||||
ut=mct->getMorphUnit();
|
ut=mct->getMorphUnit();
|
||||||
}//TODO subscribe on queueCommandKey presed => resetState() and may remove stop cmd
|
}//TODO on queueCommandKey presed disable stop cmd
|
||||||
|
|
||||||
int morphPos= 8;
|
int morphPos= 8;
|
||||||
for(int i= 0; i < ut->getCommandTypeCount(); ++i){
|
for(int i= 0; i < ut->getCommandTypeCount(); ++i){
|
||||||
|
@ -996,7 +1006,7 @@ void Gui::computeDisplay(){
|
||||||
display.setCommandType(displayPos, ct);
|
display.setCommandType(displayPos, ct);
|
||||||
display.setCommandClass(displayPos, ct->getClass());
|
display.setCommandClass(displayPos, ct->getClass());
|
||||||
bool reqOk=u->getFaction()->reqsOk(ct);
|
bool reqOk=u->getFaction()->reqsOk(ct);
|
||||||
display.setDownLighted(displayPos,reqOk);
|
display.setDownLighted(displayPos, reqOk && !(!ct->isQueueAppendable() && isKeyDown(queueCommandKey)));
|
||||||
|
|
||||||
if (reqOk && produced != NULL) {
|
if (reqOk && produced != NULL) {
|
||||||
if (possibleAmount == 0) {
|
if (possibleAmount == 0) {
|
||||||
|
|
|
@ -196,6 +196,7 @@ public:
|
||||||
void mouseDoubleClickLeftGraphics(int x, int y);
|
void mouseDoubleClickLeftGraphics(int x, int y);
|
||||||
void groupKey(int groupIndex);
|
void groupKey(int groupIndex);
|
||||||
void hotKey(SDL_KeyboardEvent key);
|
void hotKey(SDL_KeyboardEvent key);
|
||||||
|
void hotKeyReleased(SDL_KeyboardEvent key);
|
||||||
|
|
||||||
//misc
|
//misc
|
||||||
void switchToNextDisplayColor();
|
void switchToNextDisplayColor();
|
||||||
|
|
Loading…
Reference in New Issue