Fixing error to create the window in a safely way
This commit is contained in:
parent
ac620fb3b7
commit
aea1ee6822
2 changed files with 12 additions and 3 deletions
|
@ -12,9 +12,18 @@ namespace data {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
using modulesType = std::unordered_map<std::string, data::BasicData *>;
|
||||||
|
class Window;
|
||||||
|
|
||||||
|
[[nodiscard]] static std::optional<Window> create_window(
|
||||||
|
const GLFWerrorfun errorCallback,
|
||||||
|
GLFWframebuffersizefun framebufferCallback,
|
||||||
|
const bool debugOpengl,
|
||||||
|
GLFWwindow *shared,
|
||||||
|
std::initializer_list<modulesType::value_type> initializer) noexcept;
|
||||||
|
|
||||||
class Window final {
|
class Window final {
|
||||||
public:
|
public:
|
||||||
using modulesType = std::unordered_map<std::string, data::BasicData *>;
|
|
||||||
using windowPtr = GLFWwindow *;
|
using windowPtr = GLFWwindow *;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -56,7 +65,7 @@ namespace gui {
|
||||||
GLFWframebuffersizefun framebufferCallback,
|
GLFWframebuffersizefun framebufferCallback,
|
||||||
const bool debugOpengl,
|
const bool debugOpengl,
|
||||||
GLFWwindow *shared,
|
GLFWwindow *shared,
|
||||||
std::initializer_list<Window::modulesType::value_type> initializer) noexcept;
|
std::initializer_list<modulesType::value_type> initializer) noexcept;
|
||||||
|
|
||||||
~Window() noexcept;
|
~Window() noexcept;
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace gui {
|
||||||
const GLFWframebuffersizefun framebufferCallback,
|
const GLFWframebuffersizefun framebufferCallback,
|
||||||
const bool debugOpengl,
|
const bool debugOpengl,
|
||||||
GLFWwindow *shared,
|
GLFWwindow *shared,
|
||||||
const std::initializer_list<Window::modulesType::value_type> initializer
|
const std::initializer_list<modulesType::value_type> initializer
|
||||||
) noexcept {
|
) noexcept {
|
||||||
if (!init) {
|
if (!init) {
|
||||||
glfwSetErrorCallback(errorCallback);
|
glfwSetErrorCallback(errorCallback);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue