My Project
|
The default ParaEngine Window. More...
#include <D3DWindowDefault.h>
Public Types | |
typedef boost::shared_ptr< boost::thread > | Boost_Thread_ptr_type |
Public Member Functions | |
HRESULT | StartWindowThread (HINSTANCE hInstance) |
create the default win32 windows for rendering. More... | |
void | DefaultWinThreadProc (HINSTANCE hInstance) |
void | handle_mainloop_timer (const boost::system::error_code &err) |
int | Run (HINSTANCE hInstance) |
void | SetAppInterface (IParaEngineApp *pApp) |
IParaEngineApp * | GetAppInterface () |
int | CalculateRenderTime (double fIdealInterval, double *pNextInterval) |
return true if this is a render tick, otherwise false. More... | |
The default ParaEngine Window.
It can used as an example of how to write main game loop using ParaEngine library.
e.g.
CD3DWindowDefault defaultWin; defaultWin.SetAppInterface(CParaEngineApp::GetInstance());
return defaultWin.Run(hInstance);
int ParaEngine::CD3DWindowDefault::CalculateRenderTime | ( | double | fIdealInterval, |
double * | pNextInterval | ||
) |
return true if this is a render tick, otherwise false.
fIdealInterval | the ideal interval (FPS) when this function will return true at ideal FPS. |
pNextInterval | main_loop timer interval. |
tricky: run the main_loop as fast as possible at least 100FPS, so that FPS is more accurate.
define to output interval to log file to change timer implementation.
HRESULT CD3DWindowDefault::StartWindowThread | ( | HINSTANCE | hInstance | ) |
create the default win32 windows for rendering.
and assigning to m_hWnd. window is created in another thread. Since windows uses single threaded apartment, the window procedure should also be in that thread.