c3860cc1d3
Added `window::stop()` (sets GLFW close flag). Updated signal/timer handlers and Q key check to call it instead of using a separate `quit` bool in main(). This encapsulates the close state in the window class (no more external flag + manual checks). The render loop is now simpler. (The process_signals lambda and ASIO duration timer are retained.)
31 lines
570 B
C++
31 lines
570 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#define GLFW_INCLUDE_NONE
|
|
#include "GLFW/glfw3.h"
|
|
|
|
namespace cbt {
|
|
|
|
class window {
|
|
public:
|
|
explicit window(std::string title, int width, int height);
|
|
~window();
|
|
|
|
auto should_close() const -> bool;
|
|
auto valid() const -> bool;
|
|
auto swap_buffers() -> void;
|
|
auto poll_events() -> void;
|
|
auto raw() const -> GLFWwindow*;
|
|
auto stop() -> void;
|
|
|
|
private:
|
|
GLFWwindow* m_window = nullptr;
|
|
bool m_glfw_initialized = false;
|
|
|
|
static auto init_glfw() -> bool;
|
|
static auto terminate_glfw() -> void;
|
|
};
|
|
|
|
}
|