| 21 | { |
| 22 | |
| 23 | class App |
| 24 | { |
| 25 | |
| 26 | public: |
| 27 | |
| 28 | App(const wchar* appName, const wchar* iconResource = nullptr); |
| 29 | virtual ~App(); |
| 30 | |
| 31 | int32 Run(); |
| 32 | |
| 33 | protected: |
| 34 | |
| 35 | virtual void Initialize() = 0; |
| 36 | virtual void Shutdown() = 0; |
| 37 | |
| 38 | virtual void Update(const Timer& timer) = 0; |
| 39 | virtual void Render(const Timer& timer) = 0; |
| 40 | |
| 41 | virtual void BeforeReset() = 0; |
| 42 | virtual void AfterReset() = 0; |
| 43 | |
| 44 | virtual void CreatePSOs() = 0; |
| 45 | virtual void DestroyPSOs() = 0; |
| 46 | |
| 47 | void Exit(); |
| 48 | void ToggleFullScreen(bool fullScreen); |
| 49 | void CalculateFPS(); |
| 50 | |
| 51 | static void OnWindowResized(void* context, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); |
| 52 | |
| 53 | Window window; |
| 54 | SwapChain swapChain; |
| 55 | Timer appTimer; |
| 56 | |
| 57 | SpriteFont font; |
| 58 | SpriteRenderer spriteRenderer; |
| 59 | |
| 60 | static const uint32 NumTimeDeltaSamples = 64; |
| 61 | float timeDeltaBuffer[NumTimeDeltaSamples] = { }; |
| 62 | uint32 currentTimeDeltaSample = 0; |
| 63 | uint32 fps = 0; |
| 64 | |
| 65 | std::wstring applicationName; |
| 66 | std::string globalHelpText = "MJPs sample framework for DX11"; |
| 67 | |
| 68 | bool showWindow = true; |
| 69 | int32 returnCode = 0; |
| 70 | D3D_FEATURE_LEVEL minFeatureLevel = D3D_FEATURE_LEVEL_11_0; |
| 71 | |
| 72 | Float4x4 appViewMatrix; |
| 73 | |
| 74 | static const uint64 MaxLogMessages = 1024; |
| 75 | std::string logMessages[MaxLogMessages]; |
| 76 | uint64 numLogMessages = 0; |
| 77 | bool showLog = false; |
| 78 | bool newLogMessage = false; |
| 79 | |
| 80 | private: |
nothing calls this directly
no outgoing calls
no test coverage detected