-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsdlwindowbackend.cpp
More file actions
124 lines (105 loc) · 2.75 KB
/
sdlwindowbackend.cpp
File metadata and controls
124 lines (105 loc) · 2.75 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <fea/ui/sdlwindowbackend.hpp>
#include <cstdlib>
#define NO_SDL_GLEXT
#include <SDL/SDL.h>
namespace fea
{
SDLWindowBackend::SDLWindowBackend() : mWindow(nullptr)
{
SDL_Init(SDL_INIT_VIDEO);
}
void SDLWindowBackend::open(VideoMode mode, const std::string& title, uint32_t style, const ContextSettings& settings)
{
//todo: fix style and version
(void) style;
(void) settings;
mWindow = SDL_SetVideoMode((int32_t)mode.mWidth, (int32_t)mode.mHeight, (int32_t)mode.mBitDepth, SDL_OPENGL | SDL_RESIZABLE);
SDL_WM_SetCaption(title.c_str(), nullptr);
}
void SDLWindowBackend::close()
{
SDL_Quit();
mWindow = nullptr;
}
bool SDLWindowBackend::isOpen() const
{
return mWindow != nullptr;
}
const ContextSettings SDLWindowBackend::getSettings() const
{
//settings not finalized;
return ContextSettings();
}
Vec2I SDLWindowBackend::getPosition() const
{
//not sure
//SDL_getenv("SDL_VIDEO_WINDOW_POS");
return Vec2I();
}
void SDLWindowBackend::setPosition(int32_t x, int32_t y)
{
(void)x;
(void)y;
//not sure
//std::stringstream ss;
//ss << "SDL_VIDEO_WINDOW_POS=" << x << ", " << y;
//SDL_putenv(ss.str());
}
Vec2I SDLWindowBackend::getSize() const
{
//not sure
return Vec2I();
}
void SDLWindowBackend::setSize(int32_t w, int32_t h)
{
mWindow = SDL_SetVideoMode(w, h, 32, SDL_OPENGL | SDL_RESIZABLE);
}
void SDLWindowBackend::setTitle(const std::string& title)
{
SDL_WM_SetCaption(title.c_str(), nullptr);
}
void SDLWindowBackend::setIcon(uint32_t width, uint32_t height, const uint8_t* pixels)
{
//should be fixed
(void)width;
(void)height;
SDL_WM_SetCaption("shouldbetitle", (char*)pixels);
}
void SDLWindowBackend::setVisible(bool visible)
{
//should be fixed
(void) visible;
}
void SDLWindowBackend::setVSyncEnabled(bool enabled)
{
//should be fixed
(void) enabled;
}
void SDLWindowBackend::setMouseCursorVisible(bool visible)
{
//should be fixed
(void)visible;
}
void SDLWindowBackend::setFramerateLimit(uint32_t limit)
{
//should be fixed
(void)limit;
}
bool SDLWindowBackend::setRenderingActive(bool active) const
{
//should be fixed
(void)active;
return true;
}
void SDLWindowBackend::swapBuffers()
{
SDL_GL_SwapBuffers();
}
void SDLWindowBackend::lockCursor(bool lock)
{
(void)lock;
}
SDLWindowBackend::~SDLWindowBackend()
{
}
}