2 #include "IParaEngineApp.h" 3 #include "CommandLineParams.h" 8 class CObjectAutoReleasePool;
19 virtual LifetimeType LifetimeControl();
21 virtual void ReleaseInterface();
22 virtual void DeleteInterface();
31 virtual void WriteToLog(
const char* sFormat, ...);
32 virtual void AppLog(
const char* sFormat);
51 virtual bool IsSlateMode();
54 virtual int32 GetTouchPointY() {
return 0; };
68 virtual void GameToClient(
int& inout_x,
int & inout_y,
bool bInBackbuffer =
true) { };
75 virtual void ClientToGame(
int& inout_x,
int & inout_y,
bool bInBackbuffer =
true){ };
124 virtual int GetReturnCode();
149 virtual HRESULT
StartApp(
const char* sCommandLine = 0) {
return S_OK; };
156 virtual HRESULT
Init(HWND* pHWND) {
return S_OK; };
162 virtual void Exit(
int nReturnCode = 0);
167 virtual HRESULT FrameMove(
double fTime){
return S_OK; };
181 virtual HWND GetMainWindow() {
return 0; };
184 virtual int Run(HINSTANCE hInstance){
return 0; };
194 virtual HRESULT
CreateFromD3D9Device(IDirect3DDevice9* pD3dDevice, IDirect3DSwapChain9* apSwapChain) {
return 0; };
233 virtual HRESULT
Create(HINSTANCE hInstance = 0) {
return 0; };
247 virtual LRESULT
MsgProcWinThread(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
bool bCallDefProcedure =
true) {
return 0; };
250 virtual LRESULT MsgProcWinThreadCustom(UINT uMsg, WPARAM wParam, LPARAM lParam) {
return 0; };
255 virtual LRESULT
SendMessageToApp(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
return 0; };
270 virtual LRESULT
MsgProcApp(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
return 0; };
286 virtual bool IsWindowClosingAllowed() {
return false; };
290 virtual bool IsFullScreenMode(){
return false; };
297 virtual void SetScreenResolution(
const Vector2& vSize){};
301 virtual void SetMultiSampleType(
int nType){};
305 virtual void SetMultiSampleQuality(
int nType){};
320 virtual void FixWindowSize(
bool fixed) {};
351 virtual void SetResolution(
float x,
float y) {};
365 virtual void SetHasClosingRequest(
bool val);
373 virtual bool LoadNPLPackage(
const char* sFilePath, std::string * pOutMainFile = NULL);
393 virtual void VerifyCommandLine(
const char* sCommandLine, std::string &strCmd);
398 void DestroySingletons();
414 bool m_bEnable3DRendering;
416 bool m_hasClosingRequest;
virtual void SetAppState(ParaEngine::PEAppState state)
set application state
Definition: ParaEngineAppBase.cpp:301
void InitCommon()
shared init called in constructor.
Definition: ParaEngineAppBase.cpp:170
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...
Definition: ParaEngineAppBase.h:255
PEAppState m_nAppState
application state
Definition: ParaEngineAppBase.h:428
virtual int GetMultiSampleType()
anti-aliasing for both windowed and full screen mode.
Definition: ParaEngineAppBase.h:300
virtual LRESULT MsgProcApp(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
handle a message in the main application thread.
Definition: ParaEngineAppBase.h:270
virtual HRESULT DeleteDeviceObjects()
This callback function will be called immediately after the Direct3D device has been destroyed...
Definition: ParaEngineAppBase.h:228
virtual bool HasNewConfig()
get whether ParaEngine is loaded from config/config.new.txt.
Definition: ParaEngineAppBase.h:330
virtual void SetFullScreenMode(bool bFullscreen)
whether to use full screen mode, it does not immediately change the device, call UpdateScreenMode() t...
Definition: ParaEngineAppBase.h:289
virtual int GetMultiSampleQuality()
anti-aliasing for both windowed and full screen mode.
Definition: ParaEngineAppBase.h:304
void RegisterObjectClasses()
register any custom classes
Definition: ParaEngineAppBase.cpp:194
The base class for interfaces in ParaEngine.
Definition: baseinterface.h:29
virtual bool IsTouchInputting()
whether the last mouse input is from touch or mouse.
Definition: ParaEngineAppBase.cpp:222
virtual HRESULT Render3DEnvironment(bool bForceRender=false)
Frame move and render a frame during idle time (no messages are waiting).
Definition: ParaEngineAppBase.h:240
static CParaEngineApp * GetInstance()
the singleton application.
Definition: ParaEngineAppBase.cpp:90
Definition: ParaEngineAppBase.h:11
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual void GameToClient(int &inout_x, int &inout_y, bool bInBackbuffer=true)
translate a position from game coordination system to client window position.
Definition: ParaEngineAppBase.h:68
virtual HRESULT CreateFromD3D9Device(IDirect3DDevice9 *pD3dDevice, IDirect3DSwapChain9 *apSwapChain)
create from an existing d3d device.
Definition: ParaEngineAppBase.h:194
virtual const char * GetWindowText()
get the window title when at windowed mode
Definition: ParaEngineAppBase.h:318
virtual void SetCoreUsage(DWORD dwUsage)
Set the current ParaEngine app usage.
Definition: ParaEngineAppBase.h:117
virtual void SystemMessageBox(const std::string &msg)
show a system message box to the user.
Definition: ParaEngineAppBase.cpp:252
virtual HRESULT DoWork()
this function is called per frame, in most cases, it will render the 3d scene and frame move...
Definition: ParaEngineAppBase.h:189
virtual void BringWindowToTop()
The BringWindowToTop current window to the top of the Z order.
Definition: ParaEngineAppBase.h:280
virtual HRESULT Init(HWND *pHWND)
init application
Definition: ParaEngineAppBase.h:156
virtual const char * GetAppCommandLineByParam(const char *pParam, const char *defaultValue)
return a specified parameter value in the command line of the application.
Definition: ParaEngineAppBase.cpp:284
CObjectAutoReleasePool * m_pSingletonReleasePool
a pool of registered singleton object.
Definition: ParaEngineAppBase.h:420
virtual int Run(HINSTANCE hInstance)
only call this function if one does not want to manage game loop externally.
Definition: ParaEngineAppBase.h:184
virtual bool FindBootStrapper()
check if there is bootstrapper file specified at command line, if not it will use NPL code wiki admin...
Definition: ParaEngineAppBase.cpp:641
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
virtual HRESULT Create(HINSTANCE hInstance=0)
create d3d render device based on the current main window.
Definition: ParaEngineAppBase.h:233
void LoadPackagesInFolder(const std::string &sPkgFolder)
Definition: ParaEngineAppBase.cpp:571
base class for object, such as CBaseObject, IAttributeObject, GUI object.
Definition: PERef.h:287
std::string m_sModuleDir
bin/ module path
Definition: ParaEngineAppBase.h:424
virtual DWORD GetCoreUsage()
Get the current ParaEngine app usage.
Definition: ParaEngineAppBase.cpp:247
virtual bool ForceRender()
render the current frame and does not return until everything is presented to screen.
Definition: ParaEngineAppBase.cpp:160
raw win32 message
Definition: OSWindows.h:27
void LoadPackages()
we will load all packages that matches the following pattern in the order given by their name...
Definition: ParaEngineAppBase.cpp:670
virtual HRESULT FinalCleanup()
This function should be called only once when the application end, one can destroy game objects here...
Definition: ParaEngineAppBase.cpp:306
CViewportManager * GetViewportManager()
managing multiple 3d views
Definition: ParaEngineAppBase.h:391
virtual bool SetWindowedMode(bool bWindowed)
switch to either windowed mode or full screen mode.
Definition: ParaEngineAppBase.h:312
virtual void GetScreenResolution(Vector2 *pOut)
change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to up...
Definition: ParaEngineAppBase.h:296
virtual HINSTANCE GetModuleHandle()
get the module handle, it may be exe or the dll handle, depending on how the main host app is built...
Definition: ParaEngineAppBase.h:85
virtual const char * GetModuleDir()
get the NPL bin directory (main executable directory).
Definition: ParaEngineAppBase.cpp:165
virtual void AppLog(const char *sFormat)
write app log to file with time and code location.
Definition: ParaEngineAppBase.cpp:555
virtual void ActivateApp(bool bActivate)
this function is called whenever the application is disabled or enabled.
Definition: ParaEngineAppBase.h:102
virtual bool Is3DRenderingEnabled()
whether 3D rendering is enabled, do not present the scene.
Definition: ParaEngineAppBase.cpp:212
virtual void SetHasNewConfig(bool bHasNewConfig)
set whether ParaEngine is loaded from config/config.new.txt.
Definition: ParaEngineAppBase.h:333
virtual bool FindParaEngineDirectory(const char *sHint=NULL)
set the current working directory.
Definition: ParaEngineAppBase.cpp:710
virtual bool GetIgnoreWindowSizeChange()
return true if it is currently under windowed mode.
Definition: ParaEngineAppBase.h:82
A common interface for all classes implementing IAttributeFields By implementing this class's virtual...
Definition: IAttributeFields.h:59
void RegisterObjectClass(IAttributeFields *pObject)
register a given class.
Definition: ParaEngineAppBase.cpp:185
virtual bool IsAppActive()
whether the application is active or not.
Definition: ParaEngineAppBase.cpp:242
virtual void Enable3DRendering(bool bEnable)
disable 3D rendering, do not present the scene.
Definition: ParaEngineAppBase.cpp:217
virtual ParaEngine::PEAppState GetAppState()
get application state
Definition: ParaEngineAppBase.cpp:296
virtual const char * GetAppCommandLine()
get string specifying the command line for the application, excluding the program name...
Definition: ParaEngineAppBase.cpp:279
virtual void GetWindowCreationSize(int *pWidth, int *pHeight)
get the window creation size in default application config.
Definition: ParaEngineAppBase.h:337
virtual bool LoadNPLPackage(const char *sFilePath, std::string *pOutMainFile=NULL)
load NPL package from a disk folder.
Definition: ParaEngineAppBase.cpp:391
when base object is created it has zero reference, and is usually added to auto release pool to be re...
Definition: ObjectAutoReleasePool.h:10
virtual void ShowMenu(bool bShow)
turn on/off menu
Definition: ParaEngineAppBase.h:293
virtual void SetMinUIResolution(int nWidth, int nHeight, bool bAutoUIScaling=true)
set the minimum UI resolution size.
Definition: ParaEngineAppBase.h:347
virtual LRESULT MsgProcWinThread(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool bCallDefProcedure=true)
the window message processor.
Definition: ParaEngineAppBase.h:247
virtual int32 GetTouchPointX()
obsoleted function:
Definition: ParaEngineAppBase.h:53
virtual void GetResolution(float *pX, float *pY)
change the full screen mode, it does not immediately change the device, call UpdateScreenMode() to up...
Definition: ParaEngineAppBase.h:350
std::string m_sPackagesDir
packages/ directory path
Definition: ParaEngineAppBase.h:422
PEAppState
ParaEngine application state.
Definition: IParaEngineApp.h:40
virtual void SetReturnCode(int nReturnCode)
Get the exit code that will be used when the standalone executable exit.
Definition: ParaEngineAppBase.cpp:560
virtual void SetAllowWindowClosing(bool bAllowClosing)
whether the user can close the window (sending WM_CLOSE message).
Definition: ParaEngineAppBase.h:285
virtual void WriteToLog(const char *sFormat,...)
append text to log file.
Definition: ParaEngineAppBase.cpp:547
virtual bool IsWindowedMode()
return true if it is currently under windowed mode.
Definition: ParaEngineAppBase.h:314
virtual HRESULT StopApp()
This is the last function that should be called.
Definition: ParaEngineAppBase.h:153
virtual void SetRefreshTimer(float fTimeInterval, int nFrameRateControl=0)
Set the frame rate timer interval.
Definition: ParaEngineAppBase.h:93
virtual HRESULT InitDeviceObjects()
This callback function will be called immediately after the Direct3D device has been created...
Definition: ParaEngineAppBase.h:203
virtual void SetMainWindow(HWND hWnd, bool bIsExternalWindow=true)
set the hWnd on to which we will render and process window messages.
Definition: ParaEngineAppBase.h:180
virtual void SetIgnoreWindowSizeChange(bool bIgnoreSizeChange)
switch to ignore windows size change.
Definition: ParaEngineAppBase.h:79
virtual void SetTouchInputting(bool bTouchInputting)
whether the last mouse input is from touch or mouse.
Definition: ParaEngineAppBase.cpp:232
virtual void OnFrameEnded()
call this function at the end of the frame.
Definition: ParaEngineAppBase.cpp:112
virtual HRESULT StartApp(const char *sCommandLine=0)
This is the first function that should be called when acquiring the IParaEngineApp interface...
Definition: ParaEngineAppBase.h:149
int m_nReturnCode
the application exit code or return code.
Definition: ParaEngineAppBase.h:418
a table of virtual functions which are used by plug-ins to access the game engine ...
Definition: IParaEngineApp.h:98
virtual HRESULT RestoreDeviceObjects()
This callback function will be called immediately after the Direct3D device has been reset...
Definition: ParaEngineAppBase.h:212
std::string m_sInitialWorkingDir
initial working directory
Definition: ParaEngineAppBase.h:426
manager multiple viewport
Definition: ViewportManager.h:18
virtual void WriteConfigFile(const char *sFileName)
write the current setting to config file.
Definition: ParaEngineAppBase.h:327
virtual bool UpdateScreenMode()
call this function to update changes of FullScreen Mode and Screen Resolution.
Definition: ParaEngineAppBase.h:308
virtual void ClientToGame(int &inout_x, int &inout_y, bool bInBackbuffer=true)
translate a position from client window position to game coordination system.
Definition: ParaEngineAppBase.h:75
virtual void SetWindowText(const char *pChar)
set the window title when at windowed mode
Definition: ParaEngineAppBase.h:316
virtual bool HasClosingRequest()
whether there is closing request in the message queue.
Definition: ParaEngineAppBase.cpp:380
virtual bool GetMessageFromApp(CWinRawMsg *pMsg)
get a message from the application message queue and remove it from the queue.
Definition: ParaEngineAppBase.h:265
NPL Runtime Environment interface.
Definition: INPLRuntime.h:30
command line parameters.
Definition: CommandLineParams.h:8
virtual void Exit(int nReturnCode=0)
Send the exit message, so that the game engine will prepare to exit in the next frame.
Definition: ParaEngineAppBase.cpp:289
virtual void GetCursorPosition(int *pX, int *pY, bool bInBackbuffer=true)
get the current mouse cursor position.
Definition: ParaEngineAppBase.cpp:237
This class demonstrate how to initialize, destroy and drive the game loop of ParaEngine through the C...
Definition: ParaEngineApp.h:96
virtual HRESULT InvalidateDeviceObjects()
This callback function will be called immediately after the Direct3D device has entered a lost state ...
Definition: ParaEngineAppBase.h:221
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.
Definition: ParaEngineAppBase.h:258
virtual bool InitCommandLineParams()
parse common command line parameters
Definition: ParaEngineAppBase.cpp:117
virtual CRefCounted * AddToSingletonReleasePool(CRefCounted *pObject)
we will automatically release singleton object when app stops, in the verse order when object is adde...
Definition: ParaEngineAppBase.cpp:330
virtual NPL::INPLRuntime * GetNPLRuntime()
get the NPL runtime system associate with the application.
Definition: ParaEngineAppBase.cpp:325
virtual float GetRefreshTimer()
get the refresh timer.
Definition: ParaEngineAppBase.h:97
virtual void SetAppCommandLine(const char *pCommandLine)
set string specifying the command line for the application, excluding the program name...
Definition: ParaEngineAppBase.cpp:260
virtual void EnablePassiveRendering(bool bEnable)
passive rendering, it will not render the scene, but simulation and time remains the same...
Definition: ParaEngineAppBase.h:273
virtual bool IsPassiveRenderingEnabled()
passive rendering, it will not render the scene, but simulation and time remains the same...
Definition: ParaEngineAppBase.h:276