My Project
Public Member Functions | List of all members
ParaEngine::IParaEngineApp Class Referenceabstract

a table of virtual functions which are used by plug-ins to access the game engine More...

#include <IParaEngineApp.h>

Inheritance diagram for ParaEngine::IParaEngineApp:
ParaEngine::BaseInterface ParaEngine::InterfaceServer ParaEngine::CParaEngineAppBase ParaEngine::CParaEngineApp ParaEngine::CParaEngineApp ParaEngine::CParaEngineApp

Public Member Functions

virtual HRESULT StartApp (const char *sCommandLine=0)=0
 This is the first function that should be called when acquiring the IParaEngineApp interface. More...
 
virtual HRESULT StopApp ()=0
 This is the last function that should be called. More...
 
virtual void SetMainWindow (HWND hWnd, bool bIsExternalWindow=true)=0
 set the hWnd on to which we will render and process window messages. More...
 
virtual HWND GetMainWindow ()=0
 
virtual int Run (HINSTANCE hInstance)=0
 only call this function if one does not want to manage game loop externally. More...
 
virtual HRESULT DoWork ()=0
 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)=0
 create from an existing d3d device. More...
 
virtual HRESULT InitDeviceObjects ()=0
 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 ()=0
 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 ()=0
 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 ()=0
 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)=0
 create d3d render device based on the current main window. More...
 
virtual HRESULT Init (HWND *pHWND=0)=0
 init the application. More...
 
virtual HRESULT Render3DEnvironment (bool bForceRender=false)=0
 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)=0
 the window message processor. More...
 
virtual LRESULT MsgProcWinThreadCustom (UINT uMsg, WPARAM wParam, LPARAM lParam)=0
 
virtual LRESULT SendMessageToApp (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)=0
 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)=0
 post a raw win32 message from any thread to the thread on which hWnd is created. More...
 
virtual bool GetMessageFromApp (CWinRawMsg *pMsg)=0
 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)=0
 handle a message in the main application thread.
 
virtual void EnablePassiveRendering (bool bEnable)=0
 passive rendering, it will not render the scene, but simulation and time remains the same. More...
 
virtual bool IsPassiveRenderingEnabled ()=0
 passive rendering, it will not render the scene, but simulation and time remains the same. More...
 
virtual void Enable3DRendering (bool bEnable)=0
 disable 3D rendering, do not present the scene. More...
 
virtual bool Is3DRenderingEnabled ()=0
 whether 3D rendering is enabled, do not present the scene. More...
 
virtual void SetFullScreenMode (bool bFullscreen)=0
 whether to use full screen mode, it does not immediately change the device, call UpdateScreenMode() to update the device. More...
 
virtual bool IsFullScreenMode ()=0
 
virtual void BringWindowToTop ()=0
 The BringWindowToTop current window to the top of the Z order. More...
 
virtual void SetAllowWindowClosing (bool bAllowClosing)=0
 whether the user can close the window (sending WM_CLOSE message). More...
 
virtual bool IsWindowClosingAllowed ()=0
 
virtual void ShowMenu (bool bShow)=0
 turn on/off menu
 
virtual void GetResolution (float *pX, float *pY)=0
 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)=0
 
virtual int GetMultiSampleType ()=0
 anti-aliasing for both windowed and full screen mode. More...
 
virtual void SetMultiSampleType (int nType)=0
 
virtual int GetMultiSampleQuality ()=0
 anti-aliasing for both windowed and full screen mode. More...
 
virtual void SetMultiSampleQuality (int nType)=0
 
virtual bool UpdateScreenMode ()=0
 call this function to update changes of FullScreen Mode and Screen Resolution. More...
 
virtual bool SetWindowedMode (bool bWindowed)=0
 switch to either windowed mode or full screen mode. More...
 
virtual bool IsWindowedMode ()=0
 return true if it is currently under windowed mode. More...
 
virtual void SetWindowText (const char *pChar)=0
 set the window title when at windowed mode
 
virtual const char * GetWindowText ()=0
 get the window title when at windowed mode
 
virtual void GetCursorPosition (int *pX, int *pY, bool bInBackbuffer=true)=0
 get the current mouse cursor position. More...
 
virtual void GameToClient (int &inout_x, int &inout_y, bool bInBackbuffer=true)=0
 translate a postion from game coordination system to client window position. More...
 
virtual void ClientToGame (int &inout_x, int &inout_y, bool bInBackbuffer=true)=0
 translate a postion from client window position to game coordination system. More...
 
virtual void WriteConfigFile (const char *sFileName)=0
 write the current setting to config file. More...
 
virtual bool HasNewConfig ()=0
 get whether ParaEngine is loaded from config/config.new.txt. More...
 
virtual void SetHasNewConfig (bool bHasNewConfig)=0
 set whether ParaEngine is loaded from config/config.new.txt. More...
 
virtual void SetIgnoreWindowSizeChange (bool bIgnoreSizeChange)=0
 switch to ignore windows size change. More...
 
virtual bool GetIgnoreWindowSizeChange ()=0
 return true if it is currently under windowed mode. More...
 
virtual HINSTANCE GetModuleHandle ()=0
 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)=0
 Set the frame rate timer interval. More...
 
virtual float GetRefreshTimer ()=0
 get the refresh timer.
 
virtual void GetWindowCreationSize (int *pWidth, int *pHeight)=0
 get the window creation size in default application config. More...
 
virtual PEAppState GetAppState ()=0
 get application state
 
virtual void SetAppState (ParaEngine::PEAppState state)=0
 set application state
 
virtual void ActivateApp (bool bActivate)=0
 this function is called whenever the application is disabled or enabled. More...
 
virtual bool IsAppActive ()=0
 whether the application is active or not. More...
 
virtual DWORD GetCoreUsage ()=0
 Get the current ParaEngine app usage. More...
 
virtual void SetCoreUsage (DWORD dwUsage)=0
 Set the current ParaEngine app usage. More...
 
virtual void SetMinUIResolution (int nWidth, int nHeight, bool bAutoUIScaling=true)=0
 set the minimum UI resolution size. More...
 
virtual void Exit (int nReturnCode=0)=0
 Send the exit message, so that the game engine will prepare to exit in the next frame. More...
 
virtual void SetReturnCode (int nReturnCode)=0
 Get the exit code that will be used when the standalone executable exit. More...
 
virtual int GetReturnCode ()=0
 
virtual NPL::INPLRuntimeGetNPLRuntime ()=0
 get the NPL runtime system associate with the application. More...
 
virtual bool IsTouchInputting ()=0
 whether the last mouse input is from touch or mouse. More...
 
virtual bool IsSlateMode ()=0
 
virtual int32 GetTouchPointX ()=0
 obsoleted function:
 
virtual int32 GetTouchPointY ()=0
 
virtual void WriteToLog (const char *sFormat,...)=0
 append text to log file. More...
 
virtual void AppLog (const char *sMessage)
 write app log to file with time and code location. More...
 
virtual void SetTouchInputting (bool bTouchInputting)
 whether the last mouse input is from touch or mouse. More...
 
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 * GetAppCommandLineByParam (const char *pParam, const char *defaultValue)
 return a specified parameter value in the command line of the application. More...
 
virtual const char * GetAppCommandLine ()
 get string specifying the command line for the application, excluding the program name. More...
 
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 float GetFPS ()
 
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 IsServerMode ()
 server mode has no user interface
 
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 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...
 
virtual void FixWindowSize (bool fixed)=0
 
- Public Member Functions inherited from ParaEngine::BaseInterface
BaseInterfaceGetInterface (Interface_ID id)
 
virtual Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 

Additional Inherited Members

- Public Types inherited from ParaEngine::BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 

Detailed Description

a table of virtual functions which are used by plug-ins to access the game engine

Member Function Documentation

§ ActivateApp()

virtual void ParaEngine::IParaEngineApp::ActivateApp ( bool  bActivate)
pure virtual

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

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

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ AppLog()

virtual void ParaEngine::IParaEngineApp::AppLog ( const char *  sMessage)
inlinevirtual

write app log to file with time and code location.

Reimplemented in ParaEngine::CParaEngineAppBase.

§ BringWindowToTop()

virtual void ParaEngine::IParaEngineApp::BringWindowToTop ( )
pure virtual

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

This function only works if IsFullScreenMode() is false.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ ClientToGame()

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

translate a postion 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.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ Create()

virtual HRESULT ParaEngine::IParaEngineApp::Create ( HINSTANCE  hInstance = 0)
pure virtual

create d3d render device based on the current main window.

Use this function to create a new render device automatically.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ CreateFromD3D9Device()

virtual HRESULT ParaEngine::IParaEngineApp::CreateFromD3D9Device ( IDirect3DDevice9 *  pD3dDevice,
IDirect3DSwapChain9 *  apSwapChain 
)
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ DeleteDeviceObjects()

virtual HRESULT ParaEngine::IParaEngineApp::DeleteDeviceObjects ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ DoWork()

virtual HRESULT ParaEngine::IParaEngineApp::DoWork ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Enable3DRendering()

virtual void ParaEngine::IParaEngineApp::Enable3DRendering ( bool  bEnable)
pure 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.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ EnablePassiveRendering()

virtual void ParaEngine::IParaEngineApp::EnablePassiveRendering ( bool  bEnable)
pure virtual

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

Default is false

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Exit()

virtual void ParaEngine::IParaEngineApp::Exit ( int  nReturnCode = 0)
pure 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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ ForceRender()

virtual bool ParaEngine::IParaEngineApp::ForceRender ( )
inlinevirtual

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 in ParaEngine::CParaEngineAppBase, and ParaEngine::CParaEngineApp.

§ GameToClient()

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

translate a postion 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.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ GetAppCommandLine()

virtual const char* ParaEngine::IParaEngineApp::GetAppCommandLine ( )
inlinevirtual

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

Reimplemented in ParaEngine::CParaEngineAppBase.

§ GetAppCommandLineByParam()

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

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 in ParaEngine::CParaEngineAppBase.

§ GetCoreUsage()

virtual DWORD ParaEngine::IParaEngineApp::GetCoreUsage ( )
pure virtual

Get the current ParaEngine app usage.

[main thread only]

Returns
see PE_USAGE

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ GetCursorPosition()

virtual void ParaEngine::IParaEngineApp::GetCursorPosition ( int *  pX,
int *  pY,
bool  bInBackbuffer = true 
)
pure 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.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ GetIgnoreWindowSizeChange()

virtual bool ParaEngine::IParaEngineApp::GetIgnoreWindowSizeChange ( )
pure virtual

return true if it is currently under windowed mode.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ GetMessageFromApp()

virtual bool ParaEngine::IParaEngineApp::GetMessageFromApp ( CWinRawMsg pMsg)
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetModuleDir()

virtual const char* ParaEngine::IParaEngineApp::GetModuleDir ( )
inlinevirtual

get the NPL bin directory (main executable directory).

this one ends with "/"

Reimplemented in ParaEngine::CParaEngineAppBase.

§ GetModuleHandle()

virtual HINSTANCE ParaEngine::IParaEngineApp::GetModuleHandle ( )
pure virtual

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

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ GetMultiSampleQuality()

virtual int ParaEngine::IParaEngineApp::GetMultiSampleQuality ( )
pure virtual

anti-aliasing for both windowed and full screen mode.

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetMultiSampleType()

virtual int ParaEngine::IParaEngineApp::GetMultiSampleType ( )
pure virtual

anti-aliasing for both windowed and full screen mode.

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetNPLRuntime()

virtual NPL::INPLRuntime* ParaEngine::IParaEngineApp::GetNPLRuntime ( )
pure virtual

get the NPL runtime system associate with the application.

NPL provides communication framework across different language systems.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetResolution()

virtual void ParaEngine::IParaEngineApp::GetResolution ( float *  pX,
float *  pY 
)
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ GetScreenResolution()

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

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

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

§ GetWindowCreationSize()

virtual void ParaEngine::IParaEngineApp::GetWindowCreationSize ( int *  pWidth,
int *  pHeight 
)
pure virtual

get the window creation size in default application config.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ HasClosingRequest()

virtual bool ParaEngine::IParaEngineApp::HasClosingRequest ( )
inlinevirtual

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 in ParaEngine::CParaEngineAppBase.

§ HasNewConfig()

virtual bool ParaEngine::IParaEngineApp::HasNewConfig ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Init()

virtual HRESULT ParaEngine::IParaEngineApp::Init ( HWND *  pHWND = 0)
pure virtual

init the application.

no need to be called unless in a service where no rendering devices are created.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ InitDeviceObjects()

virtual HRESULT ParaEngine::IParaEngineApp::InitDeviceObjects ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ InvalidateDeviceObjects()

virtual HRESULT ParaEngine::IParaEngineApp::InvalidateDeviceObjects ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Is3DRenderingEnabled()

virtual bool ParaEngine::IParaEngineApp::Is3DRenderingEnabled ( )
pure 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

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ IsAppActive()

virtual bool ParaEngine::IParaEngineApp::IsAppActive ( )
pure virtual

§ IsPassiveRenderingEnabled()

virtual bool ParaEngine::IParaEngineApp::IsPassiveRenderingEnabled ( )
pure virtual

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

Default is false

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ IsTouchInputting()

virtual bool ParaEngine::IParaEngineApp::IsTouchInputting ( )
pure virtual

whether the last mouse input is from touch or mouse.

by default it is mouse mode.

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ IsWindowedMode()

virtual bool ParaEngine::IParaEngineApp::IsWindowedMode ( )
pure virtual

return true if it is currently under windowed mode.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ LoadNPLPackage()

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

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 in ParaEngine::CParaEngineAppBase.

§ MsgProcWinThread()

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

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ PostWinThreadMessage()

virtual bool ParaEngine::IParaEngineApp::PostWinThreadMessage ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
pure virtual

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

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Render3DEnvironment()

virtual HRESULT ParaEngine::IParaEngineApp::Render3DEnvironment ( bool  bForceRender = false)
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ RestoreDeviceObjects()

virtual HRESULT ParaEngine::IParaEngineApp::RestoreDeviceObjects ( )
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ Run()

virtual int ParaEngine::IParaEngineApp::Run ( HINSTANCE  hInstance)
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SendMessageToApp()

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

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetAllowWindowClosing()

virtual void ParaEngine::IParaEngineApp::SetAllowWindowClosing ( bool  bAllowClosing)
pure virtual

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.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetAppCommandLine()

virtual void ParaEngine::IParaEngineApp::SetAppCommandLine ( const char *  pCommandLine)
inlinevirtual

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 in ParaEngine::CParaEngineAppBase.

§ SetCoreUsage()

virtual void ParaEngine::IParaEngineApp::SetCoreUsage ( DWORD  dwUsage)
pure virtual

Set the current ParaEngine app usage.

[main thread only]

Parameters
dwUsagebitwise of PE_USAGE

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ SetFullScreenMode()

virtual void ParaEngine::IParaEngineApp::SetFullScreenMode ( bool  bFullscreen)
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetHasNewConfig()

virtual void ParaEngine::IParaEngineApp::SetHasNewConfig ( bool  bHasNewConfig)
pure virtual

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.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetIgnoreWindowSizeChange()

virtual void ParaEngine::IParaEngineApp::SetIgnoreWindowSizeChange ( bool  bIgnoreSizeChange)
pure virtual

switch to ignore windows size change.

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

Implemented in ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ SetMainWindow()

virtual void ParaEngine::IParaEngineApp::SetMainWindow ( HWND  hWnd,
bool  bIsExternalWindow = true 
)
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetMinUIResolution()

virtual void ParaEngine::IParaEngineApp::SetMinUIResolution ( int  nWidth,
int  nHeight,
bool  bAutoUIScaling = true 
)
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SetRefreshTimer()

virtual void ParaEngine::IParaEngineApp::SetRefreshTimer ( float  fTimeInterval,
int  nFrameRateControl = 0 
)
pure virtual

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.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineAppBase.

§ SetReturnCode()

virtual void ParaEngine::IParaEngineApp::SetReturnCode ( int  nReturnCode)
pure 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.

Implemented in ParaEngine::CParaEngineAppBase.

§ SetTouchInputting()

virtual void ParaEngine::IParaEngineApp::SetTouchInputting ( bool  bTouchInputting)
inlinevirtual

whether the last mouse input is from touch or mouse.

by default it is mouse mode.

Reimplemented in ParaEngine::CParaEngineAppBase.

§ SetWindowedMode()

virtual bool ParaEngine::IParaEngineApp::SetWindowedMode ( bool  bWindowed)
pure virtual

switch to either windowed mode or full screen mode.

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ StartApp()

virtual HRESULT ParaEngine::IParaEngineApp::StartApp ( const char *  sCommandLine = 0)
pure virtual

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

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ StopApp()

virtual HRESULT ParaEngine::IParaEngineApp::StopApp ( )
pure virtual

This is the last function that should be called.

It is usually called just before process exit.

Implemented in ParaEngine::CParaEngineApp, ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ SystemMessageBox()

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

show a system message box to the user.

mostly about fatal error.

Reimplemented in ParaEngine::CParaEngineAppBase.

§ UpdateScreenMode()

virtual bool ParaEngine::IParaEngineApp::UpdateScreenMode ( )
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ WriteConfigFile()

virtual void ParaEngine::IParaEngineApp::WriteConfigFile ( const char *  sFileName)
pure virtual

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

Implemented in ParaEngine::CParaEngineAppBase, ParaEngine::CParaEngineApp, ParaEngine::CParaEngineApp, and ParaEngine::CParaEngineApp.

§ WriteToLog()

virtual void ParaEngine::IParaEngineApp::WriteToLog ( const char *  sFormat,
  ... 
)
pure virtual

append text to log file.

Implemented in ParaEngine::CParaEngineAppBase.


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