My Project
Public Types | Public Member Functions | List of all members
ParaEngine::CD3DWindowDefault Class Reference

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)
 
IParaEngineAppGetAppInterface ()
 
int CalculateRenderTime (double fIdealInterval, double *pNextInterval)
 return true if this is a render tick, otherwise false. More...
 

Detailed Description

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);

Member Function Documentation

§ CalculateRenderTime()

int ParaEngine::CD3DWindowDefault::CalculateRenderTime ( double  fIdealInterval,
double *  pNextInterval 
)

return true if this is a render tick, otherwise false.

Parameters
fIdealIntervalthe ideal interval (FPS) when this function will return true at ideal FPS.
pNextIntervalmain_loop timer interval.
Returns
frameDelta. if this is bigger than 0, we will render a frame.

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.

§ StartWindowThread()

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.


The documentation for this class was generated from the following files: