diff --git a/.gitignore b/.gitignore index 9f11b75..f2f3841 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea/ +.vscode/ +main diff --git a/main.c b/main.c new file mode 100644 index 0000000..b6c9eeb --- /dev/null +++ b/main.c @@ -0,0 +1,45 @@ +#include +#include + +GLFWwindow* createWindow(const char* title, int width, int height) { + int err = glfwInit(); + + if(err != GLFW_TRUE) { + perror("error initializing glfw"); + return NULL; + } + + if(glfwVulkanSupported() != GLFW_TRUE) { + perror("vulkan not supported"); + return NULL; + } + + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + GLFWwindow* window = glfwCreateWindow(width, height, title, NULL, NULL); + glfwSetWindowSizeLimits(window, width, height, width, height); + return window; +} + +void destroyWindow(GLFWwindow* window) { + glfwDestroyWindow(window); + glfwTerminate(); +} + +void loop(GLFWwindow* window) { + while(!glfwWindowShouldClose(window)) { + // ... + glfwPollEvents(); + } +} + +int main(int argc, const char *argv[]) { + GLFWwindow* window = createWindow("Test", 800, 600); + + if(window == NULL) { + return -1; + } + + loop(window); + destroyWindow(window); + return 0; +} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..4a5b979 --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc `pkg-config --static --libs glfw3` -o main main.c +./main