Browse Source

button / gamepad input and window moved to gaming core

Kajetan Johannes Hammerle 3 years ago
parent
commit
c3f316ae57
15 changed files with 79 additions and 434 deletions
  1. 6 18
      Game.cpp
  2. 1 0
      Game.h
  3. 17 17
      Main.cpp
  4. 1 1
      gaming-core
  5. 0 41
      input/Button.cpp
  6. 0 21
      input/Button.h
  7. 29 151
      input/Controller.cpp
  8. 18 56
      input/Controller.h
  9. 5 4
      meson.build
  10. 0 4
      rendering/Options.cpp
  11. 0 12
      rendering/Options.h
  12. 1 1
      rendering/Renderer.cpp
  13. 1 3
      rendering/Renderer.h
  14. 0 74
      rendering/wrapper/Window.cpp
  15. 0 31
      rendering/wrapper/Window.h

+ 6 - 18
Game.cpp

@@ -16,30 +16,18 @@ float motionY = 0.0f;
 bool onGround = false;
 
 Game::Game(Controller& c, const Clock& fps, const Clock& tps) : controller(c), fps(fps), tps(tps) {
-    c.mapKey(GLFW_KEY_A, Controller::A);
-    c.mapKey(GLFW_KEY_S, Controller::B);
-    c.mapKey(GLFW_KEY_X, Controller::X);
-    c.mapKey(GLFW_KEY_Z, Controller::Y);
-    c.mapKey(GLFW_KEY_Q, Controller::L);
-    c.mapKey(GLFW_KEY_W, Controller::R);
-    c.mapKey(GLFW_KEY_E, Controller::START);
-    c.mapKey(GLFW_KEY_D, Controller::SELECT);
-    c.mapKey(GLFW_KEY_LEFT, Controller::LEFT);
-    c.mapKey(GLFW_KEY_RIGHT, Controller::RIGHT);
-    c.mapKey(GLFW_KEY_UP, Controller::UP);
-    c.mapKey(GLFW_KEY_DOWN, Controller::DOWN);
 }
 
 void Game::tick() {
     lastX = x;
     lastY = y;
-    if(controller.isDown(Controller::LEFT)) {
+    if(controller.left.isDown()) {
         x -= 7;
     }
-    if(controller.isDown(Controller::RIGHT)) {
+    if(controller.right.isDown()) {
         x += 7;
     }
-    if(controller.isDown(Controller::A) && onGround) {
+    if(controller.a.isDown() && onGround) {
         motionY = -15.0f;
         onGround = false;
     }
@@ -71,12 +59,12 @@ void Game::render(float lag, Renderer& renderer) const {
     float y = 0.0f;
     renderer.setStringSize(2);
     y = renderer.drawString(0.0f, y, s);
-    for(int i = 0; i < controller.getButtonAmount(); i++) {
-        s.clear().append(controller.getName(i)).append(": ").append(controller.getDownTime(i)).append(" ").append(controller.wasReleased(i));
+    for(const Button& b : controller.list) {
+        s.clear().append(b.getName()).append(": ").append(b.getDownTime()).append(" ").append(b.wasReleased());
         y = renderer.drawString(0.0f, y, s);
     }
 }
 
 bool Game::isRunning() const {
-    return !controller.isDown(Controller::SELECT);
+    return !controller.select.isDown();
 }

+ 1 - 0
Game.h

@@ -1,6 +1,7 @@
 #ifndef GAME_H
 #define GAME_H
 
+#include "input/Buttons.h"
 #include "input/Controller.h"
 #include "utils/Clock.h"
 #include "rendering/Renderer.h"

+ 17 - 17
Main.cpp

@@ -4,14 +4,14 @@
 #include "gaming-core/wrapper/GLFW.h"
 #include "gaming-core/wrapper/GL.h"
 #include "gaming-core/wrapper/GLEW.h"
-#include "rendering/wrapper/Window.h"
-#include "rendering/Options.h"
+#include "gaming-core/wrapper/Window.h"
+#include "gaming-core/wrapper/WindowOptions.h"
 #include "gaming-core/utils/Clock.h"
 #include "gaming-core/wrapper/Shader.h"
 #include "rendering/Renderer.h"
 #include "Game.h"
 
-bool parseArgs(int argAmount, char* const* args, Options& options) {
+bool parseArgs(int argAmount, char* const* args, WindowOptions& options) {
     while(true) {
         switch(getopt(argAmount, args, "fv")) {
             case '?':
@@ -29,32 +29,28 @@ bool parseArgs(int argAmount, char* const* args, Options& options) {
 }
 
 int main(int argAmount, char* const* args) {
-    Options options("Pigine");
-    if(parseArgs(argAmount, args, options)) {
+    WindowOptions options(3, 0, Size(800, 480), true, "Pigine");
+    if(parseArgs(argAmount, args, options) || GLFW::init()) {
         return 0;
     }
 
-    if(GLFW::init()) {
-        return 0;
-    }
-
-    Size size(800, 480);
-    Controller controller;
-    Window window(size, controller, options);
+    Window window(options);
     if(window.hasError() || GLEW::init()) {
         return 0;
     }
-
+    
     Shader shader("resources/shader/vertex.vs", "resources/shader/fragment.fs");
     if(shader.hasError()) {
         return 0;
     }
 
-    Renderer renderer(size, shader);
+    Renderer renderer(shader);
 
     Clock fps;
     Clock tps;
 
+    Buttons buttons(window);
+    Controller controller(buttons);
     static Game game(controller, fps, tps);
 
     window.show();
@@ -68,9 +64,12 @@ int main(int argAmount, char* const* args) {
         while(lag >= nanosPerTick) {
             lag -= nanosPerTick;
             tps.update();
-            controller.tick();
+            buttons.tick();
             game.tick();
         }
+        
+        Size size = window.getSize();
+        GL::setViewport(size.width, size.height);
 
         Matrix view;
         view.scale(Vector3(2.0f / size.width, -2.0f / size.height, 1.0f));
@@ -79,8 +78,9 @@ int main(int argAmount, char* const* args) {
 
         game.render(static_cast<float> (lag) / nanosPerTick, renderer);
         window.swapBuffers();
-
+        GL::clearFramebuffer();
+        
         glfwPollEvents();
     }
     return 0;
-}
+}

+ 1 - 1
gaming-core

@@ -1 +1 @@
-Subproject commit 43b70c7d121b7551e1c7e433d34628c8d2ec670e
+Subproject commit b071869bd3f254d2c1d619ff0dc2b47d7bd9899c

+ 0 - 41
input/Button.cpp

@@ -1,41 +0,0 @@
-#include "input/Button.h"
-
-Button::Button() : keyDown(false), buttonDown(false), released(false), downTime(0) {
-}
-
-void Button::pressKey() {
-    keyDown = true;
-}
-
-void Button::releaseKey() {
-    keyDown = false;
-}
-
-void Button::pressButton() {
-    buttonDown = true;
-}
-
-void Button::tick() {
-    if(released) {
-        downTime = 0;
-    }
-    released = false;
-    if(keyDown || buttonDown) {
-        downTime++;
-    } else {
-        released = downTime > 0;
-    }
-    buttonDown = false;
-}
-
-bool Button::isDown() const {
-    return downTime > 0;
-}
-
-int Button::getDownTime() const {
-    return downTime;
-}
-
-bool Button::wasReleased() const {
-    return released;
-}

+ 0 - 21
input/Button.h

@@ -1,21 +0,0 @@
-#ifndef BUTTON_H
-#define BUTTON_H
-
-class Button final {
-    bool keyDown;
-    bool buttonDown;
-    bool released;
-    int downTime;
-    
-public:
-    Button();
-    void pressKey();
-    void releaseKey();
-    void pressButton();
-    void tick();
-    bool isDown() const;
-    int getDownTime() const;
-    bool wasReleased() const;
-};
-
-#endif

+ 29 - 151
input/Controller.cpp

@@ -1,154 +1,32 @@
-#include <iostream>
-
 #include "input/Controller.h"
 
-Controller::Axis::Axis() : positive(0), negative(0), split(0.5f) {
-}
-
-Controller::Controller() : keyToButton(0), gamepadToButton(0), activeController(-1) {
-    mapGamepad(GLFW_GAMEPAD_BUTTON_A, Controller::A);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_B, Controller::B);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_X, Controller::X);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_Y, Controller::Y);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, Controller::L);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, Controller::R);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_BACK, Controller::SELECT);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_START, Controller::START);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_GUIDE, Controller::UNKNOWN);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_LEFT_THUMB, Controller::SELECT);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, Controller::START);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_DPAD_UP, Controller::UP);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, Controller::RIGHT);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_DPAD_DOWN, Controller::DOWN);
-    mapGamepad(GLFW_GAMEPAD_BUTTON_DPAD_LEFT, Controller::LEFT);
-    mapAxis(GLFW_GAMEPAD_AXIS_LEFT_X, Controller::RIGHT, Controller::LEFT);
-    mapAxis(GLFW_GAMEPAD_AXIS_LEFT_Y, Controller::DOWN, Controller::UP);
-    mapAxis(GLFW_GAMEPAD_AXIS_RIGHT_X, Controller::RIGHT, Controller::LEFT);
-    mapAxis(GLFW_GAMEPAD_AXIS_RIGHT_Y, Controller::DOWN, Controller::UP);
-    mapAxis(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, Controller::L, Controller::UNKNOWN, -0.9f);
-    mapAxis(GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, Controller::R, Controller::UNKNOWN, -0.9f);
-}
-
-bool Controller::mapKey(int key, int button) {
-    if(key < 0 || key >= keyToButton.getLength()) {
-        return true;
-    }
-    button++;
-    if(button < 0 || button >= buttons.getLength()) {
-        return true;
-    }
-    keyToButton[key] = button;
-    return false;
-}
-
-bool Controller::mapGamepad(int gamepad, int button) {
-    if(gamepad < 0 || gamepad >= gamepadToButton.getLength()) {
-        return true;
-    }
-    button++;
-    if(button < 0 || button >= buttons.getLength()) {
-        return true;
-    }
-    gamepadToButton[gamepad] = button;
-    return false;
-}
-
-bool Controller::mapAxis(int axis, int positiveButton, int negativeButton, float split) {
-    if(axis < 0 || axis >= axisToButton.getLength()) {
-        return true;
-    }
-    positiveButton++;
-    if(positiveButton < 0 || positiveButton >= buttons.getLength()) {
-        return true;
-    }
-    negativeButton++;
-    if(negativeButton < 0 || negativeButton >= buttons.getLength()) {
-        return true;
-    }
-    axisToButton[axis].positive = positiveButton;
-    axisToButton[axis].negative = negativeButton;
-    axisToButton[axis].split = split;
-    return false;
-}
-
-void Controller::press(int key) {
-    if(key < 0 || key >= keyToButton.getLength()) {
-        return;
-    }
-    buttons[keyToButton[key]].pressKey();
-}
-
-void Controller::release(int key) {
-    if(key < 0 || key >= keyToButton.getLength()) {
-        return;
-    }
-    buttons[keyToButton[key]].releaseKey();
-}
-
-void Controller::tick() {
-    for(Button& b : buttons) {
-        b.tick();
-    }
-    if(searchForGamepad()) {
-        checkGamepad();
-    }
-}
-
-bool Controller::searchForGamepad() {
-    if(activeController != -1) {
-        return true;
-    }
-    for(int i = GLFW_JOYSTICK_1; i <= GLFW_JOYSTICK_LAST; i++) {
-        if(glfwJoystickIsGamepad(i)) {
-            activeController = i;
-            return true;
-        }
-    }
-    return false;
-}
-
-void Controller::checkGamepad() {
-    GLFWgamepadstate state;
-    if(!glfwGetGamepadState(activeController, &state)) {
-        return;
-    }
-    for(int i = 0; i <= GLFW_GAMEPAD_BUTTON_LAST; i++) {
-        if(state.buttons[i]) {
-            buttons[gamepadToButton[i]].pressButton();
-        }
-    }
-    for(int i = 0; i <= GLFW_GAMEPAD_AXIS_LAST; i++) {
-        if(state.axes[i] > axisToButton[i].split) {
-            buttons[axisToButton[i].positive].pressButton();
-        } else if(state.axes[i] < -axisToButton[i].split) {
-            buttons[axisToButton[i].negative].pressButton();
-        }
-    }
-}
-
-int Controller::getButtonAmount() const {
-    return buttons.getLength() - 1;
-}
-
-const char* Controller::getName(int button) const {
-    static constexpr const char* buttonNames[BUTTON_AMOUNT] = {
-        "Unknown", "A", "B", "X", "Y", "L", "R", "Start", "Select", "Left", "Right", "Up", "Down"
-    };
-    return buttonNames[(button + 1) & getRangeMask(button + 1)];
-}
-
-bool Controller::isDown(int button) const {
-    return buttons[(button + 1) & getRangeMask(button + 1)].isDown();
-}
-
-int Controller::getDownTime(int button) const {
-    return buttons[(button + 1) & getRangeMask(button + 1)].getDownTime();
-}
-
-bool Controller::wasReleased(int button) const {
-    return buttons[(button + 1) & getRangeMask(button + 1)].wasReleased();
-}
-
-int Controller::getRangeMask(int button) const {
-    return -(button >= 0 && button < buttons.getLength());
+Controller::Controller(Buttons& bs) : list(bs.get()), a(bs.add(GLFW_KEY_A, "A")), b(bs.add(GLFW_KEY_S, "B")),
+x(bs.add(GLFW_KEY_X, "X")), y(bs.add(GLFW_KEY_Z, "Y")), l(bs.add(GLFW_KEY_Q, "L")), r(bs.add(GLFW_KEY_W, "R")),
+start(bs.add(GLFW_KEY_E, "Start")), select(bs.add(GLFW_KEY_D, "Select")), left(bs.add(GLFW_KEY_LEFT, "Left")),
+right(bs.add(GLFW_KEY_RIGHT, "Right")), up(bs.add(GLFW_KEY_UP, "Up")), down(bs.add(GLFW_KEY_DOWN, "Down")) {
+    bs.mapGamepadButton(a, GLFW_GAMEPAD_BUTTON_A);
+    bs.mapGamepadButton(b, GLFW_GAMEPAD_BUTTON_B);
+    bs.mapGamepadButton(x, GLFW_GAMEPAD_BUTTON_X);
+    bs.mapGamepadButton(y, GLFW_GAMEPAD_BUTTON_Y);
+    bs.mapGamepadButton(l, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER);
+    bs.mapGamepadButton(r, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER);
+    bs.mapGamepadButton(select, GLFW_GAMEPAD_BUTTON_BACK);
+    bs.mapGamepadButton(start, GLFW_GAMEPAD_BUTTON_START);
+    bs.mapGamepadButton(select, GLFW_GAMEPAD_BUTTON_LEFT_THUMB);
+    bs.mapGamepadButton(start, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB);
+    bs.mapGamepadButton(up, GLFW_GAMEPAD_BUTTON_DPAD_UP);
+    bs.mapGamepadButton(right, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT);
+    bs.mapGamepadButton(down, GLFW_GAMEPAD_BUTTON_DPAD_DOWN);
+    bs.mapGamepadButton(left, GLFW_GAMEPAD_BUTTON_DPAD_LEFT);
+    
+    bs.mapGamepadAxis(left, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
+    bs.mapGamepadAxis(right, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
+    bs.mapGamepadAxis(left, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
+    bs.mapGamepadAxis(right, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
+    bs.mapGamepadAxis(up, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
+    bs.mapGamepadAxis(down, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
+    bs.mapGamepadAxis(up, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
+    bs.mapGamepadAxis(down, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
+    bs.mapGamepadAxis(l, 0.1f, GLFW_GAMEPAD_AXIS_LEFT_TRIGGER);
+    bs.mapGamepadAxis(r, 0.1f, GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER);
 }

+ 18 - 56
input/Controller.h

@@ -1,62 +1,24 @@
 #ifndef CONTROLLER_H
 #define CONTROLLER_H
 
-#include <GL/glew.h>
-#include <GLFW/glfw3.h>
-
-#include "utils/Array.h"
-#include "input/Button.h"
-
-class Controller final {
-    static constexpr int BUTTON_AMOUNT = 13;
-    Array<Button, BUTTON_AMOUNT> buttons;
-    Array<int, 1 + GLFW_KEY_LAST> keyToButton;
-    Array<int, 1 + GLFW_GAMEPAD_BUTTON_LAST> gamepadToButton;
-
-    struct Axis {
-        int positive;
-        int negative;
-        float split;
-        Axis();
-    };
-    Array<Axis, 1 + GLFW_GAMEPAD_AXIS_LAST> axisToButton;
-
-    int activeController;
-
-public:
-    static constexpr int UNKNOWN = -1;
-    static constexpr int A = 0;
-    static constexpr int B = 1;
-    static constexpr int X = 2;
-    static constexpr int Y = 3;
-    static constexpr int L = 4;
-    static constexpr int R = 5;
-    static constexpr int START = 6;
-    static constexpr int SELECT = 7;
-    static constexpr int LEFT = 8;
-    static constexpr int RIGHT = 9;
-    static constexpr int UP = 10;
-    static constexpr int DOWN = 11;
-
-    Controller();
-    bool mapKey(int key, int button);
-
-    void press(int key);
-    void release(int key);
-    void tick();
-
-    int getButtonAmount() const;
-    const char* getName(int button) const;
-    bool isDown(int button) const;
-    int getDownTime(int button) const;
-    bool wasReleased(int button) const;
-
-private:
-    int getRangeMask(int button) const;
-    bool searchForGamepad();
-    void checkGamepad();
-    bool mapGamepad(int gamepad, int button);
-    bool mapAxis(int axis, int positiveButton, int negativeButton, float split = 0.5f);
+#include "gaming-core/input/Buttons.h"
+
+struct Controller {
+    const ButtonList& list;
+    const Button& a;
+    const Button& b;
+    const Button& x;
+    const Button& y;
+    const Button& l;
+    const Button& r;
+    const Button& start;
+    const Button& select;
+    const Button& left;
+    const Button& right;
+    const Button& up;
+    const Button& down;
+
+    Controller(Buttons& buttons);
 };
 
 #endif

+ 5 - 4
meson.build

@@ -16,15 +16,16 @@ sources = [
     'gaming-core/images/PNGReader.cpp',
     'gaming-core/wrapper/VertexBuffer.cpp',
     'gaming-core/wrapper/Attributes.cpp',
-    'rendering/wrapper/Window.cpp', 
+    'gaming-core/wrapper/Window.cpp', 
+    'gaming-core/wrapper/WindowOptions.cpp',
+    'gaming-core/input/Buttons.cpp',
+    'gaming-core/input/Button.cpp',
     'Game.cpp',
     'input/Controller.cpp',
-    'input/Button.cpp',
     'rendering/Renderer.cpp',
     'rendering/ColorRenderer.cpp',
     'rendering/FontRenderer.cpp',
-    'rendering/Mesh.cpp',
-    'rendering/Options.cpp'
+    'rendering/Mesh.cpp'
 ]
 
 glewDep = dependency('glew')

+ 0 - 4
rendering/Options.cpp

@@ -1,4 +0,0 @@
-#include "rendering/Options.h"
-
-Options::Options(const char* name) : name(name), fullscreen(false), vsync(false) {
-}

+ 0 - 12
rendering/Options.h

@@ -1,12 +0,0 @@
-#ifndef OPTIONS_H
-#define OPTIONS_H
-
-struct Options final {
-    const char* name;
-    bool fullscreen;
-    bool vsync;
-
-    Options(const char* name);
-};
-
-#endif

+ 1 - 1
rendering/Renderer.cpp

@@ -1,7 +1,7 @@
 #include "rendering/Renderer.h"
 #include "gaming-core/wrapper/GL.h"
 
-Renderer::Renderer(const Size& size, Shader& shader) : size(size), shader(shader), texture(true), color(true) {
+Renderer::Renderer(Shader& shader) : shader(shader), texture(true), color(true) {
     shader.use();
     GL::enableBlending();
     setTextureMode(false);

+ 1 - 3
rendering/Renderer.h

@@ -2,14 +2,13 @@
 #define RENDERER_H
 
 #include "gaming-core/wrapper/Shader.h"
-#include "utils/Size.h"
 #include "math/MatrixStack.h"
 #include "rendering/FontRenderer.h"
 #include "rendering/ColorRenderer.h"
 
 class Renderer final {
 public:
-    Renderer(const Size& size, Shader& shader);
+    Renderer(Shader& shader);
 
     void pop();
     void push();
@@ -36,7 +35,6 @@ private:
     void setTextureMode(bool b);
     void setColorMode(bool b);
     
-    const Size& size;
     Shader& shader;
     bool texture;
     bool color;

+ 0 - 74
rendering/wrapper/Window.cpp

@@ -1,74 +0,0 @@
-#include <iostream>
-
-#include "rendering/wrapper/Window.h"
-
-Window::Window(Size& size, Controller& controller, const Options& options) : window(nullptr), size(size),
-controller(controller) {
-    glfwDefaultWindowHints();
-    glfwWindowHint(GLFW_VISIBLE, 0);
-    glfwWindowHint(GLFW_RESIZABLE, 1);
-    glfwWindowHint(GLFW_DECORATED, !options.fullscreen);
-    glfwWindowHint(GLFW_DOUBLEBUFFER, 1);
-
-    glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
-    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
-    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
-
-    GLFWmonitor* monitor = options.fullscreen ? glfwGetPrimaryMonitor() : nullptr;
-    window = glfwCreateWindow(size.width, size.height, options.name, monitor, nullptr);
-    if(window == nullptr) {
-        std::cout << "could not create window\n";
-        return;
-    }
-    glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
-    glfwMakeContextCurrent(window);
-    glfwSwapInterval(options.vsync);
-
-    glfwSetWindowUserPointer(window, this);
-
-    glfwSetFramebufferSizeCallback(window, [](GLFWwindow* glfwWindow, int newWidth, int newHeight) {
-        glViewport(0, 0, newWidth, newHeight);
-        void* data = glfwGetWindowUserPointer(glfwWindow);
-        if(data == nullptr) {
-            return;
-        }
-        Window& w = *static_cast<Window*> (data);
-        w.size.width = newWidth;
-        w.size.height = newHeight;
-    });
-    glfwSetKeyCallback(window, [](GLFWwindow* glfwWindow, int key, int, int action, int) {
-        void* data = glfwGetWindowUserPointer(glfwWindow);
-        if(data == nullptr) {
-            return;
-        }
-        Window& w = *static_cast<Window*> (data);
-        if(action == GLFW_PRESS) {
-            w.controller.press(key);
-        } else if(action == GLFW_RELEASE) {
-            w.controller.release(key);
-        }
-    });
-}
-
-Window::~Window() {
-    if(window != nullptr) {
-        glfwDestroyWindow(window);
-    }
-}
-
-bool Window::hasError() const {
-    return window == nullptr;
-}
-
-void Window::show() {
-    glfwShowWindow(window);
-}
-
-bool Window::shouldClose() const {
-    return glfwWindowShouldClose(window);
-}
-
-void Window::swapBuffers() {
-    glfwSwapBuffers(window);
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-}

+ 0 - 31
rendering/wrapper/Window.h

@@ -1,31 +0,0 @@
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <GL/glew.h>
-#include <GLFW/glfw3.h>
-
-#include "utils/Size.h"
-#include "input/Controller.h"
-#include "rendering/Options.h"
-
-class Window final {
-    GLFWwindow* window;
-    Size& size;
-    Controller& controller;
-
-public:
-    Window(Size& size, Controller& controller, const Options& options);
-    ~Window();
-
-    Window(const Window&) = delete;
-    Window& operator=(const Window&) = delete;
-    Window(Window&&) = delete;
-    Window& operator=(Window&&) = delete;
-
-    bool hasError() const;
-    void show();
-    bool shouldClose() const;
-    void swapBuffers();
-};
-
-#endif