- fixed special keys to be ignored also in menus when in chat mode
This commit is contained in:
parent
a8a3275036
commit
5686e8657c
|
@ -52,6 +52,8 @@ void ChatManager::keyUp(char key){
|
|||
|
||||
try {
|
||||
if(editEnabled){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
if(key==vkEscape)
|
||||
{
|
||||
text.clear();
|
||||
|
@ -83,6 +85,8 @@ void ChatManager::keyDown(char key){
|
|||
|
||||
//toggle team mode
|
||||
if(editEnabled == false && disableTeamMode == false && key=='H') {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
if(teamMode){
|
||||
teamMode= false;
|
||||
console->addLine(lang.get("ChatMode") + ": " + lang.get("All"));
|
||||
|
@ -94,13 +98,20 @@ void ChatManager::keyDown(char key){
|
|||
}
|
||||
|
||||
if(key==vkReturn){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
SDL_keysym keystate = Window::getKeystate();
|
||||
if(keystate.mod & (KMOD_LALT | KMOD_RALT)){
|
||||
// alt+enter is ignored
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
if(editEnabled){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(!text.empty()) {
|
||||
console->addLine(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": " + text);
|
||||
|
@ -114,14 +125,18 @@ void ChatManager::keyDown(char key){
|
|||
}
|
||||
text.clear();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
editEnabled= true;
|
||||
text.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(key==vkBack){
|
||||
if(!text.empty()){
|
||||
else if(key==vkBack) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
if(!text.empty()) {
|
||||
text.erase(text.end() -1);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +152,10 @@ void ChatManager::keyDown(char key){
|
|||
}
|
||||
|
||||
void ChatManager::keyPress(char c){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c,c);
|
||||
|
||||
if(editEnabled && text.size()<maxTextLenght){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,c,c);
|
||||
//space is the first meaningful code
|
||||
if(c>=' '){
|
||||
text+= c;
|
||||
|
|
|
@ -318,20 +318,26 @@ void MainWindow::eventKeyPress(char c){
|
|||
|
||||
program->keyPress(c);
|
||||
|
||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
if(c == configKeys.getCharKey("HotKeyToggleOSMouseEnabled")) {
|
||||
bool showCursorState = false;
|
||||
int state = SDL_ShowCursor(SDL_QUERY);
|
||||
if(state == SDL_DISABLE) {
|
||||
showCursorState = true;
|
||||
if(program != NULL && program->isInSpecialKeyCaptureEvent() == false) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
if(c == configKeys.getCharKey("HotKeyToggleOSMouseEnabled")) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
bool showCursorState = false;
|
||||
int state = SDL_ShowCursor(SDL_QUERY);
|
||||
if(state == SDL_DISABLE) {
|
||||
showCursorState = true;
|
||||
}
|
||||
|
||||
showCursor(showCursorState);
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
renderer.setNo2DMouseRendering(showCursorState);
|
||||
|
||||
Window::lastShowMouseState = SDL_ShowCursor(SDL_QUERY);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::lastShowMouseState = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::lastShowMouseState);
|
||||
}
|
||||
|
||||
showCursor(showCursorState);
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
renderer.setNo2DMouseRendering(showCursorState);
|
||||
|
||||
Window::lastShowMouseState = SDL_ShowCursor(SDL_QUERY);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::lastShowMouseState = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::lastShowMouseState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
void eventMouseMove(int x, int y, const MouseState *ms);
|
||||
|
||||
void renderProgramMsgBox();
|
||||
bool isInSpecialKeyCaptureEvent() { return (programState != NULL ? programState->isInSpecialKeyCaptureEvent() : false); }
|
||||
bool isInSpecialKeyCaptureEvent() { return programState->isInSpecialKeyCaptureEvent(); }
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -178,6 +178,9 @@ void MainMenu::setState(MenuState *state){
|
|||
menuBackground.setTargetCamera(state->getCamera());
|
||||
}
|
||||
|
||||
bool MainMenu::isInSpecialKeyCaptureEvent() {
|
||||
return state->isInSpecialKeyCaptureEvent();
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// class MenuState
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
virtual void keyPress(char key);
|
||||
|
||||
void setState(MenuState *state);
|
||||
virtual bool isInSpecialKeyCaptureEvent();
|
||||
};
|
||||
|
||||
|
||||
|
@ -121,6 +122,8 @@ public:
|
|||
virtual void keyUp(char key){};
|
||||
|
||||
const Camera *getCamera() const {return &camera;}
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return false; }
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
|
Loading…
Reference in New Issue