Added IsMaximized() to cWindow.

KeyCodeTables now are static in all backends.
This commit is contained in:
spartanj@gmail.com
2012-12-09 21:00:14 -03:00
parent d41e078176
commit 8f9df74af5
19 changed files with 374 additions and 267 deletions

View File

@@ -38,6 +38,9 @@ class cPlatformImpl {
/** Maximize the window */
virtual void MaximizeWindow() = 0;
/** @return true if the window is maximized */
virtual bool IsWindowMaximized() = 0;
/** Hide the window */
virtual void HideWindow() = 0;

View File

@@ -148,6 +148,9 @@ class EE_API cWindow {
/** Maximize the Window */
virtual void Maximize();
/** @return true if the window is maximized */
virtual bool IsMaximized();
/** This will attempt to hide the window */
virtual void Hide();

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.0, 2012-12-09T03:29:50. -->
<!-- Written by Qt Creator 2.6.0, 2012-12-09T19:50:51. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@@ -9,6 +9,9 @@
namespace EE { namespace Window { namespace Backend { namespace SDL2 {
static Uint32 KeyCodesTable[ SDL_NUM_SCANCODES ];
static bool KeyCodesTableInit = false;
cInputSDL::cInputSDL( cWindow * window ) :
cInput( window, eeNew( cJoystickManagerSDL, () ) )
{
@@ -115,7 +118,7 @@ void cInputSDL::Update() {
EEEvent.Type = InputEvent::KeyDown;
EEEvent.key.state = SDLEvent.key.state;
EEEvent.key.which = SDLEvent.key.windowID;
EEEvent.key.keysym.sym = mKeyCodesTable[ SDLEvent.key.keysym.scancode ];
EEEvent.key.keysym.sym = KeyCodesTable[ SDLEvent.key.keysym.scancode ];
EEEvent.key.keysym.mod = SDLEvent.key.keysym.mod;
EEEvent.key.keysym.unicode = 0;
break;
@@ -125,7 +128,7 @@ void cInputSDL::Update() {
EEEvent.Type = InputEvent::KeyUp;
EEEvent.key.state = SDLEvent.key.state;
EEEvent.key.which = SDLEvent.key.windowID;
EEEvent.key.keysym.sym = mKeyCodesTable[ SDLEvent.key.keysym.scancode ];
EEEvent.key.keysym.sym = KeyCodesTable[ SDLEvent.key.keysym.scancode ];
if ( SDLEvent.key.keysym.scancode == SDL_SCANCODE_1 ) {
EEEvent.key.state = SDLEvent.key.state;
@@ -369,86 +372,91 @@ void cInputSDL::Init() {
}
void cInputSDL::InitializeTables() {
if ( KeyCodesTableInit )
return;
Uint32 i;
memset( &mKeyCodesTable[0], 0, SDL_NUM_SCANCODES );
memset( &KeyCodesTable[0], 0, SDL_NUM_SCANCODES );
for ( i = SDL_SCANCODE_A; i <= SDL_SCANCODE_Z; i++ )
mKeyCodesTable[ i ] = KEY_A + i - SDL_SCANCODE_A;
KeyCodesTable[ i ] = KEY_A + i - SDL_SCANCODE_A;
mKeyCodesTable[ SDL_SCANCODE_0 ] = KEY_0;
mKeyCodesTable[ SDL_SCANCODE_1 ] = KEY_1;
mKeyCodesTable[ SDL_SCANCODE_2 ] = KEY_2;
mKeyCodesTable[ SDL_SCANCODE_3 ] = KEY_3;
mKeyCodesTable[ SDL_SCANCODE_4 ] = KEY_4;
mKeyCodesTable[ SDL_SCANCODE_5 ] = KEY_5;
mKeyCodesTable[ SDL_SCANCODE_6 ] = KEY_6;
mKeyCodesTable[ SDL_SCANCODE_7 ] = KEY_7;
mKeyCodesTable[ SDL_SCANCODE_8 ] = KEY_8;
mKeyCodesTable[ SDL_SCANCODE_9 ] = KEY_9;
mKeyCodesTable[ SDL_SCANCODE_KP_0 ] = KEY_KP0;
mKeyCodesTable[ SDL_SCANCODE_KP_1 ] = KEY_KP1;
mKeyCodesTable[ SDL_SCANCODE_KP_2 ] = KEY_KP2;
mKeyCodesTable[ SDL_SCANCODE_KP_3 ] = KEY_KP3;
mKeyCodesTable[ SDL_SCANCODE_KP_4 ] = KEY_KP4;
mKeyCodesTable[ SDL_SCANCODE_KP_5 ] = KEY_KP5;
mKeyCodesTable[ SDL_SCANCODE_KP_6 ] = KEY_KP6;
mKeyCodesTable[ SDL_SCANCODE_KP_7 ] = KEY_KP7;
mKeyCodesTable[ SDL_SCANCODE_KP_8 ] = KEY_KP8;
mKeyCodesTable[ SDL_SCANCODE_KP_9 ] = KEY_KP9;
mKeyCodesTable[ SDL_SCANCODE_F1 ] = KEY_F1;
mKeyCodesTable[ SDL_SCANCODE_F2 ] = KEY_F2;
mKeyCodesTable[ SDL_SCANCODE_F3 ] = KEY_F3;
mKeyCodesTable[ SDL_SCANCODE_F4 ] = KEY_F4;
mKeyCodesTable[ SDL_SCANCODE_F5 ] = KEY_F5;
mKeyCodesTable[ SDL_SCANCODE_F6 ] = KEY_F6;
mKeyCodesTable[ SDL_SCANCODE_F7 ] = KEY_F7;
mKeyCodesTable[ SDL_SCANCODE_F8 ] = KEY_F8;
mKeyCodesTable[ SDL_SCANCODE_F9 ] = KEY_F9;
mKeyCodesTable[ SDL_SCANCODE_F10 ] = KEY_F10;
mKeyCodesTable[ SDL_SCANCODE_F11 ] = KEY_F11;
mKeyCodesTable[ SDL_SCANCODE_F12 ] = KEY_F12;
mKeyCodesTable[ SDL_SCANCODE_ESCAPE ] = KEY_ESCAPE;
mKeyCodesTable[ SDL_SCANCODE_MINUS ] = KEY_MINUS;
mKeyCodesTable[ SDL_SCANCODE_EQUALS ] = KEY_EQUALS;
mKeyCodesTable[ SDL_SCANCODE_BACKSPACE ] = KEY_BACKSPACE;
mKeyCodesTable[ SDL_SCANCODE_TAB ] = KEY_TAB;
mKeyCodesTable[ SDL_SCANCODE_RETURN ] = KEY_RETURN;
mKeyCodesTable[ SDL_SCANCODE_SEMICOLON ] = KEY_SEMICOLON;
mKeyCodesTable[ SDL_SCANCODE_BACKSLASH ] = KEY_BACKSLASH;
mKeyCodesTable[ SDL_SCANCODE_COMMA ] = KEY_COMMA;
mKeyCodesTable[ SDL_SCANCODE_SLASH ] = KEY_SLASH;
mKeyCodesTable[ SDL_SCANCODE_KP_SPACE ] = KEY_SPACE;
mKeyCodesTable[ SDL_SCANCODE_INSERT] = KEY_INSERT;
mKeyCodesTable[ SDL_SCANCODE_DELETE ] = KEY_DELETE;
mKeyCodesTable[ SDL_SCANCODE_HOME ] = KEY_HOME;
mKeyCodesTable[ SDL_SCANCODE_END ] = KEY_END;
mKeyCodesTable[ SDL_SCANCODE_PAGEUP ] = KEY_PAGEUP;
mKeyCodesTable[ SDL_SCANCODE_PAGEDOWN ] = KEY_PAGEDOWN;
mKeyCodesTable[ SDL_SCANCODE_LEFT ] = KEY_LEFT;
mKeyCodesTable[ SDL_SCANCODE_RIGHT ] = KEY_RIGHT;
mKeyCodesTable[ SDL_SCANCODE_UP ] = KEY_UP;
mKeyCodesTable[ SDL_SCANCODE_DOWN ] = KEY_DOWN;
mKeyCodesTable[ SDL_SCANCODE_KP_DIVIDE ] = KEY_KP_DIVIDE;
mKeyCodesTable[ SDL_SCANCODE_KP_MULTIPLY ] = KEY_KP_MULTIPLY;
mKeyCodesTable[ SDL_SCANCODE_KP_MINUS ] = KEY_KP_MINUS;
mKeyCodesTable[ SDL_SCANCODE_KP_PLUS ] = KEY_KP_PLUS;
mKeyCodesTable[ SDL_SCANCODE_KP_ENTER ] = KEY_KP_ENTER;
mKeyCodesTable[ SDL_SCANCODE_PRINTSCREEN ] = KEY_PRINT;
mKeyCodesTable[ SDL_SCANCODE_PAUSE ] = KEY_PAUSE;
mKeyCodesTable[ SDL_SCANCODE_KP_EQUALS ] = KEY_KP_EQUALS;
mKeyCodesTable[ SDL_SCANCODE_LSHIFT ] = KEY_LSHIFT;
mKeyCodesTable[ SDL_SCANCODE_RSHIFT ] = KEY_RSHIFT;
mKeyCodesTable[ SDL_SCANCODE_LCTRL ] = KEY_LCTRL;
mKeyCodesTable[ SDL_SCANCODE_RCTRL ] = KEY_RCTRL;
mKeyCodesTable[ SDL_SCANCODE_LALT ] = KEY_LALT;
mKeyCodesTable[ SDL_SCANCODE_RALT ] = KEY_RALT;
mKeyCodesTable[ SDL_SCANCODE_MODE ] = KEY_MODE;
mKeyCodesTable[ SDL_SCANCODE_LGUI ] = KEY_LSUPER;
mKeyCodesTable[ SDL_SCANCODE_RGUI ] = KEY_RSUPER;
mKeyCodesTable[ SDL_SCANCODE_SCROLLLOCK ] = KEY_SCROLLOCK;
mKeyCodesTable[ SDL_SCANCODE_NUMLOCKCLEAR ] = KEY_NUMLOCK;
mKeyCodesTable[ SDL_SCANCODE_CAPSLOCK ] = KEY_CAPSLOCK;
KeyCodesTable[ SDL_SCANCODE_0 ] = KEY_0;
KeyCodesTable[ SDL_SCANCODE_1 ] = KEY_1;
KeyCodesTable[ SDL_SCANCODE_2 ] = KEY_2;
KeyCodesTable[ SDL_SCANCODE_3 ] = KEY_3;
KeyCodesTable[ SDL_SCANCODE_4 ] = KEY_4;
KeyCodesTable[ SDL_SCANCODE_5 ] = KEY_5;
KeyCodesTable[ SDL_SCANCODE_6 ] = KEY_6;
KeyCodesTable[ SDL_SCANCODE_7 ] = KEY_7;
KeyCodesTable[ SDL_SCANCODE_8 ] = KEY_8;
KeyCodesTable[ SDL_SCANCODE_9 ] = KEY_9;
KeyCodesTable[ SDL_SCANCODE_KP_0 ] = KEY_KP0;
KeyCodesTable[ SDL_SCANCODE_KP_1 ] = KEY_KP1;
KeyCodesTable[ SDL_SCANCODE_KP_2 ] = KEY_KP2;
KeyCodesTable[ SDL_SCANCODE_KP_3 ] = KEY_KP3;
KeyCodesTable[ SDL_SCANCODE_KP_4 ] = KEY_KP4;
KeyCodesTable[ SDL_SCANCODE_KP_5 ] = KEY_KP5;
KeyCodesTable[ SDL_SCANCODE_KP_6 ] = KEY_KP6;
KeyCodesTable[ SDL_SCANCODE_KP_7 ] = KEY_KP7;
KeyCodesTable[ SDL_SCANCODE_KP_8 ] = KEY_KP8;
KeyCodesTable[ SDL_SCANCODE_KP_9 ] = KEY_KP9;
KeyCodesTable[ SDL_SCANCODE_F1 ] = KEY_F1;
KeyCodesTable[ SDL_SCANCODE_F2 ] = KEY_F2;
KeyCodesTable[ SDL_SCANCODE_F3 ] = KEY_F3;
KeyCodesTable[ SDL_SCANCODE_F4 ] = KEY_F4;
KeyCodesTable[ SDL_SCANCODE_F5 ] = KEY_F5;
KeyCodesTable[ SDL_SCANCODE_F6 ] = KEY_F6;
KeyCodesTable[ SDL_SCANCODE_F7 ] = KEY_F7;
KeyCodesTable[ SDL_SCANCODE_F8 ] = KEY_F8;
KeyCodesTable[ SDL_SCANCODE_F9 ] = KEY_F9;
KeyCodesTable[ SDL_SCANCODE_F10 ] = KEY_F10;
KeyCodesTable[ SDL_SCANCODE_F11 ] = KEY_F11;
KeyCodesTable[ SDL_SCANCODE_F12 ] = KEY_F12;
KeyCodesTable[ SDL_SCANCODE_ESCAPE ] = KEY_ESCAPE;
KeyCodesTable[ SDL_SCANCODE_MINUS ] = KEY_MINUS;
KeyCodesTable[ SDL_SCANCODE_EQUALS ] = KEY_EQUALS;
KeyCodesTable[ SDL_SCANCODE_BACKSPACE ] = KEY_BACKSPACE;
KeyCodesTable[ SDL_SCANCODE_TAB ] = KEY_TAB;
KeyCodesTable[ SDL_SCANCODE_RETURN ] = KEY_RETURN;
KeyCodesTable[ SDL_SCANCODE_SEMICOLON ] = KEY_SEMICOLON;
KeyCodesTable[ SDL_SCANCODE_BACKSLASH ] = KEY_BACKSLASH;
KeyCodesTable[ SDL_SCANCODE_COMMA ] = KEY_COMMA;
KeyCodesTable[ SDL_SCANCODE_SLASH ] = KEY_SLASH;
KeyCodesTable[ SDL_SCANCODE_KP_SPACE ] = KEY_SPACE;
KeyCodesTable[ SDL_SCANCODE_INSERT] = KEY_INSERT;
KeyCodesTable[ SDL_SCANCODE_DELETE ] = KEY_DELETE;
KeyCodesTable[ SDL_SCANCODE_HOME ] = KEY_HOME;
KeyCodesTable[ SDL_SCANCODE_END ] = KEY_END;
KeyCodesTable[ SDL_SCANCODE_PAGEUP ] = KEY_PAGEUP;
KeyCodesTable[ SDL_SCANCODE_PAGEDOWN ] = KEY_PAGEDOWN;
KeyCodesTable[ SDL_SCANCODE_LEFT ] = KEY_LEFT;
KeyCodesTable[ SDL_SCANCODE_RIGHT ] = KEY_RIGHT;
KeyCodesTable[ SDL_SCANCODE_UP ] = KEY_UP;
KeyCodesTable[ SDL_SCANCODE_DOWN ] = KEY_DOWN;
KeyCodesTable[ SDL_SCANCODE_KP_DIVIDE ] = KEY_KP_DIVIDE;
KeyCodesTable[ SDL_SCANCODE_KP_MULTIPLY ] = KEY_KP_MULTIPLY;
KeyCodesTable[ SDL_SCANCODE_KP_MINUS ] = KEY_KP_MINUS;
KeyCodesTable[ SDL_SCANCODE_KP_PLUS ] = KEY_KP_PLUS;
KeyCodesTable[ SDL_SCANCODE_KP_ENTER ] = KEY_KP_ENTER;
KeyCodesTable[ SDL_SCANCODE_PRINTSCREEN ] = KEY_PRINT;
KeyCodesTable[ SDL_SCANCODE_PAUSE ] = KEY_PAUSE;
KeyCodesTable[ SDL_SCANCODE_KP_EQUALS ] = KEY_KP_EQUALS;
KeyCodesTable[ SDL_SCANCODE_LSHIFT ] = KEY_LSHIFT;
KeyCodesTable[ SDL_SCANCODE_RSHIFT ] = KEY_RSHIFT;
KeyCodesTable[ SDL_SCANCODE_LCTRL ] = KEY_LCTRL;
KeyCodesTable[ SDL_SCANCODE_RCTRL ] = KEY_RCTRL;
KeyCodesTable[ SDL_SCANCODE_LALT ] = KEY_LALT;
KeyCodesTable[ SDL_SCANCODE_RALT ] = KEY_RALT;
KeyCodesTable[ SDL_SCANCODE_MODE ] = KEY_MODE;
KeyCodesTable[ SDL_SCANCODE_LGUI ] = KEY_LSUPER;
KeyCodesTable[ SDL_SCANCODE_RGUI ] = KEY_RSUPER;
KeyCodesTable[ SDL_SCANCODE_SCROLLLOCK ] = KEY_SCROLLOCK;
KeyCodesTable[ SDL_SCANCODE_NUMLOCKCLEAR ] = KEY_NUMLOCK;
KeyCodesTable[ SDL_SCANCODE_CAPSLOCK ] = KEY_CAPSLOCK;
KeyCodesTableInit = true;
}
}}}}

View File

@@ -28,8 +28,6 @@ class EE_API cInputSDL : public cInput {
virtual void Init();
Uint32 mKeyCodesTable[ SDL_NUM_SCANCODES ];
void InitializeTables();
};

View File

@@ -8,6 +8,9 @@
namespace EE { namespace Window { namespace Backend { namespace SFML {
static Uint32 KeyCodesTable[ sf::Keyboard::KeyCount ];
static bool KeyCodesTableInit = false;
cInputSFML::cInputSFML( cWindow * window ) :
cInput( window, eeNew( cJoystickManagerSFML, () ) ),
mWinActive( true )
@@ -101,7 +104,7 @@ void cInputSFML::Update() {
sf::Keyboard::BackSpace != event.key.code
) {
EEEvent.Type = InputEvent::KeyDown;
EEEvent.key.keysym.sym = mKeyCodesTable[ event.key.code ];
EEEvent.key.keysym.sym = KeyCodesTable[ event.key.code ];
EEEvent.key.keysym.mod = SetMod( event.key );
EEEvent.key.keysym.unicode = 0;
} else {
@@ -113,7 +116,7 @@ void cInputSFML::Update() {
case sf::Event::KeyReleased:
{
EEEvent.Type = InputEvent::KeyUp;
EEEvent.key.keysym.sym = mKeyCodesTable[ event.key.code ];
EEEvent.key.keysym.sym = KeyCodesTable[ event.key.code ];
EEEvent.key.keysym.mod = SetMod( event.key );
EEEvent.key.keysym.unicode = 0;
break;
@@ -229,86 +232,91 @@ Uint32 cInputSFML::SetMod( sf::Event::KeyEvent& key ) {
}
void cInputSFML::InitializeTables() {
if ( KeyCodesTableInit )
return;
Uint32 i;
for ( i = sf::Keyboard::A; i <= sf::Keyboard::Z; i++ )
mKeyCodesTable[ i ] = KEY_A + i;
KeyCodesTable[ i ] = KEY_A + i;
mKeyCodesTable[ sf::Keyboard::Num0 ] = KEY_0;
mKeyCodesTable[ sf::Keyboard::Num1 ] = KEY_1;
mKeyCodesTable[ sf::Keyboard::Num2 ] = KEY_2;
mKeyCodesTable[ sf::Keyboard::Num3 ] = KEY_3;
mKeyCodesTable[ sf::Keyboard::Num4 ] = KEY_4;
mKeyCodesTable[ sf::Keyboard::Num5 ] = KEY_5;
mKeyCodesTable[ sf::Keyboard::Num6 ] = KEY_6;
mKeyCodesTable[ sf::Keyboard::Num7 ] = KEY_7;
mKeyCodesTable[ sf::Keyboard::Num8 ] = KEY_8;
mKeyCodesTable[ sf::Keyboard::Num9 ] = KEY_9;
mKeyCodesTable[ sf::Keyboard::Escape ] = KEY_ESCAPE;
mKeyCodesTable[ sf::Keyboard::LControl ] = KEY_LCTRL;
mKeyCodesTable[ sf::Keyboard::LShift ] = KEY_LSHIFT;
mKeyCodesTable[ sf::Keyboard::LAlt ] = KEY_LALT;
mKeyCodesTable[ sf::Keyboard::LSystem ] = KEY_LMETA;
mKeyCodesTable[ sf::Keyboard::RControl ] = KEY_RCTRL;
mKeyCodesTable[ sf::Keyboard::RShift ] = KEY_RSHIFT;
mKeyCodesTable[ sf::Keyboard::RAlt ] = KEY_RALT;
mKeyCodesTable[ sf::Keyboard::RSystem ] = KEY_RMETA;
mKeyCodesTable[ sf::Keyboard::Menu ] = KEY_MENU;
mKeyCodesTable[ sf::Keyboard::LBracket ] = KEY_LEFTBRACKET;
mKeyCodesTable[ sf::Keyboard::RBracket ] = KEY_RIGHTBRACKET;
mKeyCodesTable[ sf::Keyboard::SemiColon ] = KEY_SEMICOLON;
mKeyCodesTable[ sf::Keyboard::Comma ] = KEY_COMMA;
mKeyCodesTable[ sf::Keyboard::Period ] = KEY_PERIOD;
mKeyCodesTable[ sf::Keyboard::Quote ] = KEY_QUOTE;
mKeyCodesTable[ sf::Keyboard::Slash ] = KEY_SLASH;
mKeyCodesTable[ sf::Keyboard::BackSlash ] = KEY_BACKSLASH;
mKeyCodesTable[ sf::Keyboard::Tilde ] = KEY_BACKQUOTE;
mKeyCodesTable[ sf::Keyboard::Equal ] = KEY_EQUALS;
mKeyCodesTable[ sf::Keyboard::Dash ] = KEY_MINUS;
mKeyCodesTable[ sf::Keyboard::Space ] = KEY_SPACE;
mKeyCodesTable[ sf::Keyboard::Return ] = KEY_RETURN;
mKeyCodesTable[ sf::Keyboard::BackSpace ] = KEY_BACKSPACE;
mKeyCodesTable[ sf::Keyboard::Tab ] = KEY_TAB;
mKeyCodesTable[ sf::Keyboard::PageUp ] = KEY_PAGEUP;
mKeyCodesTable[ sf::Keyboard::PageDown ] = KEY_PAGEDOWN;
mKeyCodesTable[ sf::Keyboard::End ] = KEY_END;
mKeyCodesTable[ sf::Keyboard::Home ] = KEY_HOME;
mKeyCodesTable[ sf::Keyboard::Insert ] = KEY_INSERT;
mKeyCodesTable[ sf::Keyboard::Delete ] = KEY_DELETE;
mKeyCodesTable[ sf::Keyboard::Add ] = KEY_KP_PLUS;
mKeyCodesTable[ sf::Keyboard::Subtract ] = KEY_KP_MINUS;
mKeyCodesTable[ sf::Keyboard::Multiply ] = KEY_KP_MULTIPLY;
mKeyCodesTable[ sf::Keyboard::Divide ] = KEY_KP_DIVIDE;
mKeyCodesTable[ sf::Keyboard::Left ] = KEY_LEFT;
mKeyCodesTable[ sf::Keyboard::Right ] = KEY_RIGHT;
mKeyCodesTable[ sf::Keyboard::Up ] = KEY_UP;
mKeyCodesTable[ sf::Keyboard::Down ] = KEY_DOWN;
mKeyCodesTable[ sf::Keyboard::Numpad0 ] = KEY_KP0;
mKeyCodesTable[ sf::Keyboard::Numpad1 ] = KEY_KP1;
mKeyCodesTable[ sf::Keyboard::Numpad2 ] = KEY_KP2;
mKeyCodesTable[ sf::Keyboard::Numpad3 ] = KEY_KP3;
mKeyCodesTable[ sf::Keyboard::Numpad4 ] = KEY_KP4;
mKeyCodesTable[ sf::Keyboard::Numpad5 ] = KEY_KP5;
mKeyCodesTable[ sf::Keyboard::Numpad6 ] = KEY_KP6;
mKeyCodesTable[ sf::Keyboard::Numpad7 ] = KEY_KP7;
mKeyCodesTable[ sf::Keyboard::Numpad8 ] = KEY_KP8;
mKeyCodesTable[ sf::Keyboard::Numpad9 ] = KEY_KP9;
mKeyCodesTable[ sf::Keyboard::F1 ] = KEY_F1;
mKeyCodesTable[ sf::Keyboard::F2 ] = KEY_F2;
mKeyCodesTable[ sf::Keyboard::F3 ] = KEY_F3;
mKeyCodesTable[ sf::Keyboard::F4 ] = KEY_F4;
mKeyCodesTable[ sf::Keyboard::F5 ] = KEY_F5;
mKeyCodesTable[ sf::Keyboard::F6 ] = KEY_F6;
mKeyCodesTable[ sf::Keyboard::F7 ] = KEY_F7;
mKeyCodesTable[ sf::Keyboard::F8 ] = KEY_F8;
mKeyCodesTable[ sf::Keyboard::F9 ] = KEY_F9;
mKeyCodesTable[ sf::Keyboard::F10 ] = KEY_F10;
mKeyCodesTable[ sf::Keyboard::F11 ] = KEY_F11;
mKeyCodesTable[ sf::Keyboard::F12 ] = KEY_F12;
mKeyCodesTable[ sf::Keyboard::F13 ] = KEY_F13;
mKeyCodesTable[ sf::Keyboard::F14 ] = KEY_F14;
mKeyCodesTable[ sf::Keyboard::F15 ] = KEY_F15;
mKeyCodesTable[ sf::Keyboard::Pause ] = KEY_PAUSE;
KeyCodesTable[ sf::Keyboard::Num0 ] = KEY_0;
KeyCodesTable[ sf::Keyboard::Num1 ] = KEY_1;
KeyCodesTable[ sf::Keyboard::Num2 ] = KEY_2;
KeyCodesTable[ sf::Keyboard::Num3 ] = KEY_3;
KeyCodesTable[ sf::Keyboard::Num4 ] = KEY_4;
KeyCodesTable[ sf::Keyboard::Num5 ] = KEY_5;
KeyCodesTable[ sf::Keyboard::Num6 ] = KEY_6;
KeyCodesTable[ sf::Keyboard::Num7 ] = KEY_7;
KeyCodesTable[ sf::Keyboard::Num8 ] = KEY_8;
KeyCodesTable[ sf::Keyboard::Num9 ] = KEY_9;
KeyCodesTable[ sf::Keyboard::Escape ] = KEY_ESCAPE;
KeyCodesTable[ sf::Keyboard::LControl ] = KEY_LCTRL;
KeyCodesTable[ sf::Keyboard::LShift ] = KEY_LSHIFT;
KeyCodesTable[ sf::Keyboard::LAlt ] = KEY_LALT;
KeyCodesTable[ sf::Keyboard::LSystem ] = KEY_LMETA;
KeyCodesTable[ sf::Keyboard::RControl ] = KEY_RCTRL;
KeyCodesTable[ sf::Keyboard::RShift ] = KEY_RSHIFT;
KeyCodesTable[ sf::Keyboard::RAlt ] = KEY_RALT;
KeyCodesTable[ sf::Keyboard::RSystem ] = KEY_RMETA;
KeyCodesTable[ sf::Keyboard::Menu ] = KEY_MENU;
KeyCodesTable[ sf::Keyboard::LBracket ] = KEY_LEFTBRACKET;
KeyCodesTable[ sf::Keyboard::RBracket ] = KEY_RIGHTBRACKET;
KeyCodesTable[ sf::Keyboard::SemiColon ] = KEY_SEMICOLON;
KeyCodesTable[ sf::Keyboard::Comma ] = KEY_COMMA;
KeyCodesTable[ sf::Keyboard::Period ] = KEY_PERIOD;
KeyCodesTable[ sf::Keyboard::Quote ] = KEY_QUOTE;
KeyCodesTable[ sf::Keyboard::Slash ] = KEY_SLASH;
KeyCodesTable[ sf::Keyboard::BackSlash ] = KEY_BACKSLASH;
KeyCodesTable[ sf::Keyboard::Tilde ] = KEY_BACKQUOTE;
KeyCodesTable[ sf::Keyboard::Equal ] = KEY_EQUALS;
KeyCodesTable[ sf::Keyboard::Dash ] = KEY_MINUS;
KeyCodesTable[ sf::Keyboard::Space ] = KEY_SPACE;
KeyCodesTable[ sf::Keyboard::Return ] = KEY_RETURN;
KeyCodesTable[ sf::Keyboard::BackSpace ] = KEY_BACKSPACE;
KeyCodesTable[ sf::Keyboard::Tab ] = KEY_TAB;
KeyCodesTable[ sf::Keyboard::PageUp ] = KEY_PAGEUP;
KeyCodesTable[ sf::Keyboard::PageDown ] = KEY_PAGEDOWN;
KeyCodesTable[ sf::Keyboard::End ] = KEY_END;
KeyCodesTable[ sf::Keyboard::Home ] = KEY_HOME;
KeyCodesTable[ sf::Keyboard::Insert ] = KEY_INSERT;
KeyCodesTable[ sf::Keyboard::Delete ] = KEY_DELETE;
KeyCodesTable[ sf::Keyboard::Add ] = KEY_KP_PLUS;
KeyCodesTable[ sf::Keyboard::Subtract ] = KEY_KP_MINUS;
KeyCodesTable[ sf::Keyboard::Multiply ] = KEY_KP_MULTIPLY;
KeyCodesTable[ sf::Keyboard::Divide ] = KEY_KP_DIVIDE;
KeyCodesTable[ sf::Keyboard::Left ] = KEY_LEFT;
KeyCodesTable[ sf::Keyboard::Right ] = KEY_RIGHT;
KeyCodesTable[ sf::Keyboard::Up ] = KEY_UP;
KeyCodesTable[ sf::Keyboard::Down ] = KEY_DOWN;
KeyCodesTable[ sf::Keyboard::Numpad0 ] = KEY_KP0;
KeyCodesTable[ sf::Keyboard::Numpad1 ] = KEY_KP1;
KeyCodesTable[ sf::Keyboard::Numpad2 ] = KEY_KP2;
KeyCodesTable[ sf::Keyboard::Numpad3 ] = KEY_KP3;
KeyCodesTable[ sf::Keyboard::Numpad4 ] = KEY_KP4;
KeyCodesTable[ sf::Keyboard::Numpad5 ] = KEY_KP5;
KeyCodesTable[ sf::Keyboard::Numpad6 ] = KEY_KP6;
KeyCodesTable[ sf::Keyboard::Numpad7 ] = KEY_KP7;
KeyCodesTable[ sf::Keyboard::Numpad8 ] = KEY_KP8;
KeyCodesTable[ sf::Keyboard::Numpad9 ] = KEY_KP9;
KeyCodesTable[ sf::Keyboard::F1 ] = KEY_F1;
KeyCodesTable[ sf::Keyboard::F2 ] = KEY_F2;
KeyCodesTable[ sf::Keyboard::F3 ] = KEY_F3;
KeyCodesTable[ sf::Keyboard::F4 ] = KEY_F4;
KeyCodesTable[ sf::Keyboard::F5 ] = KEY_F5;
KeyCodesTable[ sf::Keyboard::F6 ] = KEY_F6;
KeyCodesTable[ sf::Keyboard::F7 ] = KEY_F7;
KeyCodesTable[ sf::Keyboard::F8 ] = KEY_F8;
KeyCodesTable[ sf::Keyboard::F9 ] = KEY_F9;
KeyCodesTable[ sf::Keyboard::F10 ] = KEY_F10;
KeyCodesTable[ sf::Keyboard::F11 ] = KEY_F11;
KeyCodesTable[ sf::Keyboard::F12 ] = KEY_F12;
KeyCodesTable[ sf::Keyboard::F13 ] = KEY_F13;
KeyCodesTable[ sf::Keyboard::F14 ] = KEY_F14;
KeyCodesTable[ sf::Keyboard::F15 ] = KEY_F15;
KeyCodesTable[ sf::Keyboard::Pause ] = KEY_PAUSE;
KeyCodesTableInit = true;
}
}}}}

View File

@@ -25,8 +25,6 @@ class EE_API cInputSFML : public cInput {
protected:
friend class cWindowSFML;
Uint32 mKeyCodesTable[ sf::Keyboard::KeyCount ];
bool mWinActive;
cInputSFML( Window::cWindow * window );

View File

@@ -6,12 +6,15 @@
namespace EE { namespace Window { namespace Backend { namespace Al {
static Uint32 KeyCodesTable[ ALLEGRO_KEY_MAX ];
static bool KeyCodesTableInit = false;
cInputAl::cInputAl( cWindow * window ) :
cInput( window, eeNew( cJoystickManagerAl, () ) ),
mGrab( false ),
mZ( 0 )
{
memset( mKeyCodesTable, 0, KEY_LAST );
memset( KeyCodesTable, 0, KEY_LAST );
}
cInputAl::~cInputAl() {
@@ -56,7 +59,7 @@ void cInputAl::Update() {
EEEvent.Type = InputEvent::KeyDown;
}
EEEvent.key.keysym.sym = mKeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.sym = KeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.unicode = ALEvent.keyboard.unichar;
break;
@@ -69,7 +72,7 @@ void cInputAl::Update() {
ALLEGRO_KEY_BACKSPACE != ALEvent.keyboard.keycode
) {
EEEvent.Type = InputEvent::KeyDown;
EEEvent.key.keysym.sym = mKeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.sym = KeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.mod = SetMod( ALEvent.keyboard.modifiers );
EEEvent.key.keysym.unicode = ALEvent.keyboard.unichar;
} else {
@@ -80,7 +83,7 @@ void cInputAl::Update() {
case ALLEGRO_EVENT_KEY_UP:
{
EEEvent.Type = InputEvent::KeyUp;
EEEvent.key.keysym.sym = mKeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.sym = KeyCodesTable[ ALEvent.keyboard.keycode ];
EEEvent.key.keysym.mod = SetMod( ALEvent.keyboard.modifiers );
EEEvent.key.keysym.unicode = ALEvent.keyboard.unichar;
break;
@@ -269,104 +272,109 @@ ALLEGRO_DISPLAY * cInputAl::GetDisplay() {
}
void cInputAl::InitializeTables() {
if ( KeyCodesTableInit )
return;
Uint32 i;
for ( i = ALLEGRO_KEY_A; i <= ALLEGRO_KEY_Z; i++ )
mKeyCodesTable[ i ] = KEY_A - 1 + i;
KeyCodesTable[ i ] = KEY_A - 1 + i;
mKeyCodesTable[ ALLEGRO_KEY_0 ] = KEY_0;
mKeyCodesTable[ ALLEGRO_KEY_1 ] = KEY_1;
mKeyCodesTable[ ALLEGRO_KEY_2 ] = KEY_2;
mKeyCodesTable[ ALLEGRO_KEY_3 ] = KEY_3;
mKeyCodesTable[ ALLEGRO_KEY_4 ] = KEY_4;
mKeyCodesTable[ ALLEGRO_KEY_5 ] = KEY_5;
mKeyCodesTable[ ALLEGRO_KEY_6 ] = KEY_6;
mKeyCodesTable[ ALLEGRO_KEY_7 ] = KEY_7;
mKeyCodesTable[ ALLEGRO_KEY_8 ] = KEY_8;
mKeyCodesTable[ ALLEGRO_KEY_9 ] = KEY_9;
mKeyCodesTable[ ALLEGRO_KEY_PAD_0 ] = KEY_KP0;
mKeyCodesTable[ ALLEGRO_KEY_PAD_1 ] = KEY_KP1;
mKeyCodesTable[ ALLEGRO_KEY_PAD_2 ] = KEY_KP2;
mKeyCodesTable[ ALLEGRO_KEY_PAD_3 ] = KEY_KP3;
mKeyCodesTable[ ALLEGRO_KEY_PAD_4 ] = KEY_KP4;
mKeyCodesTable[ ALLEGRO_KEY_PAD_5 ] = KEY_KP5;
mKeyCodesTable[ ALLEGRO_KEY_PAD_6 ] = KEY_KP6;
mKeyCodesTable[ ALLEGRO_KEY_PAD_7 ] = KEY_KP7;
mKeyCodesTable[ ALLEGRO_KEY_PAD_8 ] = KEY_KP8;
mKeyCodesTable[ ALLEGRO_KEY_PAD_9 ] = KEY_KP9;
mKeyCodesTable[ ALLEGRO_KEY_F1 ] = KEY_F1;
mKeyCodesTable[ ALLEGRO_KEY_F2 ] = KEY_F2;
mKeyCodesTable[ ALLEGRO_KEY_F3 ] = KEY_F3;
mKeyCodesTable[ ALLEGRO_KEY_F4 ] = KEY_F4;
mKeyCodesTable[ ALLEGRO_KEY_F5 ] = KEY_F5;
mKeyCodesTable[ ALLEGRO_KEY_F6 ] = KEY_F6;
mKeyCodesTable[ ALLEGRO_KEY_F7 ] = KEY_F7;
mKeyCodesTable[ ALLEGRO_KEY_F8 ] = KEY_F8;
mKeyCodesTable[ ALLEGRO_KEY_F9 ] = KEY_F9;
mKeyCodesTable[ ALLEGRO_KEY_F10 ] = KEY_F10;
mKeyCodesTable[ ALLEGRO_KEY_F11 ] = KEY_F11;
mKeyCodesTable[ ALLEGRO_KEY_F12 ] = KEY_F12;
mKeyCodesTable[ ALLEGRO_KEY_ESCAPE ] = KEY_ESCAPE;
//mKeyCodesTable[ ALLEGRO_KEY_TILDE ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_MINUS ] = KEY_MINUS;
mKeyCodesTable[ ALLEGRO_KEY_EQUALS ] = KEY_EQUALS;
mKeyCodesTable[ ALLEGRO_KEY_BACKSPACE ] = KEY_BACKSPACE;
mKeyCodesTable[ ALLEGRO_KEY_TAB ] = KEY_TAB;
//mKeyCodesTable[ ALLEGRO_KEY_OPENBRACE ] = KEY_?;
//mKeyCodesTable[ ALLEGRO_KEY_CLOSEBRACE ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_ENTER ] = KEY_RETURN;
mKeyCodesTable[ ALLEGRO_KEY_SEMICOLON ] = KEY_SEMICOLON;
mKeyCodesTable[ ALLEGRO_KEY_QUOTE ] = KEY_QUOTE;
mKeyCodesTable[ ALLEGRO_KEY_BACKSLASH ] = KEY_BACKSLASH;
//mKeyCodesTable[ ALLEGRO_KEY_BACKSLASH2 ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_COMMA ] = KEY_COMMA;
//mKeyCodesTable[ ALLEGRO_KEY_FULLSTOP ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_SLASH ] = KEY_SLASH;
mKeyCodesTable[ ALLEGRO_KEY_SPACE ] = KEY_SPACE;
mKeyCodesTable[ ALLEGRO_KEY_INSERT] = KEY_INSERT;
mKeyCodesTable[ ALLEGRO_KEY_DELETE ] = KEY_DELETE;
mKeyCodesTable[ ALLEGRO_KEY_HOME ] = KEY_HOME;
mKeyCodesTable[ ALLEGRO_KEY_END ] = KEY_END;
mKeyCodesTable[ ALLEGRO_KEY_PGUP ] = KEY_PAGEUP;
mKeyCodesTable[ ALLEGRO_KEY_PGDN ] = KEY_PAGEDOWN;
mKeyCodesTable[ ALLEGRO_KEY_LEFT ] = KEY_LEFT;
mKeyCodesTable[ ALLEGRO_KEY_RIGHT ] = KEY_RIGHT;
mKeyCodesTable[ ALLEGRO_KEY_UP ] = KEY_UP;
mKeyCodesTable[ ALLEGRO_KEY_DOWN ] = KEY_DOWN;
mKeyCodesTable[ ALLEGRO_KEY_PAD_SLASH ] = KEY_KP_DIVIDE;
mKeyCodesTable[ ALLEGRO_KEY_PAD_ASTERISK ] = KEY_KP_MULTIPLY;
mKeyCodesTable[ ALLEGRO_KEY_PAD_MINUS ] = KEY_KP_MINUS;
mKeyCodesTable[ ALLEGRO_KEY_PAD_PLUS ] = KEY_KP_PLUS;
//mKeyCodesTable[ ALLEGRO_KEY_PAD_DELETE ] = KEY_KP_?;
mKeyCodesTable[ ALLEGRO_KEY_PAD_ENTER ] = KEY_KP_ENTER;
mKeyCodesTable[ ALLEGRO_KEY_PRINTSCREEN ] = KEY_PRINT;
mKeyCodesTable[ ALLEGRO_KEY_PAUSE ] = KEY_PAUSE;
//mKeyCodesTable[ ALLEGRO_KEY_ABNT_C1 ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_YEN ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_KANA ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_CONVERT ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_NOCONVERT ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_AT ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_CIRCUMFLEX ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_COLON2 ] = KEY_KP_?;
//mKeyCodesTable[ ALLEGRO_KEY_KANJI ] = KEY_KP_?;
mKeyCodesTable[ ALLEGRO_KEY_PAD_EQUALS ] = KEY_KP_EQUALS;
mKeyCodesTable[ ALLEGRO_KEY_BACKQUOTE ] = KEY_BACKQUOTE;
//mKeyCodesTable[ ALLEGRO_KEY_SEMICOLON2 ] = KEY_?;
//mKeyCodesTable[ ALLEGRO_KEY_COMMAND ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_UNKNOWN ] = KEY_UNKNOWN;
mKeyCodesTable[ ALLEGRO_KEY_LSHIFT ] = KEY_LSHIFT;
mKeyCodesTable[ ALLEGRO_KEY_RSHIFT ] = KEY_RSHIFT;
mKeyCodesTable[ ALLEGRO_KEY_LCTRL ] = KEY_LCTRL;
mKeyCodesTable[ ALLEGRO_KEY_RCTRL ] = KEY_RCTRL;
mKeyCodesTable[ ALLEGRO_KEY_ALT ] = KEY_LALT;
mKeyCodesTable[ ALLEGRO_KEY_ALTGR ] = KEY_MODE; //KEY_RALT;
mKeyCodesTable[ ALLEGRO_KEY_LWIN ] = KEY_LSUPER;
mKeyCodesTable[ ALLEGRO_KEY_RWIN ] = KEY_RSUPER;
//mKeyCodesTable[ ALLEGRO_KEY_MENU ] = KEY_?;
mKeyCodesTable[ ALLEGRO_KEY_SCROLLLOCK ] = KEY_SCROLLOCK;
mKeyCodesTable[ ALLEGRO_KEY_NUMLOCK ] = KEY_NUMLOCK;
mKeyCodesTable[ ALLEGRO_KEY_CAPSLOCK ] = KEY_CAPSLOCK;
KeyCodesTable[ ALLEGRO_KEY_0 ] = KEY_0;
KeyCodesTable[ ALLEGRO_KEY_1 ] = KEY_1;
KeyCodesTable[ ALLEGRO_KEY_2 ] = KEY_2;
KeyCodesTable[ ALLEGRO_KEY_3 ] = KEY_3;
KeyCodesTable[ ALLEGRO_KEY_4 ] = KEY_4;
KeyCodesTable[ ALLEGRO_KEY_5 ] = KEY_5;
KeyCodesTable[ ALLEGRO_KEY_6 ] = KEY_6;
KeyCodesTable[ ALLEGRO_KEY_7 ] = KEY_7;
KeyCodesTable[ ALLEGRO_KEY_8 ] = KEY_8;
KeyCodesTable[ ALLEGRO_KEY_9 ] = KEY_9;
KeyCodesTable[ ALLEGRO_KEY_PAD_0 ] = KEY_KP0;
KeyCodesTable[ ALLEGRO_KEY_PAD_1 ] = KEY_KP1;
KeyCodesTable[ ALLEGRO_KEY_PAD_2 ] = KEY_KP2;
KeyCodesTable[ ALLEGRO_KEY_PAD_3 ] = KEY_KP3;
KeyCodesTable[ ALLEGRO_KEY_PAD_4 ] = KEY_KP4;
KeyCodesTable[ ALLEGRO_KEY_PAD_5 ] = KEY_KP5;
KeyCodesTable[ ALLEGRO_KEY_PAD_6 ] = KEY_KP6;
KeyCodesTable[ ALLEGRO_KEY_PAD_7 ] = KEY_KP7;
KeyCodesTable[ ALLEGRO_KEY_PAD_8 ] = KEY_KP8;
KeyCodesTable[ ALLEGRO_KEY_PAD_9 ] = KEY_KP9;
KeyCodesTable[ ALLEGRO_KEY_F1 ] = KEY_F1;
KeyCodesTable[ ALLEGRO_KEY_F2 ] = KEY_F2;
KeyCodesTable[ ALLEGRO_KEY_F3 ] = KEY_F3;
KeyCodesTable[ ALLEGRO_KEY_F4 ] = KEY_F4;
KeyCodesTable[ ALLEGRO_KEY_F5 ] = KEY_F5;
KeyCodesTable[ ALLEGRO_KEY_F6 ] = KEY_F6;
KeyCodesTable[ ALLEGRO_KEY_F7 ] = KEY_F7;
KeyCodesTable[ ALLEGRO_KEY_F8 ] = KEY_F8;
KeyCodesTable[ ALLEGRO_KEY_F9 ] = KEY_F9;
KeyCodesTable[ ALLEGRO_KEY_F10 ] = KEY_F10;
KeyCodesTable[ ALLEGRO_KEY_F11 ] = KEY_F11;
KeyCodesTable[ ALLEGRO_KEY_F12 ] = KEY_F12;
KeyCodesTable[ ALLEGRO_KEY_ESCAPE ] = KEY_ESCAPE;
//KeyCodesTable[ ALLEGRO_KEY_TILDE ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_MINUS ] = KEY_MINUS;
KeyCodesTable[ ALLEGRO_KEY_EQUALS ] = KEY_EQUALS;
KeyCodesTable[ ALLEGRO_KEY_BACKSPACE ] = KEY_BACKSPACE;
KeyCodesTable[ ALLEGRO_KEY_TAB ] = KEY_TAB;
//KeyCodesTable[ ALLEGRO_KEY_OPENBRACE ] = KEY_?;
//KeyCodesTable[ ALLEGRO_KEY_CLOSEBRACE ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_ENTER ] = KEY_RETURN;
KeyCodesTable[ ALLEGRO_KEY_SEMICOLON ] = KEY_SEMICOLON;
KeyCodesTable[ ALLEGRO_KEY_QUOTE ] = KEY_QUOTE;
KeyCodesTable[ ALLEGRO_KEY_BACKSLASH ] = KEY_BACKSLASH;
//KeyCodesTable[ ALLEGRO_KEY_BACKSLASH2 ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_COMMA ] = KEY_COMMA;
//KeyCodesTable[ ALLEGRO_KEY_FULLSTOP ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_SLASH ] = KEY_SLASH;
KeyCodesTable[ ALLEGRO_KEY_SPACE ] = KEY_SPACE;
KeyCodesTable[ ALLEGRO_KEY_INSERT] = KEY_INSERT;
KeyCodesTable[ ALLEGRO_KEY_DELETE ] = KEY_DELETE;
KeyCodesTable[ ALLEGRO_KEY_HOME ] = KEY_HOME;
KeyCodesTable[ ALLEGRO_KEY_END ] = KEY_END;
KeyCodesTable[ ALLEGRO_KEY_PGUP ] = KEY_PAGEUP;
KeyCodesTable[ ALLEGRO_KEY_PGDN ] = KEY_PAGEDOWN;
KeyCodesTable[ ALLEGRO_KEY_LEFT ] = KEY_LEFT;
KeyCodesTable[ ALLEGRO_KEY_RIGHT ] = KEY_RIGHT;
KeyCodesTable[ ALLEGRO_KEY_UP ] = KEY_UP;
KeyCodesTable[ ALLEGRO_KEY_DOWN ] = KEY_DOWN;
KeyCodesTable[ ALLEGRO_KEY_PAD_SLASH ] = KEY_KP_DIVIDE;
KeyCodesTable[ ALLEGRO_KEY_PAD_ASTERISK ] = KEY_KP_MULTIPLY;
KeyCodesTable[ ALLEGRO_KEY_PAD_MINUS ] = KEY_KP_MINUS;
KeyCodesTable[ ALLEGRO_KEY_PAD_PLUS ] = KEY_KP_PLUS;
//KeyCodesTable[ ALLEGRO_KEY_PAD_DELETE ] = KEY_KP_?;
KeyCodesTable[ ALLEGRO_KEY_PAD_ENTER ] = KEY_KP_ENTER;
KeyCodesTable[ ALLEGRO_KEY_PRINTSCREEN ] = KEY_PRINT;
KeyCodesTable[ ALLEGRO_KEY_PAUSE ] = KEY_PAUSE;
//KeyCodesTable[ ALLEGRO_KEY_ABNT_C1 ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_YEN ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_KANA ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_CONVERT ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_NOCONVERT ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_AT ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_CIRCUMFLEX ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_COLON2 ] = KEY_KP_?;
//KeyCodesTable[ ALLEGRO_KEY_KANJI ] = KEY_KP_?;
KeyCodesTable[ ALLEGRO_KEY_PAD_EQUALS ] = KEY_KP_EQUALS;
KeyCodesTable[ ALLEGRO_KEY_BACKQUOTE ] = KEY_BACKQUOTE;
//KeyCodesTable[ ALLEGRO_KEY_SEMICOLON2 ] = KEY_?;
//KeyCodesTable[ ALLEGRO_KEY_COMMAND ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_UNKNOWN ] = KEY_UNKNOWN;
KeyCodesTable[ ALLEGRO_KEY_LSHIFT ] = KEY_LSHIFT;
KeyCodesTable[ ALLEGRO_KEY_RSHIFT ] = KEY_RSHIFT;
KeyCodesTable[ ALLEGRO_KEY_LCTRL ] = KEY_LCTRL;
KeyCodesTable[ ALLEGRO_KEY_RCTRL ] = KEY_RCTRL;
KeyCodesTable[ ALLEGRO_KEY_ALT ] = KEY_LALT;
KeyCodesTable[ ALLEGRO_KEY_ALTGR ] = KEY_MODE; //KEY_RALT;
KeyCodesTable[ ALLEGRO_KEY_LWIN ] = KEY_LSUPER;
KeyCodesTable[ ALLEGRO_KEY_RWIN ] = KEY_RSUPER;
//KeyCodesTable[ ALLEGRO_KEY_MENU ] = KEY_?;
KeyCodesTable[ ALLEGRO_KEY_SCROLLLOCK ] = KEY_SCROLLOCK;
KeyCodesTable[ ALLEGRO_KEY_NUMLOCK ] = KEY_NUMLOCK;
KeyCodesTable[ ALLEGRO_KEY_CAPSLOCK ] = KEY_CAPSLOCK;
KeyCodesTableInit = true;
}
Uint32 cInputAl::SetMod( Uint32 Mod ) {

View File

@@ -41,8 +41,6 @@ class EE_API cInputAl : public cInput {
Uint32 SetMod( Uint32 Mod );
Uint32 mKeyCodesTable[ ALLEGRO_KEY_MAX ];
Int32 mZ;
};

View File

@@ -439,6 +439,13 @@ void cWindow::Maximize() {
mPlatform->MaximizeWindow();
}
bool cWindow::IsMaximized() {
if ( NULL != mPlatform )
return mPlatform->IsWindowMaximized();
return false;
}
void cWindow::Hide() {
if ( NULL != mPlatform )
mPlatform->HideWindow();

View File

@@ -16,6 +16,10 @@ void cNullImpl::MinimizeWindow() {
void cNullImpl::MaximizeWindow() {
}
bool cNullImpl::IsWindowMaximized() {
return false;
}
void cNullImpl::HideWindow() {
}

View File

@@ -18,6 +18,8 @@ class cNullImpl : public cPlatformImpl {
void MaximizeWindow();
bool IsWindowMaximized();
void HideWindow();
void RaiseWindow();

View File

@@ -20,6 +20,10 @@ void cOSXImpl::MinimizeWindow() {
void cOSXImpl::MaximizeWindow() {
}
bool cOSXImpl::IsWindowMaximized() {
return false;
}
void cOSXImpl::HideWindow() {
}

View File

@@ -21,6 +21,8 @@ class cOSXImpl : public cPlatformImpl {
void MaximizeWindow();
bool IsWindowMaximized();
void HideWindow();
void RaiseWindow();

View File

@@ -39,6 +39,10 @@ void cWinImpl::MaximizeWindow() {
WIN_ShowWindow( mHandler, SW_MAXIMIZE );
}
bool cWinImpl::IsWindowMaximized() {
return 0 != IsZoomed( mHandler );
}
void cWinImpl::HideWindow() {
WIN_ShowWindow( mHandler, SW_HIDE );
}

View File

@@ -21,6 +21,8 @@ class cWinImpl : public cPlatformImpl {
void MaximizeWindow();
bool IsWindowMaximized();
void HideWindow();
void RaiseWindow();

View File

@@ -5,9 +5,11 @@
#include <eepp/helper/glew/glxew.h>
#include <X11/Xcursor/Xcursor.h>
#include <X11/cursorfont.h>
#include <climits>
#undef Window
#undef Display
#undef Cursor
#define XAtom(str) XInternAtom( mDisplay, str, False )
#include <eepp/window/platform/x11/cx11impl.hpp>
#include <eepp/window/platform/x11/ccursorx11.hpp>
@@ -53,9 +55,9 @@ void cX11Impl::MaximizeWindow() {
Lock();
XEvent xev;
Atom wm_state = XInternAtom( mDisplay, "_NET_WM_STATE", False);
Atom maximizeV = XInternAtom( mDisplay, "_NET_WM_STATE_MAXIMIZED_VERT", False);
Atom maximizeH = XInternAtom( mDisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
Atom wm_state = XAtom( "_NET_WM_STATE" );
Atom maximizeV = XAtom( "_NET_WM_STATE_MAXIMIZED_VERT" );
Atom maximizeH = XAtom( "_NET_WM_STATE_MAXIMIZED_HORZ" );
memset( &xev, 0, sizeof(xev) );
xev.type = ClientMessage;
@@ -73,6 +75,58 @@ void cX11Impl::MaximizeWindow() {
Unlock();
}
bool cX11Impl::IsWindowMaximized() {
Lock();
//bool minimized = false;
bool maximizedhorz = false;
bool maximizedvert = false;
Atom type;
int format;
unsigned long numitems, bytesafter;
unsigned char * properties = 0;
XGetWindowProperty( mDisplay,
mX11Window,
XAtom("_NET_WM_STATE"),
0,
LONG_MAX,
false,
AnyPropertyType,
&type,
&format,
&numitems,
&bytesafter, &properties
);
if( properties && ( format == 32 ) ) {
for(unsigned int i = 0; i < numitems; ++i) {
const Atom prop = (reinterpret_cast<ulong *>(properties))[i];
if (prop == XAtom("_NET_WM_STATE_MAXIMIZED_HORZ"))
maximizedhorz = true;
if (prop == XAtom("_NET_WM_STATE_MAXIMIZED_VERT"))
maximizedvert = true;
/*if (prop == XAtom("_NET_WM_STATE_HIDDEN"))
minimized = true;*/
}
}
XFree(properties);
XFlush(mDisplay);
Unlock();
if( maximizedhorz && maximizedvert ) {
return true;
}
return false;
}
void cX11Impl::HideWindow() {
Lock();

View File

@@ -24,6 +24,8 @@ class cX11Impl : public cPlatformImpl {
void MaximizeWindow();
bool IsWindowMaximized();
void HideWindow();
void RaiseWindow();

View File

@@ -142,7 +142,7 @@ void cEETest::CreateAquaTextureAtlas() {
return;
#endif
std::string tgpath( MyPath + "data/aquatg/aqua" );
std::string tgpath( MyPath + "data/aquata/aqua" );
std::string Path( MyPath + "data/aqua" );
if ( !FileSystem::FileExists( tgpath + EE_TEXTURE_ATLAS_EXTENSION ) ) {
@@ -258,7 +258,7 @@ void cEETest::CreateUI() {
//mTheme = cUITheme::LoadFromPath( eeNew( cUIAquaTheme, ( "aqua", "aqua" ) ), MyPath + "data/aqua/" );
cTextureAtlasLoader tgl( MyPath + "data/aquatg/aqua" + EE_TEXTURE_ATLAS_EXTENSION );
cTextureAtlasLoader tgl( MyPath + "data/aquata/aqua" + EE_TEXTURE_ATLAS_EXTENSION );
tgl.GetTexture()->TextureFilter( TEX_FILTER_NEAREST );
mTheme = cUITheme::LoadFromTextureAtlas( eeNew( cUIAquaTheme, ( "aqua", "aqua" ) ), cTextureAtlasManager::instance()->GetByName( "aqua" ) );
@@ -1335,8 +1335,10 @@ void cEETest::Input() {
if ( KM->AltPressed() && KM->IsKeyUp( KEY_C ) )
mWindow->Center();
if ( KM->AltPressed() && KM->IsKeyUp( KEY_M ) && !Con.Active() )
mWindow->Maximize();
if ( KM->AltPressed() && KM->IsKeyUp( KEY_M ) && !Con.Active() ) {
if ( !mWindow->IsMaximized() )
mWindow->Maximize();
}
if ( KM->IsKeyUp(KEY_F4) )
TF->ReloadAllTextures();