Mercurial > sumwars
changeset 2719:bdc7974dbcf8
refs #92:Change of Show item labels action. Now pressing Alt key, by default, will show/hide item labels. This means you cannot need to keep pressing Alt key all the time if you want to show item labels, just needs a first press to enable it and a second press to disable.
Also translated some german comments into english, and added more.
author | vyproyects@gmail.com |
---|---|
date | Sat, 07 Jun 2014 20:28:32 +0200 |
parents | 0d0431698706 |
children | ec0676c7fb57 |
files | src/core/document.cpp src/core/document.h src/gui/ceguiutility.cpp src/gui/mainwindow.cpp src/gui/mainwindow.h |
diffstat | 5 files changed, 17 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/document.cpp Fri May 30 12:38:48 2014 +0200 +++ b/src/core/document.cpp Sat Jun 07 20:28:32 2014 +0200 @@ -1423,7 +1423,7 @@ } else if (dest == SHOW_ITEMLABELS) { - getGUIState()->m_item_labels = true; + getGUIState()->m_item_labels = !getGUIState()->m_item_labels; } else if (dest >=USE_POTION && dest < USE_POTION+10) { @@ -1555,20 +1555,8 @@ bool Document::onKeyRelease(KeyCode key) { - if (m_gui_state.m_pressed_key != 0) - { - m_gui_state.m_pressed_key = 0; - } - - ShortkeyDestination dest = Options::getInstance()->getMappedDestination(key); - if (dest != 0) - { - if (dest == SHOW_ITEMLABELS) - { - getGUIState()->m_item_labels = false; - } - } - return true; + //Currently there's no key that needs to be treated at release action. + return true; } void Document::update(float time)
--- a/src/core/document.h Fri May 30 12:38:48 2014 +0200 +++ b/src/core/document.h Sat Jun 07 20:28:32 2014 +0200 @@ -653,7 +653,7 @@ /** * \fn bool onKeyRelease(KeyCode key) - * \brief Behandelt loslassen einer Taste + * \brief Treats and releases a key */ bool onKeyRelease(KeyCode key);
--- a/src/gui/ceguiutility.cpp Fri May 30 12:38:48 2014 +0200 +++ b/src/gui/ceguiutility.cpp Sat Jun 07 20:28:32 2014 +0200 @@ -773,7 +773,7 @@ return injectKeyUp (CEGUI::System::getSingletonPtr(), myKey); } - +//Alerts CEGUI about a keyup action and the key itself bool CEGUIUtility::injectKeyUp (CEGUI::System* sys, OIS::KeyCode myKey) { if (!sys)
--- a/src/gui/mainwindow.cpp Fri May 30 12:38:48 2014 +0200 +++ b/src/gui/mainwindow.cpp Sat Jun 07 20:28:32 2014 +0200 @@ -2855,17 +2855,19 @@ bool MainWindow::keyReleased(const OIS::KeyEvent &evt) { - + //Current key is cleared m_key =0; m_key_repeat = false; bool ret = CEGUIUtility::injectKeyUp (m_cegui_system, evt.key); + //Check if releasing key is hold player key. if (evt.key == OIS::KC_RSHIFT || evt.key == OIS::KC_LSHIFT) { m_document->getGUIState()->m_shift_hold = false; } + //Treats release action if (!ret) { ret = m_document->onKeyRelease(evt.key);
--- a/src/gui/mainwindow.h Fri May 30 12:38:48 2014 +0200 +++ b/src/gui/mainwindow.h Sat Jun 07 20:28:32 2014 +0200 @@ -18,15 +18,15 @@ #define __SUMWARS_GUI_MAINWINDOW_H__ -// Utility for CEGUI cross-version compatibility -#include "ceguiutility.h" +// Utility for CEGUI cross-version compatibility +#include "ceguiutility.h" // needed to be able to create the CEGUI renderer interface -#ifdef CEGUI_07 -#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h" -#else -#include "CEGUI/RendererModules/Ogre/Renderer.h" -#endif +#ifdef CEGUI_07 +#include "CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h" +#else +#include "CEGUI/RendererModules/Ogre/Renderer.h" +#endif // CEGUI includes @@ -325,7 +325,7 @@ /** * \fn bool keyReleased(const OIS::KeyEvent &evt) - * \brief Behandelt Loslassen von Tasten auf der Tastatur + * \brief Treats keyboard's keys when released */ bool keyReleased(const OIS::KeyEvent &evt); @@ -478,7 +478,7 @@ /** * \var unsigned int m_key - * \brief gedrueckte Taste + * \brief Pressed key */ unsigned int m_key;