blob: 54b53884681aa26e96764e85d6fbbdff0fb53172 (
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
|
#include "sdl_main_window.hpp"
#include <stdexcept>
namespace bookmouse {
SdlMainWindow::SdlMainWindow(const SdlContext& sdlContext)
{
sdlContext.setAttribute(SDL_GL_DOUBLEBUFFER, 1);
sdlContext.setAttribute(SDL_GL_DEPTH_SIZE, 24);
sdlContext.setAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE |
SDL_WINDOW_ALLOW_HIGHDPI);
m_window = SDL_CreateWindow(
"Dear ImGui SDL2+OpenGL3 example",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
1280,
720,
window_flags);
if (m_window == nullptr) {
const auto* lastError = SDL_GetError();
throw std::runtime_error{lastError};
}
}
SdlMainWindow::~SdlMainWindow()
{
SDL_DestroyWindow(m_window);
}
} // namespace bookmouse
|