My Project
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ParaEngine::CParaEngineAppBase Class Reference
Inheritance diagram for ParaEngine::CParaEngineAppBase:
ParaEngine::IParaEngineApp ParaEngine::CCommandLineParams ParaEngine::IObject ParaEngine::BaseInterface ParaEngine::CRefCounted ParaEngine::InterfaceServer ParaEngine::CParaEngineApp ParaEngine::CParaEngineApp ParaEngine::CParaEngineApp

Public Member Functions

 CParaEngineAppBase (const char *sCmd)
 
virtual LifetimeType LifetimeControl ()
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual void OnFrameEnded ()
 call this function at the end of the frame. More...
 
void DoTestCode ()
 
virtual void WriteToLog (const char *sFormat,...)
 append text to log file. More...
 
virtual void AppLog (const char *sFormat)
 write app log to file with time and code location. More...
 
virtual bool FindParaEngineDirectory (const char *sHint=NULL)
 set the current working directory. More...
 
void AutoSetLocale ()
 
virtual void Enable3DRendering (bool bEnable)
 disable 3D rendering, do not present the scene. More...
 
virtual bool Is3DRenderingEnabled ()
 whether 3D rendering is enabled, do not present the scene. More...
 
virtual bool IsTouchInputting ()
 whether the last mouse input is from touch or mouse. More...
 
virtual void SetTouchInputting (bool bTouchInputting)
 whether the last mouse input is from touch or mouse. More...
 
virtual bool IsSlateMode ()
 
virtual int32 GetTouchPointX ()
 obsoleted function:
 
virtual int32 GetTouchPointY ()
 
virtual void GetCursorPosition (int *pX, int *pY, bool bInBackbuffer=true)
 get the current mouse cursor position. More...
 
virtual void GameToClient (int &inout_x, int &inout_y, bool bInBackbuffer=true)
 translate a position from game coordination system to client window position. More...
 
virtual void ClientToGame (int &inout_x, int &inout_y, bool bInBackbuffer=true)
 translate a position from client window position to game coordination system. More...
 
virtual void SetIgnoreWindowSizeChange (bool bIgnoreSizeChange)
 switch to ignore windows size change. More...
 
virtual bool GetIgnoreWindowSizeChange ()
 return true if it is currently under windowed mode. More...
 
virtual HINSTANCE GetModuleHandle ()
 get the module handle, it may be exe or the dll handle, depending on how the main host app is built. More...
 
virtual void SetRefreshTimer (float fTimeInterval, int nFrameRateControl=0)
 Set the frame rate timer interval. More...
 
virtual float GetRefreshTimer ()
 get the refresh timer.
 
virtual void ActivateApp (bool bActivate)
 this function is called whenever the application is disabled or enabled. More...
 
virtual bool IsAppActive ()
 whether the application is active or not. More...
 
virtual DWORD GetCoreUsage ()
 Get the current ParaEngine app usage. More...
 
virtual void SetCoreUsage (DWORD dwUsage)
 Set the current ParaEngine app usage. More...
 
virtual void SetReturnCode (int nReturnCode)
 Get the exit code that will be used when the standalone executable exit. More...
 
virtual int GetReturnCode ()
 
virtual void SystemMessageBox (const std::string &msg)
 show a system message box to the user. More...
 
virtual void SetAppCommandLine (const char *pCommandLine)
 set string specifying the command line for the application, excluding the program name. More...
 
virtual const char * GetAppCommandLine ()
 get string specifying the command line for the application, excluding the program name. More...
 
virtual const char * GetAppCommandLineByParam (const char *pParam, const char *defaultValue)
 return a specified parameter value in the command line of the application. More...
 
virtual HRESULT StartApp (const char *sCommandLine=0)
 This is the first function that should be called when acquiring the IParaEngineApp interface. More...
 
virtual HRESULT StopApp ()
 This is the last function that should be called. More...
 
virtual HRESULT Init (HWND *pHWND)
 init application
 
virtual void Exit (int nReturnCode=0)
 Send the exit message, so that the game engine will prepare to exit in the next frame. More...
 
virtual ParaEngine::PEAppState GetAppState ()
 get application state
 
virtual void SetAppState (ParaEngine::PEAppState state)
 set application state
 
virtual HRESULT FrameMove (double fTime)
 
virtual HRESULT FinalCleanup ()
 This function should be called only once when the application end, one can destroy game objects here.
 
virtual void SetMainWindow (HWND hWnd, bool bIsExternalWindow=true)
 set the hWnd on to which we will render and process window messages. More...
 
virtual HWND GetMainWindow ()
 
virtual int Run (HINSTANCE hInstance)
 only call this function if one does not want to manage game loop externally. More...
 
virtual HRESULT DoWork ()
 this function is called per frame, in most cases, it will render the 3d scene and frame move. More...
 
virtual HRESULT CreateFromD3D9Device (IDirect3DDevice9 *pD3dDevice, IDirect3DSwapChain9 *apSwapChain)
 create from an existing d3d device. More...
 
virtual HRESULT InitDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has been created, which will happen during application initialization and windowed/full screen toggles. More...
 
virtual HRESULT RestoreDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has been reset, which will happen after a lost device scenario. More...
 
virtual HRESULT InvalidateDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has entered a lost state and before IDirect3DDevice9::Reset is called. More...
 
virtual HRESULT DeleteDeviceObjects ()
 This callback function will be called immediately after the Direct3D device has been destroyed, which generally happens as a result of application termination or windowed/full screen toggles. More...
 
virtual HRESULT Create (HINSTANCE hInstance=0)
 create d3d render device based on the current main window. More...
 
virtual HRESULT Render3DEnvironment (bool bForceRender=false)
 Frame move and render a frame during idle time (no messages are waiting). More...
 
virtual LRESULT MsgProcWinThread (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool bCallDefProcedure=true)
 the window message processor. More...
 
virtual LRESULT MsgProcWinThreadCustom (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
virtual LRESULT SendMessageToApp (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 Send a RAW win32 message the application to be processed in the next main thread update interval. More...
 
virtual bool PostWinThreadMessage (UINT uMsg, WPARAM wParam, LPARAM lParam)
 post a raw win32 message from any thread to the thread on which hWnd is created. More...
 
virtual bool GetMessageFromApp (CWinRawMsg *pMsg)
 get a message from the application message queue and remove it from the queue. More...
 
virtual LRESULT MsgProcApp (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 handle a message in the main application thread.
 
virtual void EnablePassiveRendering (bool bEnable)
 passive rendering, it will not render the scene, but simulation and time remains the same. More...
 
virtual bool IsPassiveRenderingEnabled ()
 passive rendering, it will not render the scene, but simulation and time remains the same. More...
 
virtual void BringWindowToTop ()
 The BringWindowToTop current window to the top of the Z order. More...
 
virtual void SetAllowWindowClosing (bool bAllowClosing)
 whether the user can close the window (sending WM_CLOSE message). More...
 
virtual bool IsWindowClosingAllowed ()
 
virtual void SetFullScreenMode (bool bFullscreen)
 whether to use full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device. More...
 
virtual bool IsFullScreenMode ()
 
virtual void ShowMenu (bool bShow)
 turn on/off menu
 
virtual void GetScreenResolution (Vector2 *pOut)
 change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device. More...
 
virtual void SetScreenResolution (const Vector2 &vSize)
 
virtual int GetMultiSampleType ()
 anti-aliasing for both windowed and full screen mode. More...
 
virtual void SetMultiSampleType (int nType)
 
virtual int GetMultiSampleQuality ()
 anti-aliasing for both windowed and full screen mode. More...
 
virtual void SetMultiSampleQuality (int nType)
 
virtual bool UpdateScreenMode ()
 call this function to update changes of FullScreen Mode and Screen Resolution. More...
 
virtual bool SetWindowedMode (bool bWindowed)
 switch to either windowed mode or full screen mode. More...
 
virtual bool IsWindowedMode ()
 return true if it is currently under windowed mode. More...
 
virtual void SetWindowText (const char *pChar)
 set the window title when at windowed mode
 
virtual const char * GetWindowText ()
 get the window title when at windowed mode
 
virtual void FixWindowSize (bool fixed)
 
virtual void WriteConfigFile (const char *sFileName)
 write the current setting to config file. More...
 
virtual bool HasNewConfig ()
 get whether ParaEngine is loaded from config/config.new.txt. More...
 
virtual void SetHasNewConfig (bool bHasNewConfig)
 set whether ParaEngine is loaded from config/config.new.txt. More...
 
virtual void GetWindowCreationSize (int *pWidth, int *pHeight)
 get the window creation size in default application config. More...
 
virtual void SetMinUIResolution (int nWidth, int nHeight, bool bAutoUIScaling=true)
 set the minimum UI resolution size. More...
 
virtual void GetResolution (float *pX, float *pY)
 change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device. More...
 
virtual void SetResolution (float x, float y)
 
virtual NPL::INPLRuntimeGetNPLRuntime ()
 get the NPL runtime system associate with the application. More...
 
virtual CRefCountedAddToSingletonReleasePool (CRefCounted *pObject)
 we will automatically release singleton object when app stops, in the verse order when object is added to the pool.
 
virtual bool HasClosingRequest ()
 whether there is closing request in the message queue. More...
 
virtual void SetHasClosingRequest (bool val)
 
virtual bool LoadNPLPackage (const char *sFilePath, std::string *pOutMainFile=NULL)
 load NPL package from a disk folder. More...
 
virtual bool FindBootStrapper ()
 check if there is bootstrapper file specified at command line, if not it will use NPL code wiki admin app.
 
virtual bool InitCommandLineParams ()
 parse common command line parameters
 
virtual bool ForceRender ()
 render the current frame and does not return until everything is presented to screen. More...
 
virtual const char * GetModuleDir ()
 get the NPL bin directory (main executable directory). More...
 
CViewportManagerGetViewportManager ()
 managing multiple 3d views
 
virtual void VerifyCommandLine (const char *sCommandLine, std::string &strCmd)
 
- Public Member Functions inherited from ParaEngine::IParaEngineApp
virtual float GetFPS ()
 
virtual bool IsServerMode ()
 server mode has no user interface
 
- Public Member Functions inherited from ParaEngine::BaseInterface
BaseInterfaceGetInterface (Interface_ID id)
 
virtual Interface_ID GetID ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from ParaEngine::CCommandLineParams
 CCommandLineParams (const char *lpCmdLine)
 
const char * GetAppCommandLine ()
 get string specifying the command line for the application, excluding the program name. More...
 
const char * GetAppCommandLineByParam (const char *pParam, const char *defaultValue)
 return a specified parameter value in the command line of the application. More...
 
void SetAppCommandLine (const char *pCommandLine)
 set string specifying the command line for the application, excluding the program name. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual void Clone (IObject *obj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 

Static Public Member Functions

static CParaEngineAppGetInstance ()
 the singleton application. More...
 
static void SetCurrentInstance (CParaEngineApp *pInstance)
 

Protected Member Functions

void InitCommon ()
 shared init called in constructor. More...
 
void DestroySingletons ()
 
void LoadPackages ()
 we will load all packages that matches the following pattern in the order given by their name, such that "main_001.pkg" is always loaded before "main_002.pkg" we will skip packages *_32bits.pkg when in 64bits; and skip *_64bits.pkg in 32bits; packages without above suffix will be loaded in both version.
 
void LoadPackagesInFolder (const std::string &sPkgFolder)
 
void RegisterObjectClass (IAttributeFields *pObject)
 register a given class. More...
 
void RegisterObjectClasses ()
 register any custom classes
 

Protected Attributes

bool m_bEnable3DRendering
 
bool m_isTouching
 
bool m_hasClosingRequest
 
int m_nReturnCode
 the application exit code or return code. More...
 
CObjectAutoReleasePoolm_pSingletonReleasePool
 a pool of registered singleton object. More...
 
std::string m_sPackagesDir
 packages/ directory path
 
std::string m_sModuleDir
 bin/ module path
 
std::string m_sInitialWorkingDir
 initial working directory
 
PEAppState m_nAppState
 application state
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Static Protected Attributes

static CParaEngineAppg_pCurrentApp = NULL
 

Additional Inherited Members

- Public Types inherited from ParaEngine::BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 

Member Function Documentation

§ ActivateApp()

virtual void ParaEngine::CParaEngineAppBase::ActivateApp ( bool  bActivate)
inlinevirtual

this function is called whenever the application is disabled or enabled.

usually called when receiving the WM_ACTIVATEAPP message. [main thread only]

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ AppLog()

void CParaEngineAppBase::AppLog ( const char *  sMessage)
virtual

write app log to file with time and code location.

Reimplemented from ParaEngine::IParaEngineApp.

§ BringWindowToTop()

virtual void ParaEngine::CParaEngineAppBase::BringWindowToTop ( )
inlinevirtual

The BringWindowToTop current window to the top of the Z order.

This function only works if IsFullScreenMode() is false.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ ClientToGame()

virtual void ParaEngine::CParaEngineAppBase::ClientToGame ( int &  inout_x,
int &  inout_y,
bool  bInBackbuffer = true 
)
inlinevirtual

translate a position from client window position to game coordination system.

Parameters
inout_xin and out
inout_yin and out
bInBackbufferif true, it will scale the output according to the ratio of back buffer and current window size.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ Create()

virtual HRESULT ParaEngine::CParaEngineAppBase::Create ( HINSTANCE  hInstance = 0)
inlinevirtual

create d3d render device based on the current main window.

Use this function to create a new render device automatically.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ CreateFromD3D9Device()

virtual HRESULT ParaEngine::CParaEngineAppBase::CreateFromD3D9Device ( IDirect3DDevice9 *  pD3dDevice,
IDirect3DSwapChain9 *  apSwapChain 
)
inlinevirtual

create from an existing d3d device.

This is an advanced function to replaced the default render device. and caller is responsible for managing device life time. The external caller must call InitDeviceObjects(), RestoreDeviceObjects(), InvalidateDeviceObjects(), DeleteDeviceObjects() at proper time

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ DeleteDeviceObjects()

virtual HRESULT ParaEngine::CParaEngineAppBase::DeleteDeviceObjects ( )
inlinevirtual

This callback function will be called immediately after the Direct3D device has been destroyed, which generally happens as a result of application termination or windowed/full screen toggles.

Resources created in the OnCreateDevice callback should be released here, which generally includes all D3DPOOL_MANAGED resources.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ DoWork()

virtual HRESULT ParaEngine::CParaEngineAppBase::DoWork ( )
inlinevirtual

this function is called per frame, in most cases, it will render the 3d scene and frame move.

call this as often as one like internally it will use a timer to best fit the interval.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Enable3DRendering()

void ParaEngine::CParaEngineAppBase::Enable3DRendering ( bool  bEnable)
virtual

disable 3D rendering, do not present the scene.

This is usually called before and after we show a standard win32 window during full screen mode, such as displaying a flash window

Parameters
bEnabletrue to enable.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ EnablePassiveRendering()

virtual void ParaEngine::CParaEngineAppBase::EnablePassiveRendering ( bool  bEnable)
inlinevirtual

passive rendering, it will not render the scene, but simulation and time remains the same.

Default is false

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Exit()

void ParaEngine::CParaEngineAppBase::Exit ( int  nReturnCode = 0)
virtual

Send the exit message, so that the game engine will prepare to exit in the next frame.

this is the recommended way of exiting application. this is mainly used for writing test cases. Where a return value of 0 means success, any other value means failure.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ FindParaEngineDirectory()

bool CParaEngineAppBase::FindParaEngineDirectory ( const char *  sHint = NULL)
virtual

set the current working directory.

This function is called in the constructor to ensure that all IO directs to the right dir.

§ ForceRender()

bool ParaEngine::CParaEngineAppBase::ForceRender ( )
virtual

render the current frame and does not return until everything is presented to screen.

this function is usually used to draw the animated loading screen.

Reimplemented from ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GameToClient()

virtual void ParaEngine::CParaEngineAppBase::GameToClient ( int &  inout_x,
int &  inout_y,
bool  bInBackbuffer = true 
)
inlinevirtual

translate a position from game coordination system to client window position.

Parameters
inout_xin and out
inout_yin and out
bInBackbufferif true, it will scale the output according to the ratio of back buffer and current window size.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetAppCommandLine()

const char * ParaEngine::CParaEngineAppBase::GetAppCommandLine ( )
virtual

get string specifying the command line for the application, excluding the program name.

Reimplemented from ParaEngine::IParaEngineApp.

§ GetAppCommandLineByParam()

const char * ParaEngine::CParaEngineAppBase::GetAppCommandLineByParam ( const char *  pParam,
const char *  defaultValue 
)
virtual

return a specified parameter value in the command line of the application.

If the parameter does not exist, the return value is NULL.

Parameters
pParamkey to get
defaultValueif the key does not exist, this value will be added and returned. This can be NULL.

Reimplemented from ParaEngine::IParaEngineApp.

§ GetCoreUsage()

DWORD ParaEngine::CParaEngineAppBase::GetCoreUsage ( )
virtual

Get the current ParaEngine app usage.

[main thread only]

Returns
see PE_USAGE

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetCursorPosition()

void ParaEngine::CParaEngineAppBase::GetCursorPosition ( int *  pX,
int *  pY,
bool  bInBackbuffer = true 
)
virtual

get the current mouse cursor position.

Parameters
pXout
pYout
bInBackbufferif true, it will scale the output according to the ratio of back buffer and current window size.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetIgnoreWindowSizeChange()

virtual bool ParaEngine::CParaEngineAppBase::GetIgnoreWindowSizeChange ( )
inlinevirtual

return true if it is currently under windowed mode.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetInstance()

CParaEngineApp * ParaEngine::CParaEngineAppBase::GetInstance ( )
static

the singleton application.

§ GetMessageFromApp()

virtual bool ParaEngine::CParaEngineAppBase::GetMessageFromApp ( CWinRawMsg pMsg)
inlinevirtual

get a message from the application message queue and remove it from the queue.

This function is mostly used internally by the main thread.

Parameters
pMsgthe receiving message
Returns
true if one message is fetched. or false if there is no more messages in the queue.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetModuleDir()

const char * ParaEngine::CParaEngineAppBase::GetModuleDir ( )
virtual

get the NPL bin directory (main executable directory).

this one ends with "/"

Reimplemented from ParaEngine::IParaEngineApp.

§ GetModuleHandle()

virtual HINSTANCE ParaEngine::CParaEngineAppBase::GetModuleHandle ( )
inlinevirtual

get the module handle, it may be exe or the dll handle, depending on how the main host app is built.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetMultiSampleQuality()

virtual int ParaEngine::CParaEngineAppBase::GetMultiSampleQuality ( )
inlinevirtual

anti-aliasing for both windowed and full screen mode.

it does not immediately change the device, call UpdateScreenMode() to update the device.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetMultiSampleType()

virtual int ParaEngine::CParaEngineAppBase::GetMultiSampleType ( )
inlinevirtual

anti-aliasing for both windowed and full screen mode.

it does not immediately change the device, call UpdateScreenMode() to update the device.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetNPLRuntime()

NPL::INPLRuntime * ParaEngine::CParaEngineAppBase::GetNPLRuntime ( )
virtual

get the NPL runtime system associate with the application.

NPL provides communication framework across different language systems.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetResolution()

virtual void ParaEngine::CParaEngineAppBase::GetResolution ( float *  pX,
float *  pY 
)
inlinevirtual

change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetScreenResolution()

virtual void ParaEngine::CParaEngineAppBase::GetScreenResolution ( Vector2 pOut)
inlinevirtual

change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device.

Reimplemented from ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ GetWindowCreationSize()

virtual void ParaEngine::CParaEngineAppBase::GetWindowCreationSize ( int *  pWidth,
int *  pHeight 
)
inlinevirtual

get the window creation size in default application config.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ HasClosingRequest()

bool ParaEngine::CParaEngineAppBase::HasClosingRequest ( )
virtual

whether there is closing request in the message queue.

In windows, the user clicks the close button. For long running task in the main thread, it is recommended to periodically check this value to end the task prematurely if necessary.

Reimplemented from ParaEngine::IParaEngineApp.

§ HasNewConfig()

virtual bool ParaEngine::CParaEngineAppBase::HasNewConfig ( )
inlinevirtual

get whether ParaEngine is loaded from config/config.new.txt.

if this is true, we need to ask the user to save to config/config.txt. This is usually done at start up.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ InitCommon()

void ParaEngine::CParaEngineAppBase::InitCommon ( )
protected

shared init called in constructor.

§ InitDeviceObjects()

virtual HRESULT ParaEngine::CParaEngineAppBase::InitDeviceObjects ( )
inlinevirtual

This callback function will be called immediately after the Direct3D device has been created, which will happen during application initialization and windowed/full screen toggles.

This is the best location to create D3DPOOL_MANAGED resources since these resources need to be reloaded whenever the device is destroyed. Resources created here should be released in the OnDestroyDevice callback.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ InvalidateDeviceObjects()

virtual HRESULT ParaEngine::CParaEngineAppBase::InvalidateDeviceObjects ( )
inlinevirtual

This callback function will be called immediately after the Direct3D device has entered a lost state and before IDirect3DDevice9::Reset is called.

Resources created in the OnResetDevice callback should be released here, which generally includes all D3DPOOL_DEFAULT resources. See the "Lost Devices" section of the documentation for information about lost devices.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Is3DRenderingEnabled()

bool ParaEngine::CParaEngineAppBase::Is3DRenderingEnabled ( )
virtual

whether 3D rendering is enabled, do not present the scene.

This is usually called before and after we show a standard win32 window during full screen mode, such as displaying a flash window

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ IsAppActive()

bool ParaEngine::CParaEngineAppBase::IsAppActive ( )
virtual

whether the application is active or not.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ IsPassiveRenderingEnabled()

virtual bool ParaEngine::CParaEngineAppBase::IsPassiveRenderingEnabled ( )
inlinevirtual

passive rendering, it will not render the scene, but simulation and time remains the same.

Default is false

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ IsTouchInputting()

bool ParaEngine::CParaEngineAppBase::IsTouchInputting ( )
virtual

whether the last mouse input is from touch or mouse.

by default it is mouse mode.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ IsWindowedMode()

virtual bool ParaEngine::CParaEngineAppBase::IsWindowedMode ( )
inlinevirtual

return true if it is currently under windowed mode.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ LoadNPLPackage()

bool ParaEngine::CParaEngineAppBase::LoadNPLPackage ( const char *  sFilePath,
std::string *  pOutMainFile = NULL 
)
virtual

load NPL package from a disk folder.

it will first search the dev folder, then the current folder, and then the executable folder and all of its parent folders. Once the folder is found, it is added to the global search path.

Parameters
sFilePathfor example, "npl_packages/main/" is always loaded on start up.
pOutMainFileoutput of the actual folder name or a main loader file path in the main loader.

Reimplemented from ParaEngine::IParaEngineApp.

§ LoadPackagesInFolder()

void ParaEngine::CParaEngineAppBase::LoadPackagesInFolder ( const std::string &  sPkgFolder)
protected

we will load all packages that matches the following pattern in the order given by their name, such that "main_001.pkg" is always loaded before "main_002.pkg"

§ MsgProcWinThread()

virtual LRESULT ParaEngine::CParaEngineAppBase::MsgProcWinThread ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
bool  bCallDefProcedure = true 
)
inlinevirtual

the window message processor.

One needs send all messages belonging to the main window to this function, after calling Create().

Note
: the main rendering thread can be a different thread than the window proc thread.
Parameters
bCallDefProcedurewhether we will call the ::DefWindowProdure().
Returns
: 0 if message was not processed. 1 if message is processed. -1 if message is processed by can be passed on to other processor.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ OnFrameEnded()

void ParaEngine::CParaEngineAppBase::OnFrameEnded ( )
virtual

call this function at the end of the frame.

§ PostWinThreadMessage()

virtual bool ParaEngine::CParaEngineAppBase::PostWinThreadMessage ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inlinevirtual

post a raw win32 message from any thread to the thread on which hWnd is created.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ RegisterObjectClass()

void ParaEngine::CParaEngineAppBase::RegisterObjectClass ( IAttributeFields pObject)
protected

register a given class.

§ Render3DEnvironment()

virtual HRESULT ParaEngine::CParaEngineAppBase::Render3DEnvironment ( bool  bForceRender = false)
inlinevirtual

Frame move and render a frame during idle time (no messages are waiting).

Call this function during CPU idle time. internally it uses a timer to control frame rates, so it is safe to call this as often as one like.

Parameters
bForceRenderif true, it will force frame move and render the scene. if not, it will internally use a frame rate controller that maintain the frame rate at 30 fps, no matter who often this function is called.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ RestoreDeviceObjects()

virtual HRESULT ParaEngine::CParaEngineAppBase::RestoreDeviceObjects ( )
inlinevirtual

This callback function will be called immediately after the Direct3D device has been reset, which will happen after a lost device scenario.

This is the best location to create D3DPOOL_DEFAULT resources since these resources need to be reloaded whenever the device is lost. Resources created here should be released in the OnLostDevice callback.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Run()

virtual int ParaEngine::CParaEngineAppBase::Run ( HINSTANCE  hInstance)
inlinevirtual

only call this function if one does not want to manage game loop externally.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SendMessageToApp()

virtual LRESULT ParaEngine::CParaEngineAppBase::SendMessageToApp ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
inlinevirtual

Send a RAW win32 message the application to be processed in the next main thread update interval.

This function can be called from any thread. It is also used by the windows procedure thread to dispatch messages to the main processing thread.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetAllowWindowClosing()

virtual void ParaEngine::CParaEngineAppBase::SetAllowWindowClosing ( bool  bAllowClosing)
inlinevirtual

whether the user can close the window (sending WM_CLOSE message).

Default to true. When set to false, the scripting interface will receive WM_CLOSE message via system event. And can use ParaEngine.Exit() to quit the application after user confirmation, etc.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetAppCommandLine()

void ParaEngine::CParaEngineAppBase::SetAppCommandLine ( const char *  pCommandLine)
virtual

set string specifying the command line for the application, excluding the program name.

calling this function multiple times with different command line is permitted. The latter settings will merge and override the previous ones.

Parameters
pCommandLinesuch as key="value" key2="value2"

Reimplemented from ParaEngine::IParaEngineApp.

§ SetCoreUsage()

virtual void ParaEngine::CParaEngineAppBase::SetCoreUsage ( DWORD  dwUsage)
inlinevirtual

Set the current ParaEngine app usage.

[main thread only]

Parameters
dwUsagebitwise of PE_USAGE

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ SetFullScreenMode()

virtual void ParaEngine::CParaEngineAppBase::SetFullScreenMode ( bool  bFullscreen)
inlinevirtual

whether to use full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetHasNewConfig()

virtual void ParaEngine::CParaEngineAppBase::SetHasNewConfig ( bool  bHasNewConfig)
inlinevirtual

set whether ParaEngine is loaded from config/config.new.txt.

if this is true, we need to ask the user to save to config/config.txt. This is usually done at start up.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetIgnoreWindowSizeChange()

virtual void ParaEngine::CParaEngineAppBase::SetIgnoreWindowSizeChange ( bool  bIgnoreSizeChange)
inlinevirtual

switch to ignore windows size change.

default to false. if false, the user is allowed to adjust window size in windowed mode.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp.

§ SetMainWindow()

virtual void ParaEngine::CParaEngineAppBase::SetMainWindow ( HWND  hWnd,
bool  bIsExternalWindow = true 
)
inlinevirtual

set the hWnd on to which we will render and process window messages.

this function should be called prior to Create().

Note
: the rendering device size will use the client area of the input window
Parameters
hWndthe Window on to which we will render.
bIsExternalWindowthis is always true, unless for the default window used by ParaEngine when no window is created by the user.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetMinUIResolution()

virtual void ParaEngine::CParaEngineAppBase::SetMinUIResolution ( int  nWidth,
int  nHeight,
bool  bAutoUIScaling = true 
)
inlinevirtual

set the minimum UI resolution size.

if the backbuffer is smaller than this, we will use automatically use UI scaling for example, if minimum width is 1024, and backbuffer it 800, then m_fUIScalingX will be automatically set to 1024/800. calling this function will cause OnSize() and UpdateBackbufferSize() to be called. Actually it calls SetUIScale() [main thread only]

Parameters
nWidththe new width.
nHeightthe new height.
bAutoUIScalingdefault to true. whether we will automatically recalculate the UI scaling accordingly with regard to current backbuffer size.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetRefreshTimer()

virtual void ParaEngine::CParaEngineAppBase::SetRefreshTimer ( float  fTimeInterval,
int  nFrameRateControl = 0 
)
inlinevirtual

Set the frame rate timer interval.

Parameters
fTimeIntervalvalue in seconds. such as 0.033f or 0.01667f Passing a value <= 0 to render in idle time.
nFrameRateControl0 for real time, 1 for ideal frame rate at 30 FPS no matter whatever time interval is set.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetReturnCode()

void CParaEngineAppBase::SetReturnCode ( int  nReturnCode)
virtual

Get the exit code that will be used when the standalone executable exit.

this is mainly used for writing test cases. Where a return value of 0 means success, any other value means failure.

Implements ParaEngine::IParaEngineApp.

§ SetTouchInputting()

void ParaEngine::CParaEngineAppBase::SetTouchInputting ( bool  bTouchInputting)
virtual

whether the last mouse input is from touch or mouse.

by default it is mouse mode.

Reimplemented from ParaEngine::IParaEngineApp.

§ SetWindowedMode()

virtual bool ParaEngine::CParaEngineAppBase::SetWindowedMode ( bool  bWindowed)
inlinevirtual

switch to either windowed mode or full screen mode.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ StartApp()

virtual HRESULT ParaEngine::CParaEngineAppBase::StartApp ( const char *  sCommandLine = 0)
inlinevirtual

This is the first function that should be called when acquiring the IParaEngineApp interface.

call this function to start the application. Rendering window and devices are not created, one need to call Create() instead.

Parameters
sCommandLinethe command line parameter

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ StopApp()

virtual HRESULT ParaEngine::CParaEngineAppBase::StopApp ( )
inlinevirtual

This is the last function that should be called.

It is usually called just before process exit.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SystemMessageBox()

void ParaEngine::CParaEngineAppBase::SystemMessageBox ( const std::string &  msg)
virtual

show a system message box to the user.

mostly about fatal error.

Reimplemented from ParaEngine::IParaEngineApp.

§ UpdateScreenMode()

virtual bool ParaEngine::CParaEngineAppBase::UpdateScreenMode ( )
inlinevirtual

call this function to update changes of FullScreen Mode and Screen Resolution.

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ WriteConfigFile()

virtual void ParaEngine::CParaEngineAppBase::WriteConfigFile ( const char *  sFileName)
inlinevirtual

write the current setting to config file.

Such as graphics mode and whether full screen, etc. config file at ./config.txt will be automatically loaded when the game engine starts.

Parameters
sFileNameif this is "", it will be the default config file at ./config.txt

Implements ParaEngine::IParaEngineApp.

Reimplemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ WriteToLog()

void CParaEngineAppBase::WriteToLog ( const char *  sFormat,
  ... 
)
virtual

append text to log file.

Implements ParaEngine::IParaEngineApp.

Member Data Documentation

§ m_nReturnCode

int ParaEngine::CParaEngineAppBase::m_nReturnCode
protected

the application exit code or return code.

0 means success. otherwise means a failure.

§ m_pSingletonReleasePool

CObjectAutoReleasePool* ParaEngine::CParaEngineAppBase::m_pSingletonReleasePool
protected

a pool of registered singleton object.


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