mirror of https://github.com/stella-emu/stella.git
added key rotation
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1304 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
36ab14c1d1
commit
07a76c1921
|
@ -14,7 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: PocketStella.cpp,v 1.8 2007-01-21 20:10:50 knakos Exp $
|
||||
// $Id: PocketStella.cpp,v 1.9 2007-01-23 09:44:55 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <queue>
|
||||
|
@ -26,16 +26,15 @@
|
|||
#include "FrameBufferWinCE.hxx"
|
||||
|
||||
extern void KeySetup(void);
|
||||
extern void KeySetMode(int);
|
||||
extern queue <SDL_Event> eventqueue;
|
||||
extern int EventHandlerState;
|
||||
extern SDLKey RotateKey(SDLKey);
|
||||
|
||||
bool RequestRefresh = false;
|
||||
SDLKey VK_keymap[SDLK_LAST];
|
||||
|
||||
OSystemWinCE* theOSystem = (OSystemWinCE*) NULL;
|
||||
HWND hWnd;
|
||||
uInt16 rotkeystate = 0;
|
||||
bool rotkeystate = 0;
|
||||
|
||||
DWORD REG_bat, REG_ac, REG_disp, bat_timeout;
|
||||
|
||||
|
@ -51,21 +50,27 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
if (wParam == VK_F3)
|
||||
{
|
||||
if (rotkeystate == 0 && theOSystem)
|
||||
if (theOSystem->eventHandler().state() == 1)
|
||||
KeySetMode( ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->rotatedisplay() );
|
||||
rotkeystate = 1;
|
||||
if (theOSystem->eventHandler().state() == EventHandler::S_EMULATE)
|
||||
((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->rotatedisplay();
|
||||
rotkeystate = true;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
rotkeystate = 0;
|
||||
rotkeystate = false;
|
||||
e.key.type = SDL_KEYDOWN;
|
||||
e.key.keysym.sym = VK_keymap[wParam];
|
||||
e.key.keysym.sym = RotateKey(VK_keymap[wParam]);
|
||||
e.key.keysym.mod = (SDLMod) 0;
|
||||
eventqueue.push(e);
|
||||
return 0;
|
||||
|
||||
case WM_KEYUP:
|
||||
if (wParam == VK_F3 && rotkeystate)
|
||||
{
|
||||
rotkeystate = false;
|
||||
return 0;
|
||||
}
|
||||
e.key.type = SDL_KEYUP;
|
||||
e.key.keysym.sym = VK_keymap[wParam];
|
||||
e.key.keysym.sym = RotateKey(VK_keymap[wParam]);
|
||||
e.key.keysym.mod = (SDLMod) 0;
|
||||
eventqueue.push(e);
|
||||
return 0;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: missing.cpp,v 1.8 2007-01-21 20:10:50 knakos Exp $
|
||||
// $Id: missing.cpp,v 1.9 2007-01-23 09:44:55 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <queue>
|
||||
|
@ -25,7 +25,6 @@
|
|||
#include "EventHandler.hxx"
|
||||
|
||||
char *msg = NULL;
|
||||
int EventHandlerState;
|
||||
extern OSystemWinCE *theOSystem;
|
||||
extern SDLKey VK_keymap[SDLK_LAST];
|
||||
|
||||
|
@ -51,37 +50,56 @@ char *getcwd(void)
|
|||
return cwd;
|
||||
}
|
||||
|
||||
void KeySetMode(int mode)
|
||||
SDLKey RotateKey(SDLKey key)
|
||||
{
|
||||
/* GXKeyList klist = GXGetDefaultKeys(GX_NORMALKEYS);
|
||||
uInt8 dir = 0;
|
||||
uInt8 mode = ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->getmode();
|
||||
uInt8 state = theOSystem->eventHandler().state();
|
||||
bool lscp = ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->IsLandscape();
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
if (!(lscp && mode == 0))
|
||||
if (state != EventHandler::S_EMULATE)
|
||||
if (mode != 2)
|
||||
dir = 1;
|
||||
else
|
||||
dir = 2;
|
||||
else
|
||||
dir = mode;
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
switch (mode)
|
||||
case 0:
|
||||
return key;
|
||||
|
||||
case 1:
|
||||
switch (key)
|
||||
{
|
||||
case 0:
|
||||
keycodes[i][K_UP].keycode = klist.vkUp;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkDown;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkLeft;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkRight;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
keycodes[i][K_UP].keycode = klist.vkRight;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkLeft;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkUp;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkDown;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
keycodes[i][K_UP].keycode = klist.vkLeft;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkRight;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkDown;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkUp;
|
||||
break;
|
||||
|
||||
case SDLK_LEFT:
|
||||
return SDLK_UP;
|
||||
case SDLK_DOWN:
|
||||
return SDLK_LEFT;
|
||||
case SDLK_RIGHT:
|
||||
return SDLK_DOWN;
|
||||
case SDLK_UP:
|
||||
return SDLK_RIGHT;
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
|
||||
case 2:
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_LEFT:
|
||||
return SDLK_DOWN;
|
||||
case SDLK_DOWN:
|
||||
return SDLK_RIGHT;
|
||||
case SDLK_RIGHT:
|
||||
return SDLK_UP;
|
||||
case SDLK_UP:
|
||||
return SDLK_LEFT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
void KeySetup(void)
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2006 by Bradford W. Mott and the Stella team
|
||||
// Copyright (c) 1995-2007 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// Windows CE Port by Kostas Nakos
|
||||
// $Id: missing.h,v 1.6 2007-01-23 09:44:55 knakos Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef _WCE_MISSING_H_
|
||||
|
@ -40,9 +41,4 @@ typedef unsigned int uintptr_t;
|
|||
int time(int dummy);
|
||||
char *getcwd(void);
|
||||
|
||||
|
||||
#define MAX_KEYS 8
|
||||
#define NUM_MOUSEKEYS 2
|
||||
enum key {K_UP = 0, K_DOWN, K_LEFT, K_RIGHT, K_FIRE, K_RESET, K_SELECT, K_QUIT, M_POS, M_BUT};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue