#include #include #include "main.h" int main() { if (!glfwPlatformSupported(GLFW_PLATFORM_WAYLAND)) { printf("Wayland is not supported\n"); return 1; } glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND); if (!glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; } glfwSetErrorCallback(error_callback); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); if (window == NULL) { printf("Failed to create GLFW window\n"); glfwTerminate(); return 1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glViewport(0, 0, 800, 600); while(!glfwWindowShouldClose(window)) { processInput(window); glClearColor(0.121f, 0.157f, 0.246f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } void error_callback(int error, const char* description) { fprintf(stderr, "Error %d: %s\n", error, description); } void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } void processInput(GLFWwindow *window) { if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, GLFW_TRUE); } /* TODO */ /* void hexToRGB(CRT_RGB* rgb, const char* hex) { */ /* if (strlen(hex) == 0) { */ /* printf("Invalid hex: %s", hex); */ /* return; */ /* } */ /* if (hex[0] != '#') { */ /* printf("Invalid hex: %s", hex); */ /* return; */ /* } */ /* const char* r; */ /* const char* g; */ /* const char* b; */ /* } */