From f776df6076725d14679b31168e3ede53c966182e Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 31 Oct 2017 22:11:18 +0000 Subject: renaming base folder --- yage/base/window.cpp | 89 ---------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 yage/base/window.cpp (limited to 'yage/base/window.cpp') diff --git a/yage/base/window.cpp b/yage/base/window.cpp deleted file mode 100644 index 5ac2d8dc..00000000 --- a/yage/base/window.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* ---------------------------------------------------------------------------- - * window.cpp - * - * Copyright (c) 2017 Yann Herklotz Grave -- MIT License - * See file LICENSE for more details - * ---------------------------------------------------------------------------- - */ - -#include "window.h" - -#include - -namespace yage -{ - -Window::Window() = default; - -Window::~Window() -{ - glfwDestroyWindow(window_); - glfwTerminate(); -} - -void Window::create(std::string window_name, int width, int height) -{ - if(glfwInit() == GLFW_FALSE) { - throw std::runtime_error("GLFW Initialisation failed"); - } - - glfwWindowHint(GLFW_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_VERSION_MINOR, 5); - - window_ = - glfwCreateWindow(width, height, window_name.c_str(), nullptr, nullptr); - if (window_ == nullptr) { - throw std::runtime_error("GLFW Window creation failed"); - } - - // initialize the gl context - glfwMakeContextCurrent(window_); - - // initialize glad - gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); - - // set vsync on - glfwSwapInterval(1); - - // set the clear color to black - glClearColor(0.f, 0.5f, 0.f, 1.f); - // set alpha blending - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // set the clear depth - glClearDepth(1.f); -} - -void Window::swapBuffer() -{ - // swap the window buffer - glfwSwapBuffers(window_); -} - -void Window::clearBuffer() -{ - // clears buffer with clear color - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -} - -void Window::hide() -{ - glfwHideWindow(window_); -} - -void Window::show() -{ - glfwShowWindow(window_); -} - -bool Window::shouldClose() -{ - return glfwWindowShouldClose(window_); -} - -void Window::pollEvents() const -{ - glfwPollEvents(); -} - -} // namespace yage -- cgit