-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWindow.h
More file actions
68 lines (55 loc) · 1.79 KB
/
Copy pathWindow.h
File metadata and controls
68 lines (55 loc) · 1.79 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
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#pragma warning(disable: 4251)
#include "WindowImpl.h"
#include "Event.h"
#include <memory>
#include <string_view>
#include <queue>
#include <chrono>
#include <string_view>
#include <stdint.h>
namespace sh::window
{
class Window
{
public:
using StyleFlag = uint32_t;
enum Style
{
Default = 0b0000,
Resize = 0b0001,
Full = 0b0010
};
public:
SH_WINDOW_API Window();
SH_WINDOW_API ~Window();
SH_WINDOW_API void Create(const std::string& title, int wsize, int hsize, StyleFlag style = Style::Default);
SH_WINDOW_API bool PollEvent(Event& event);
SH_WINDOW_API void Close();
/// @brief 프레임 제한, 측정 함수
/// @brief while문 안에 넣을 것
SH_WINDOW_API void ProcessFrame();
SH_WINDOW_API void SetFps(unsigned int fps);
SH_WINDOW_API void SetTitle(std::string_view title);
SH_WINDOW_API void SetSize(int width, int height);
/// @brief 프레임을 맞출 때 시스템 타이머를 사용한다.
/// @brief 주의) 백그라운드 상태에서 프레임이 느려질 수 있음
/// @param bUse true면 시스템 타이머를, false면 바쁜 대기를 사용
SH_WINDOW_API void UseSystemTimer(bool bUse);
SH_WINDOW_API auto IsUsingSystemTimer() const -> bool { return bUsingSysTimer; }
SH_WINDOW_API auto GetNativeHandle() const -> WinHandle { return handle; }
SH_WINDOW_API auto GetDeltaTime() const -> double { return deltaTime; }
SH_WINDOW_API auto GetWidth() const -> uint32_t;
SH_WINDOW_API auto GetHeight() const -> uint32_t;
SH_WINDOW_API auto IsOpen() const -> bool { return bOpen; }
private:
std::unique_ptr<WindowImpl> winImpl;
WinHandle handle;
std::string title;
std::queue<Event> events;
unsigned int fps = 60;
double deltaTime = 0.0;
bool bOpen = false;
bool bUsingSysTimer = true;
};
}//namespace