added paddle 0 emulation for smartphones

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@927 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
knakos 2005-12-27 22:19:04 +00:00
parent 5a1210efa5
commit c68dd1bddd
1 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@
char *msg = NULL;
int EventHandlerState;
extern OSystemWinCE *theOSystem;
extern int paddlespeed;
int time(int dummy)
{
@ -140,6 +141,8 @@ DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y) { return; }
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
{
static int paddleres = 300000;
for (int i=0; i<MAX_KEYS+NUM_MOUSEKEYS; i++)
{
if (keycodes[0][i].state != keycodes[1][i].state)
@ -201,6 +204,18 @@ DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
return 1;
}
if ( ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->IsSmartphone() )
{
if (keycodes[0][K_RIGHT].state == 1 && paddleres > 200000)
paddleres -= paddlespeed;
else if (keycodes[0][K_LEFT].state == 1 && paddleres < 900000)
paddleres += paddlespeed;
theOSystem->eventHandler().event()->set(Event::PaddleZeroResistance, paddleres);
theOSystem->eventHandler().event()->set(Event::PaddleZeroFire, keycodes[0][K_FIRE].state);
}
}
event->type = SDL_NOEVENT;
return 0;