created basic GLFW window

This commit is contained in:
Samuel Walker 2024-04-23 11:37:02 -06:00
parent ea33054175
commit 2f8e8a0a91
2 changed files with 23 additions and 1 deletions

View File

@ -2,7 +2,7 @@
CXX := g++
CXXFLAGS := -std=c++11 -c
LDFLAGS := -g
LDLIBS=
LDLIBS= -lglfw
srcfiles := $(wildcard */*.cpp)
objfiles := $(subst src,obj,$(subst .cpp,.o,$(srcfiles)))

View File

@ -1,6 +1,28 @@
#include <iostream>
#include <GLFW/glfw3.h>
int main(){
std::cout << "Testing from work" << std::endl;
if(!glfwInit()){
std::cerr << "Unable to initialize GLFW. Terminating." << std::endl;
return 0;
}
GLFWwindow* window = glfwCreateWindow(800, 600, "Test Window", NULL, NULL);
if(!window){
std::cerr << "Window creation failed. Terminating." << std::endl;
glfwTerminate();
return 0;
}
glfwMakeContextCurrent(window);
while(!glfwWindowShouldClose(window)){
// Game Loop
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}