8 #include "IParaEngineApp.h" 20 HRESULT DisplayErrorMsg( HRESULT hr, DWORD dwType );
23 static bool ConfirmDeviceHelper( D3DCAPS9* pCaps, VertexProcessingType vertexProcessingType, D3DFORMAT adapterFormat, D3DFORMAT backBufferFormat );
24 bool FindBestWindowedMode(
bool bRequireHAL,
bool bRequireREF );
25 bool FindBestFullscreenMode(
bool bRequireHAL,
bool bRequireREF );
26 HRESULT LaunchReadme();
27 HRESULT ChooseInitialD3DSettings();
28 HRESULT Initialize3DEnvironment();
33 HRESULT Reset3DEnvironment();
34 HRESULT ToggleFullscreen();
35 HRESULT ForceWindowed();
36 HRESULT UserSelectNewDevice();
37 void Cleanup3DEnvironment();
42 virtual void BuildPresentParamsFromSettings();
43 virtual HRESULT AdjustWindowForChange();
44 virtual void UpdateStats();
47 virtual HRESULT ConfirmDevice(D3DCAPS9*,DWORD,D3DFORMAT,D3DFORMAT) {
return S_OK; }
48 virtual HRESULT OneTimeSceneInit() {
return S_OK; }
49 virtual HRESULT InitDeviceObjects() {
return S_OK; }
50 virtual HRESULT RestoreDeviceObjects() {
return S_OK; }
51 virtual HRESULT FrameMove() {
return S_OK; }
52 virtual HRESULT Render() {
return S_OK; }
53 virtual HRESULT InvalidateDeviceObjects() {
return S_OK; }
54 virtual HRESULT DeleteDeviceObjects() {
return S_OK; }
55 virtual HRESULT FinalCleanup() {
return S_OK; }
66 virtual void Pause(
bool bPause );
67 virtual bool IsPaused();
98 virtual HRESULT Create();
99 virtual HRESULT CreateFromD3D9Device(IDirect3DDevice9* pD3dDevice, IDirect3DSwapChain9* apSwapChain);
101 virtual int Run(HINSTANCE hInstance);
121 bool m_bIgnoreSizeChange;
122 bool m_bDeviceObjectsInited;
123 bool m_bDeviceObjectsRestored;
140 D3DPRESENT_PARAMETERS m_d3dpp;
145 LPDIRECT3DDEVICE9 m_pd3dDevice;
146 IDirect3DSwapChain9* m_pd3dSwapChain;
148 D3DSURFACE_DESC m_d3dsdBackBuffer;
149 DWORD m_dwCreateFlags;
150 DWORD m_dwWindowStyle;
151 RECT m_rcWindowBounds;
152 RECT m_rcWindowClient;
158 double m_fElapsedTime;
160 TCHAR m_strDeviceStats[90];
161 TCHAR m_strFrameStats[90];
162 float m_fRefreshTimerInterval;
163 int m_nFrameRateControl;
166 TCHAR* m_strWindowTitle;
167 DWORD m_dwCreationWidth;
168 DWORD m_dwCreationHeight;
169 bool m_bShowCursorWhenFullscreen;
170 bool m_bClipCursorWhenFullscreen;
171 bool m_bStartFullscreen;
172 bool m_bCreateMultithreadDevice;
173 bool m_bAllowDialogBoxMode;
178 bool m_bIsExternalD3DDevice;
bool m_bEnable3DRendering
whether to render 3d scene and present to screen.
Definition: d3dapp.h:137
ParaEngine::PEAppState m_nAppState
application state
Definition: d3dapp.h:180
bool m_bPassiveRendering
passive rendering, it will not render the scene, but simulation and time remains the same...
Definition: d3dapp.h:134
Definition: ManagedDef.h:18
void SetRefreshTimer(float fTimeInterval, int nFrameRateControl=0)
Set the frame rate timer interval.
Definition: d3dapp.cpp:1703
HRESULT Render3DEnvironment(bool bForceRender=false)
frame move and render
Definition: d3dapp.cpp:284
HRESULT PresentScene()
force present the scene.
Definition: d3dapp.cpp:435
virtual bool UpdateViewPort()
update view port by backbuffer size.
Definition: d3dapp.cpp:862
float GetRefreshTimer() const
get the refresh timer.
Definition: d3dapp.cpp:1710
Definition: d3denumeration.h:98
bool m_bDisableD3D
if this is true, the directX is not needed to run the application.
Definition: d3dapp.h:131
A base class for creating D3D device based application.
Definition: d3dapp.h:13
void Enable3DRendering(bool bEnable)
disable 3D rendering, do not present the scene.
Definition: d3dapp.h:79
bool IsExternalD3DDevice()
whether the d3d device is managed externally
Definition: d3dapp.h:107
virtual HRESULT DoWork()
this function is called per frame, in most cases, it will render the 3d scene and frame move...
Definition: d3dapp.cpp:1808
bool m_bIsExternalWindow
whether the main rendering window is an externally provided window or not.
Definition: d3dapp.h:176
PEAppState
ParaEngine application state.
Definition: IParaEngineApp.h:40
bool Is3DRenderingEnabled()
whether 3D rendering is enabled, do not present the scene.
Definition: d3dapp.h:83
Definition: d3dsettings.h:17
HRESULT HandlePossibleSizeChange(bool bUpdateSizeOnly=false)
this function is called whenever the main window size changes.
Definition: d3dapp.cpp:787