blob: bbcb9495eaeb80f97dd8f8e6d8e7daa6be228ae0 (
plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#include <asura-utils/exceptions/exception.h>
#include "window.h"
#include "window_impl_sdl.h"
#include "window_impl_glew.h"
#include "window_impl_glut.h"
namespace_begin(AsuraEngine)
namespace_begin(Window)
Window::Window()
: m_Impl(nullptr)
{
}
Window::~Window()
{
if (m_Impl)
delete m_Impl;
}
#define try_init_window(impl) \
if (!m_Impl) \
{ \
m_Impl = new impl(); \
if (!m_Impl->Init(config)) \
{ \
delete m_Impl; \
m_Impl = nullptr; \
} \
}
bool Window::Init(const WindowConfig& config)
{
ASSERT(!m_Impl);
#if ASURA_WINDOW_SDL
try_init_window(WindowImplSDL);
#endif
return m_Impl != nullptr;
}
void Window::Exit()
{
if (m_Impl)
delete m_Impl;
}
void Window::SetPosition(int x, int y)
{
ASSERT(m_Impl);
m_Impl->SetPosition(x, y);
}
void Window::SetTitle(const std::string& title)
{
ASSERT(m_Impl);
m_Impl->SetTitils(title);
}
void Window::Show()
{
ASSERT(m_Impl);
m_Impl->Show();
}
void Window::Hide()
{
ASSERT(m_Impl);
m_Impl->Hide();
}
void Window::SwapRenderBuffer()
{
ASSERT(m_Impl);
m_Impl->SwapRenderBuffer();
}
void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
{
ASSERT(m_Impl);
glClearColor(col.r, col.g, col.b, col.a);
}
//void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
//{
// ASSERT(m_Impl);
//}
void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state)
{
ASSERT(m_Impl);
}
/*
void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state)
{
ASSERT(m_Impl);
}
*/
}
}
|