-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSplashScreen.h
84 lines (66 loc) · 1.9 KB
/
SplashScreen.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include <Windows.h>
#include <vector>
#include <chrono>
#include <random>
class SplashScreen;
SplashScreen& GetSplashScreen();
void ShowSplashScreen(HINSTANCE hInstance);
void CloseSplashScreen();
struct MusicalNote {
float x;
float y;
float scale;
float rotation;
float alpha;
float velocityX;
float velocityY;
float rotationSpeed;
float lifetime;
float maxLifetime;
bool isSharp;
};
class SplashScreen {
public:
SplashScreen();
~SplashScreen();
bool Initialize(HINSTANCE hInstance);
void Show();
void Close();
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static SplashScreen* s_instance;
private:
HWND m_hwnd;
HINSTANCE m_hInstance;
int m_width;
int m_height;
bool m_isActive;
std::vector<MusicalNote> m_notes;
std::mt19937 m_rng;
std::uniform_real_distribution<float> m_distX;
std::uniform_real_distribution<float> m_distY;
std::uniform_real_distribution<float> m_distScale;
std::uniform_real_distribution<float> m_distRotation;
std::uniform_real_distribution<float> m_distLifetime;
std::uniform_int_distribution<int> m_distIsSharp;
HBITMAP m_hBackBuffer;
HDC m_hdcBackBuffer;
HBITMAP m_hSplashBitmap;
HBITMAP m_hNoteBitmap;
HBITMAP m_hSharpBitmap;
HFONT m_hFont;
UINT_PTR m_timerID;
std::chrono::time_point<std::chrono::high_resolution_clock> m_lastFrameTime;
float m_deltaTime;
void CreateBackBuffer();
void DestroyBackBuffer();
void LoadResources();
void ReleaseResources();
void Update();
void Render();
void SpawnNote();
void DrawNote(HDC hdc, const MusicalNote& note);
void DrawSplashImage(HDC hdc);
void DrawTextContent(HDC hdc);
friend SplashScreen& GetSplashScreen();
};