simplified the code due to recent changes in the core and port approaches.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1303 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
knakos 2007-01-23 09:43:38 +00:00
parent 6155d71dbd
commit 36ab14c1d1
2 changed files with 17 additions and 60 deletions

View File

@ -14,7 +14,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// Windows CE Port by Kostas Nakos
// $Id: OSystemWinCE.cxx,v 1.10 2007-01-18 16:26:05 knakos Exp $
// $Id: OSystemWinCE.cxx,v 1.11 2007-01-23 09:43:38 knakos Exp $
//============================================================================
#include <sstream>
@ -26,9 +26,6 @@
#include "SoundWinCE.hxx"
#include "FrameBufferWinCE.hxx"
extern void KeyCheck(void);
extern int EventHandlerState;
extern void KeySetMode(int);
extern bool RequestRefresh;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -59,19 +56,13 @@ void OSystemWinCE::mainLoop()
uInt32 frameTime = 0, numberOfFrames = 0;
uInt32 startTime, virtualTime, currentTime;
uInt8 lastkeyset;
virtualTime = GetTickCount();
frameTime = 0;
// Main game loop
MSG msg;
int laststate = -1;
if (!((FrameBufferWinCE *)myFrameBuffer)->IsSmartphoneLowRes())
{
lastkeyset = 0;
KeySetMode(1);
}
for(;;)
{
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
@ -84,11 +75,9 @@ void OSystemWinCE::mainLoop()
if (msg.message == WM_QUIT)
break;
if(myQuitLoop)
if (myQuitLoop)
break;
KeyCheck();
if (RequestRefresh)
{
RequestRefresh = false;
@ -97,29 +86,6 @@ void OSystemWinCE::mainLoop()
startTime = GetTickCount();
EventHandlerState = (int) myEventHandler->state();
if ((laststate != -1) && (laststate != EventHandlerState))
if (EventHandlerState!=2 && EventHandlerState!=3)
{
((FrameBufferWinCE *)myFrameBuffer)->wipescreen();
KeySetMode(lastkeyset);
}
else
{
if ( ((FrameBufferWinCE *)myFrameBuffer)->IsSmartphoneLowRes() )
{
KeySetMode(0);
((FrameBufferWinCE *)myFrameBuffer)->setmode(0);
}
else
{
lastkeyset = ((FrameBufferWinCE *)myFrameBuffer)->getmode();
if (lastkeyset == 0)
KeySetMode(1);
}
}
laststate = EventHandlerState;
myEventHandler->poll(startTime);
myFrameBuffer->update();
((SoundWinCE *)mySound)->update();
@ -135,20 +101,6 @@ void OSystemWinCE::mainLoop()
frameTime += currentTime;
++numberOfFrames;
}
/* {
double executionTime = (double) frameTime / 1000000.0;
double framesPerSecond = (double) numberOfFrames / executionTime;
ostringstream a;
a << endl;
a << numberOfFrames << " total frames drawn\n";
a << framesPerSecond << " frames/second\n";
a << endl;
TCHAR unicodeString[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, a.str().c_str(), strlen(a.str().c_str()) + 1, unicodeString, sizeof(unicodeString));
MessageBox(GetDesktopWindow(),unicodeString, _T("..."),0);
}
*/
}
uInt32 OSystemWinCE::getTicks(void)
@ -156,10 +108,17 @@ uInt32 OSystemWinCE::getTicks(void)
return GetTickCount();
}
inline const GUI::Font& OSystemWinCE::launcherFont() const
void OSystemWinCE::getScreenDimensions(int& width, int& height)
{
if ( ((FrameBufferWinCE *)myFrameBuffer)->IsSmartphoneLowRes() )
return consoleFont();
// do not use the framebuffer issmartphonelowres method as the framebuffer has not been created yet
if ((unsigned int) GetSystemMetrics(SM_CXSCREEN) != 176 )
{
width = 320;
height = 240;
}
else
return OSystem::font();
}
{
width = 220;
height = 176;
}
}

View File

@ -14,6 +14,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// Windows CE Port by Kostas Nakos
// $Id: OSystemWinCE.hxx,v 1.9 2007-01-23 09:43:38 knakos Exp $
//============================================================================
#ifndef OSYSTEM_WINCE_HXX
@ -32,10 +33,7 @@ class OSystemWinCE : public OSystem
virtual void mainLoop();
virtual uInt32 getTicks(void);
virtual void setFramerate(uInt32 framerate);
// ok, we lie a bit to Stephen here, but it's for a good purpose :)
// we can always display these resolutions anyway
virtual void getScreenDimensions(int& width, int& height) { width = 320; height = 240; };
inline const GUI::Font& launcherFont() const;
virtual void getScreenDimensions(int& width, int& height);
};
#endif