aboutsummaryrefslogtreecommitdiffstats
path: root/yage/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'yage/core/core.cpp')
-rw-r--r--yage/core/core.cpp37
1 files changed, 37 insertions, 0 deletions
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 <ymherklotz@gmail.com>
+ * MIT License, see LICENSE file for more details.
+ * ----------------------------------------------------------------------------
+ */
+
+#include "core.h"
+
+#include <GLFW/glfw3.h>
+
+#include <iostream>
+#include <stdexcept>
+
+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