- added a few more special keys for available use as hotkeys (vkPause and vkPrint)

This commit is contained in:
Mark Vejvoda 2011-01-03 22:22:52 +00:00
parent 4de585f5b8
commit f7d2631879
4 changed files with 21 additions and 4 deletions

View File

@ -322,8 +322,15 @@ char Config::translateStringToCharKey(const string &value) const {
else if(value == "vkF12") {
result = vkF12;
}
else if(value == "vkPrint") {
result = vkPrint;
}
else if(value == "vkPause") {
result = vkPause;
}
else {
string sError = "Unsupported key translation" + value;
string sError = "Unsupported key translation [" + value + "]";
throw runtime_error(sError.c_str());
}
}

View File

@ -108,6 +108,8 @@ const char vkF10 = -23;
const char vkF11 = -24;
const char vkF12 = -25;
const char vkDelete = -26;
const char vkPrint = -27;
const char vkPause = -29;
enum WindowStyle{
wsFullscreen,
@ -131,7 +133,7 @@ private:
static bool isKeyPressedDown;
static bool isFullScreen;
static SDL_keysym keystate;
static void setLastMouseEvent(int64 lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
static int64 getLastMouseEvent() {return Window::lastMouseEvent;}
@ -158,7 +160,7 @@ public:
static const bool getIsFullScreen() { return isFullScreen; }
static void setIsFullScreen(bool value) { isFullScreen = value; }
static SDL_keysym getKeystate() { return keystate; }
Window();
virtual ~Window();
@ -189,7 +191,7 @@ public:
static void setUseDefaultCursorOnly(bool value) { no2DMouseRendering = value; }
static bool getUseDefaultCursorOnly() { return no2DMouseRendering; }
static void setAllowAltEnterFullscreenToggle(bool value) { allowAltEnterFullscreenToggle = value; }
static bool getAllowAltEnterFullscreenToggle() { return allowAltEnterFullscreenToggle; }

View File

@ -948,6 +948,10 @@ bool isKeyDown(int virtualKey) {
return (keystate[SDLK_BACKSPACE] != 0);
case vkDelete:
return (keystate[SDLK_DELETE] != 0);
case vkPrint:
return (keystate[SDLK_PRINT] != 0);
case vkPause:
return (keystate[SDLK_PAUSE] != 0);
default:
std::cerr << "isKeyDown called with unknown key.\n";
break;

View File

@ -622,6 +622,10 @@ char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) {
return vkBack;
case SDLK_DELETE:
return vkDelete;
case SDLK_PRINT:
return vkPrint;
case SDLK_PAUSE:
return vkPause;
case SDLK_F1:
return vkF1;
break;