-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYiaWindow.h
More file actions
48 lines (40 loc) · 1.17 KB
/
YiaWindow.h
File metadata and controls
48 lines (40 loc) · 1.17 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
#pragma once
#include"pch.h"
#include"Event/Event.h"
namespace YiaEngine
{
struct WindowData
{
WindowData(const char* Name, UINT width, UINT Height)
:Name(Name), Width(width), Height(Height), LTPosX(0), LTPosY(0){}
std::string Name;
UINT Width;
UINT Height;
UINT LTPosX;
UINT LTPosY;
};
class Window
{
public:
using EventCallBack = std::function<void(Event&)>;
Window() {};
virtual void Init(const WindowData& data) = 0;
virtual void OnUpdate() = 0;
virtual void OnDestroy() = 0;
virtual UINT GetWidth() = 0;
virtual UINT GetHeight() = 0;
virtual void* NativeHandle() = 0;
static Window& Create(const WindowData& data);
virtual void SetEventCallBack(const EventCallBack& callBack) { callBack_ = callBack; };
static void Dispatch(Event& e) {if(s_Window!=nullptr&&s_Window->callBack_) s_Window->callBack_(e); };
static void ResizeScreen(UINT width, UINT Height);
static void FullScreen();
static Window& CurrentWindow() { return *s_Window; }
protected:
virtual void Resize(UINT width, UINT Height) = 0;
virtual void ResizeFullScreen() = 0;
protected:
static std::unique_ptr<Window> s_Window;
EventCallBack callBack_;
};
}