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