build: fix compilation on Windows
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
dac89f64ce
commit
bd5196a9c9
2 changed files with 26 additions and 26 deletions
|
@ -16,18 +16,23 @@ public:
|
|||
|
||||
~wWindow() override;
|
||||
|
||||
wWindow(wWindow &&) = delete;
|
||||
|
||||
wWindow(const wWindow &) = delete;
|
||||
|
||||
auto operator=(wWindow &&) -> wWindow & = delete;
|
||||
|
||||
auto operator=(const wWindow &) -> wWindow & = delete;
|
||||
|
||||
void poll_events() override;
|
||||
|
||||
void on_event(const Event &event) override;
|
||||
|
||||
void set_properties(
|
||||
const WindowProperties &properties,
|
||||
bool overrideVisibility = false
|
||||
) override;
|
||||
void set_properties(const Properties &properties, bool overrideVisibility = false) override;
|
||||
|
||||
void set_title(const std::string &title) override;
|
||||
|
||||
void set_size(const glm::uvec2 &size, bool additive = false) override;
|
||||
void set_size(const math::uvec2 &size) override;
|
||||
|
||||
void set_v_sync(bool vsync, bool toggle = false) override;
|
||||
|
||||
|
@ -39,13 +44,17 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void on_window_resize(const WindowResizedEvent &event);
|
||||
|
||||
void bind_glfw_events();
|
||||
|
||||
GLFWwindow *m_handle { nullptr };
|
||||
|
||||
std::function<void(Event &)> m_event_callback;
|
||||
|
||||
void on_window_resize(const WindowResizedEvent &event);
|
||||
Properties m_properties {};
|
||||
|
||||
void bind_glfw_events();
|
||||
bool b_Closed {};
|
||||
};
|
||||
|
||||
} // namespace lt
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
namespace lt {
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
}
|
||||
Window::~Window() = default;
|
||||
|
||||
auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Window>
|
||||
{
|
||||
|
@ -20,17 +18,16 @@ auto Window::create(const std::function<void(Event &)> &callback) -> Scope<Windo
|
|||
wWindow::wWindow(std::function<void(Event &)> callback)
|
||||
: m_event_callback(std::move(std::move(callback)))
|
||||
{
|
||||
// init glfw
|
||||
ensure(glfwInit(), "wWindow::wWindow: failed to initialize 'glfw'");
|
||||
ensure(glfwInit(), "Failed to initialize 'glfw'");
|
||||
|
||||
// create window
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
|
||||
m_handle = glfwCreateWindow(1u, 1u, "", nullptr, nullptr);
|
||||
ensure(m_handle, "wWindow::wWindow: failed to create 'GLFWwindow'");
|
||||
ensure(m_handle, "Failed to create 'GLFWwindow'");
|
||||
|
||||
glfwSetWindowUserPointer(m_handle, &m_event_callback);
|
||||
bind_glfw_events();
|
||||
|
@ -57,6 +54,8 @@ void wWindow::on_event(const Event &event)
|
|||
case EventType::WindowResized:
|
||||
on_window_resize(dynamic_cast<const WindowResizedEvent &>(event));
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,8 +64,7 @@ void wWindow::on_window_resize(const WindowResizedEvent &event)
|
|||
m_properties.size = event.get_size();
|
||||
}
|
||||
|
||||
void wWindow::
|
||||
set_properties(const WindowProperties &properties, bool overrideVisibility /* = false */)
|
||||
void wWindow::set_properties(const Properties &properties, bool overrideVisibility /* = false */)
|
||||
{
|
||||
// save the visibility status and re-assign if 'overrideVisibility' is false
|
||||
auto visible = overrideVisibility ? properties.visible : m_properties.visible;
|
||||
|
@ -87,17 +85,10 @@ void wWindow::set_title(const std::string &title)
|
|||
glfwSetWindowTitle(m_handle, title.c_str());
|
||||
}
|
||||
|
||||
void wWindow::set_size(const glm::uvec2 &size, bool additive /* = false */)
|
||||
void wWindow::set_size(const math::uvec2 &size)
|
||||
{
|
||||
m_properties.size.x = size.x == 0u ? m_properties.size.x :
|
||||
additive ? m_properties.size.x + size.x :
|
||||
size.x;
|
||||
m_properties.size.y = size.y == 0u ? m_properties.size.y :
|
||||
additive ? m_properties.size.y + size.y :
|
||||
size.y;
|
||||
|
||||
|
||||
glfwSetWindowSize(m_handle, size.x, size.y);
|
||||
m_properties.size = size;
|
||||
glfwSetWindowSize(m_handle, static_cast<int>(size.x), static_cast<int>(size.y));
|
||||
}
|
||||
|
||||
void wWindow::set_v_sync(bool vsync, bool toggle /* = false */)
|
||||
|
|
Loading…
Add table
Reference in a new issue