Loading...
Searching...
No Matches
window.c
Go to the documentation of this file.
#ifdef ARC_GLFW_WINDOW
#include "arc/graphics/window.h"
#include "window.h"
#include "arc/std/errno.h"
#include <GLFW/glfw3.h>
#include <stdio.h>
void framebufferSizeCallback(GLFWwindow *window, int width, int height){
glViewport(0, 0, width, height);
}
void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info){
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_FLOATING, GLFW_TRUE);
*window = (ARC_Window *) glfwCreateWindow(info->w, info->h, info->title, NULL, NULL);
if(*window == NULL){
printf("Failed to create GLFW window\n");
glfwTerminate();
arc_errno = ARC_ERRNO_NULL;
}
glfwMakeContextCurrent((GLFWwindow *)*window);
glViewport(0, 0, info->w, info->h);
glfwSetFramebufferSizeCallback((GLFWwindow *)*window, framebufferSizeCallback);
}
void ARC_Window_Destroy(ARC_Window *window){
glfwTerminate();
}
#endif //ARC_GLFW
errno.h
arc_errno
int32_t arc_errno
Definition errno.c:5
ARC_ERRNO_NULL
#define ARC_ERRNO_NULL
Definition errno.h:6
window.h
ARC_Window
struct ARC_WindowType ARC_Window
Definition window.h:13
ARC_Window_Create
void ARC_Window_Create(ARC_Window **window, ARC_WindowInfo *info)
creates ARC_Window type
Definition window.c:7
ARC_Window_Destroy
void ARC_Window_Destroy(ARC_Window *window)
destroys ARC_Window type
Definition window.c:29
window.h
ARC_WindowInfo
Definition window.h:18
ARC_WindowInfo::h
int32_t h
Definition window.h:21
ARC_WindowInfo::title
char * title
Definition window.h:19
ARC_WindowInfo::w
int32_t w
Definition window.h:20