-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD3DApp.h
More file actions
59 lines (44 loc) · 1.56 KB
/
D3DApp.h
File metadata and controls
59 lines (44 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Copyright (c) 2024-2025 Toksisitee. All rights reserved.
This work is licensed under the terms of the MIT license.
For a copy, refer to license.md or https://opensource.org/licenses/MIT
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*/
#pragma once
#include <windows.h>
#include <d3d9.h>
class CD3DApp
{
public:
CD3DApp();
~CD3DApp();
virtual void Run();
virtual HRESULT Create(HINSTANCE hInstance);
virtual void DestroyWindow();
void HandleResize();
void Cleanup3DEnviornment();
[[nodiscard]] HWND GetHwnd() { return m_hWnd; }
[[nodiscard]] LPDIRECT3DDEVICE9 GetDevice() { return m_pd3dDevice; }
UINT GetWidth() { return m_d3dpp.BackBufferWidth; }
UINT GetHeight() { return m_d3dpp.BackBufferHeight; }
protected:
virtual LRESULT WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
virtual LRESULT DefWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
HRESULT Render3DEnvironment(void* pIo);
void Reset3DEnvironment();
HRESULT Initialize3DEnvironment();
HRESULT CreateDeviceD3D(HWND hWnd);
void WndResized(UINT w, UINT h);
HWND m_hWnd;
HINSTANCE m_hInstance;
LPCWSTR m_lpszClassName;
LPDIRECT3D9 m_pD3D;
LPDIRECT3DDEVICE9 m_pd3dDevice;
UINT m_uResizeWidth;
UINT m_uResizeHeight;
D3DPRESENT_PARAMETERS m_d3dpp;
private:
static LRESULT CALLBACK WndProcCallback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
};