From 406323a9665a956a6e94e18d6349e8e58462b916 Mon Sep 17 00:00:00 2001 From: Jon Daniel Date: Thu, 16 Jan 2025 15:17:56 +0100 Subject: [PATCH] Fix example and add Makefile --- .gitignore | 2 ++ Makefile | 23 +++++++++++++++++++++++ examples/simple.c | 7 ++++--- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbdd632 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +example +example.* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6e4ba49 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +CC ?= gcc +INSTALL ?= install +RM ?= rm +PREFIX ?= /usr/local + +.PHONY: all +all: example + +example: examples/simple.c + $(CC) $(CPPFLAGS) $(CFLAGS) -I. $< -o example -lglfw -lm + +.PHONY: clean +clean: + $(RM) example + +.PHONY: install +install: gltext.h + $(INSTALL) $< $(PREFIX)/include/ + +.PHONY: uninstall +uninstall: gltext.h + $(RM) $(PREFIX)/include/$< + diff --git a/examples/simple.c b/examples/simple.c index 778a8ef..6f99b32 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -11,9 +11,10 @@ #include -#include /* https://github.com/Dav1dde/glad */ +#define GLAD_GL_IMPLEMENTATION +#include /* https://github.com/Dav1dde/glad */ +#define GLFW_INCLUDE_NONE #include /* https://github.com/glfw/glfw */ - #define GLT_IMPLEMENTATION #include "gltext.h" /* https://github.com/vallentin/glText */ @@ -52,7 +53,7 @@ int main(int argc, char *argv[]) glfwShowWindow(window); glfwMakeContextCurrent(window); - if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) + if (!gladLoadGL((GLADloadfunc)glfwGetProcAddress)) { fprintf(stderr, "Failed to load OpenGL functions and extensions\n"); glfwTerminate();