From 09535633913069f4653c270501059c38c2d09a99 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 4 May 2018 18:36:07 +0100 Subject: Adding a core component, and removing implementation from yage.h --- yage/core/core.cpp | 37 +++++++++++++++++++++++++++++++++++++ yage/core/core.h | 37 +++++++++++++++++++++++++++++++++++++ yage/yage.cpp | 37 ------------------------------------- yage/yage.h | 30 +----------------------------- 4 files changed, 75 insertions(+), 66 deletions(-) create mode 100644 yage/core/core.cpp create mode 100644 yage/core/core.h delete mode 100644 yage/yage.cpp (limited to 'yage') diff --git a/yage/core/core.cpp b/yage/core/core.cpp new file mode 100644 index 00000000..63051a49 --- /dev/null +++ b/yage/core/core.cpp @@ -0,0 +1,37 @@ +/** --------------------------------------------------------------------------- + * @file: core.cpp + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +#include "core.h" + +#include + +#include +#include + +namespace yage +{ + +void glfwErrorCallback(int, const char *description) +{ + std::cerr << "Error: " << description; +} + +void init() +{ + glfwSetErrorCallback(glfwErrorCallback); + if (glfwInit() == GLFW_FALSE) { + throw std::runtime_error("GLFW couldn't be initialised"); + } +} + +void quit() +{ + glfwTerminate(); +} + +} // namespace yage diff --git a/yage/core/core.h b/yage/core/core.h new file mode 100644 index 00000000..2d89955f --- /dev/null +++ b/yage/core/core.h @@ -0,0 +1,37 @@ +/** --------------------------------------------------------------------------- + * @file: core.h + * + * Copyright (c) 2017 Yann Herklotz Grave + * MIT License, see LICENSE file for more details. + * ---------------------------------------------------------------------------- + */ + +/** + * Project namespace. + * + * Avoids collision as all the classes and global functions are wrapped in. + */ +namespace yage +{ + +/** + * + */ +extern void glfwErrorCallback(int, const char *); + +/** + * Initializes YAGE. + * + * This is there to initialize GLFW, which is the current + * window manager that is used with OpenGL. + */ +extern void init(); + +/** + * Quit and cleanup YAGE. + * + * This also cleans up GLFW after it was initialized. + */ +extern void quit(); + +} // namespace yage diff --git a/yage/yage.cpp b/yage/yage.cpp deleted file mode 100644 index 68453181..00000000 --- a/yage/yage.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** --------------------------------------------------------------------------- - * @file: yage.cpp - * - * Copyright (c) 2017 Yann Herklotz Grave - * MIT License, see LICENSE file for more details. - * ---------------------------------------------------------------------------- - */ - -#include "yage.h" - -#include - -#include -#include - -namespace yage -{ - -void glfwErrorCallback(int, const char *description) -{ - std::cerr << "Error: " << description; -} - -void init() -{ - glfwSetErrorCallback(glfwErrorCallback); - if (glfwInit() == GLFW_FALSE) { - throw std::runtime_error("GLFW couldn't be initialised"); - } -} - -void quit() -{ - glfwTerminate(); -} - -} // namespace yage diff --git a/yage/yage.h b/yage/yage.h index d5b34603..038acbec 100644 --- a/yage/yage.h +++ b/yage/yage.h @@ -12,6 +12,7 @@ /** * Core includes */ +#include "core/core.h" #include "core/camera.h" #include "core/iomanager.h" #include "core/logger.h" @@ -51,34 +52,5 @@ * it more flexible and efficient. */ #include "entity/engine.h" -/** - * Project namespace. - * - * Avoids collision as all the classes and global functions are wrapped in. - */ -namespace yage -{ - -/** - * - */ -extern void glfwErrorCallback(int, const char *); - -/** - * Initializes YAGE. - * - * This is there to initialize GLFW, which is the current - * window manager that is used with OpenGL. - */ -extern void init(); - -/** - * Quit and cleanup YAGE. - * - * This also cleans up GLFW after it was initialized. - */ -extern void quit(); - -} // namespace yage #endif -- cgit