-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRenderer.h
40 lines (30 loc) · 952 Bytes
/
Renderer.h
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
#pragma once
#ifndef RENDERER_H
#define RENDERER_H
#include <windows.h>
#include <d2d1.h>
#include "ParticleSystem.h"
#pragma comment(lib, "d2d1")
class Renderer {
public:
Renderer(HINSTANCE hInstance, int width, int height, const char* title);
~Renderer();
bool isRunning() const;
void handleMessages();
HWND getHWND() const;
void show();
void render(ParticleSystem& particleSystem);
private:
HINSTANCE m_hInstance;
HWND m_hwnd;
bool m_isRunning;
// Direct2D resources
ID2D1Factory* m_pD2DFactory = nullptr;
ID2D1HwndRenderTarget* m_pRenderTarget = nullptr;
ID2D1SolidColorBrush* m_pBlackBrush = nullptr;
HRESULT createGraphicsResources();
void discardGraphicsResources();
void draw(ParticleSystem& particleSystem);
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
};
#endif // RENDERER_H