2016-06-22 12:29:39 +02:00
|
|
|
#ifndef GAMEWINDOW_HPP
|
|
|
|
#define GAMEWINDOW_HPP
|
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
#include <glm/vec2.hpp>
|
2016-06-22 12:29:39 +02:00
|
|
|
#include <string>
|
2017-10-26 00:44:45 +02:00
|
|
|
#include <SDL.h>
|
2016-06-22 12:29:39 +02:00
|
|
|
|
|
|
|
#include <render/GameRenderer.hpp>
|
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
class GameWindow {
|
2018-05-19 23:55:27 +02:00
|
|
|
SDL_Window* window = nullptr;
|
|
|
|
SDL_Surface* icon = nullptr;
|
|
|
|
SDL_GLContext glcontext{nullptr};
|
2016-06-22 12:29:39 +02:00
|
|
|
public:
|
2018-05-19 23:55:27 +02:00
|
|
|
GameWindow() = default;
|
2016-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
void create(const std::string& title, size_t w, size_t h, bool fullscreen);
|
|
|
|
void close();
|
2016-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
void showCursor();
|
|
|
|
void hideCursor();
|
2016-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
glm::ivec2 getSize() const;
|
2016-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
void swap() const {
|
|
|
|
SDL_GL_SwapWindow(window);
|
|
|
|
}
|
2016-06-22 12:29:39 +02:00
|
|
|
|
2016-09-09 22:13:20 +02:00
|
|
|
bool isOpen() const {
|
|
|
|
return !!window;
|
|
|
|
}
|
2016-06-22 12:29:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|