summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compile_flags.txt2
-rw-r--r--src/input.cpp8
-rw-r--r--src/input.h4
-rw-r--r--src/main.cpp10
4 files changed, 22 insertions, 2 deletions
diff --git a/src/compile_flags.txt b/src/compile_flags.txt
index 488bdcb..42dbe59 100644
--- a/src/compile_flags.txt
+++ b/src/compile_flags.txt
@@ -1,3 +1,3 @@
-I../glfw/build/include
-I../glad/include
-
+-I./
diff --git a/src/input.cpp b/src/input.cpp
new file mode 100644
index 0000000..ef5f410
--- /dev/null
+++ b/src/input.cpp
@@ -0,0 +1,8 @@
+#include "input.h"
+#include <GLFW/glfw3.h>
+
+void processInput(GLFWwindow *window)
+{
+ if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
+ glfwSetWindowShouldClose(window, true);
+}
diff --git a/src/input.h b/src/input.h
new file mode 100644
index 0000000..274489c
--- /dev/null
+++ b/src/input.h
@@ -0,0 +1,4 @@
+#pragma once
+#include <GLFW/glfw3.h>
+
+void processInput(GLFWwindow *window);
diff --git a/src/main.cpp b/src/main.cpp
index 05e27da..fd3a460 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,8 @@
#include <glad/glad.h>
#include <GLFW/glfw3.h>
+#include "input.h"
+
#include <iostream>
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
@@ -14,7 +16,7 @@ int main() {
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- GLFWwindow* window = glfwCreateWindow(800, 600, "Yep", NULL, NULL);
+ GLFWwindow* window = glfwCreateWindow(800, 600, "Ogle", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
@@ -33,8 +35,14 @@ int main() {
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
+ // game loop
while(!glfwWindowShouldClose(window))
{
+ processInput(window);
+
+ glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
glfwSwapBuffers(window);
glfwPollEvents();
}