Allows flags for window creation to be passed
This commit is contained in:
parent
81278f0186
commit
74d8f56031
@ -17,8 +17,8 @@ using namespace sc::gui;
|
|||||||
std::vector<Window> Window::_windows;
|
std::vector<Window> Window::_windows;
|
||||||
std::map<SDL_WindowEventID, std::vector<WindowEventHandler>> Window::_global_event_handlers;
|
std::map<SDL_WindowEventID, std::vector<WindowEventHandler>> Window::_global_event_handlers;
|
||||||
|
|
||||||
Window& Window::new_window(const std::string& title) {
|
Window& Window::new_window(const std::string& title, Uint32 flags) {
|
||||||
_windows.emplace_back(title);
|
_windows.emplace_back(title, flags);
|
||||||
return _windows.back();
|
return _windows.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ bool Window::close(const SDL_Event& event) {
|
|||||||
return _windows.size() == 0;
|
return _windows.size() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Window(const std::string& title) : _title {title} {
|
Window::Window(const std::string& title, Uint32 flags) : _title {title} {
|
||||||
SDL_Window* win = SDL_CreateWindow(title.c_str(),
|
SDL_Window* win = SDL_CreateWindow(title.c_str(),
|
||||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
1600, 900,
|
1600, 900,
|
||||||
SDL_WINDOW_RESIZABLE);
|
flags);
|
||||||
_w.reset(win);
|
_w.reset(win);
|
||||||
_r.reset(SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED));
|
_r.reset(SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED));
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ namespace sc {
|
|||||||
static bool handle_global_event(const SDL_Event& event);
|
static bool handle_global_event(const SDL_Event& event);
|
||||||
static void add_global_event_handler(WindowEventHandler handler, SDL_WindowEventID type);
|
static void add_global_event_handler(WindowEventHandler handler, SDL_WindowEventID type);
|
||||||
static Window* from_sdl(Uint32 window_id);
|
static Window* from_sdl(Uint32 window_id);
|
||||||
static Window& new_window(const std::string& title);
|
static Window& new_window(const std::string& title, Uint32 flags = SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
Window(const std::string& title);
|
Window(const std::string& title, Uint32 flags);
|
||||||
|
|
||||||
void add_event_handler(WindowEventHandler handler, SDL_WindowEventID type);
|
void add_event_handler(WindowEventHandler handler, SDL_WindowEventID type);
|
||||||
bool handle_event(const SDL_Event& event, bool quit);
|
bool handle_event(const SDL_Event& event, bool quit);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user