Add .clang-format and .gitignore
This commit is contained in:
28
src/window.c
28
src/window.c
@@ -8,7 +8,7 @@ void __mouse_callback_input(GLFWwindow *, int, int, int);
|
||||
void __scroll_callback_input(GLFWwindow *, double, double);
|
||||
void __key_callback_input(GLFWwindow *, int, int, int, int);
|
||||
|
||||
window_t init_window(unsigned int w, unsigned int h, const char * name);
|
||||
window_t init_window(unsigned int w, unsigned int h, const char *name);
|
||||
|
||||
/*
|
||||
Limitamos los FPS, contando el tiempo en el que
|
||||
@@ -16,8 +16,7 @@ window_t init_window(unsigned int w, unsigned int h, const char * name);
|
||||
para lograr los fps deseados.
|
||||
*/
|
||||
|
||||
static
|
||||
void __limit_fps_window(int max_fps)
|
||||
static void __limit_fps_window(int max_fps)
|
||||
{
|
||||
static double previous_time = 0.0;
|
||||
double current_time;
|
||||
@@ -45,7 +44,7 @@ window_t init_window(unsigned int width, unsigned int height, const char *title)
|
||||
{
|
||||
window_t window;
|
||||
|
||||
if( !glfwInit() )
|
||||
if (!glfwInit())
|
||||
return NULL;
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
@@ -59,30 +58,27 @@ window_t init_window(unsigned int width, unsigned int height, const char *title)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent((GLFWwindow*)(window));
|
||||
glfwMakeContextCurrent((GLFWwindow *)(window));
|
||||
|
||||
glfwSetWindowSizeCallback((GLFWwindow*)window, __window_callback_input);
|
||||
glfwSetMouseButtonCallback((GLFWwindow*)window, __mouse_callback_input);
|
||||
glfwSetScrollCallback((GLFWwindow*)window, __scroll_callback_input);
|
||||
glfwSetKeyCallback((GLFWwindow*)window, __key_callback_input);
|
||||
glfwSetWindowSizeCallback((GLFWwindow *)window, __window_callback_input);
|
||||
glfwSetMouseButtonCallback((GLFWwindow *)window, __mouse_callback_input);
|
||||
glfwSetScrollCallback((GLFWwindow *)window, __scroll_callback_input);
|
||||
glfwSetKeyCallback((GLFWwindow *)window, __key_callback_input);
|
||||
|
||||
__window_callback_input((GLFWwindow*)window, width, height );
|
||||
__window_callback_input((GLFWwindow *)window, width, height);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void use_window(window_t window)
|
||||
{
|
||||
glfwMakeContextCurrent((void*)window);
|
||||
}
|
||||
void use_window(window_t window) { glfwMakeContextCurrent((void *)window); }
|
||||
|
||||
int is_open_window(window_t window)
|
||||
{
|
||||
glfwSwapBuffers((void*)window);
|
||||
glfwSwapBuffers((void *)window);
|
||||
glfwPollEvents();
|
||||
|
||||
__limit_fps_window(60);
|
||||
return !glfwWindowShouldClose((void*)window);
|
||||
return !glfwWindowShouldClose((void *)window);
|
||||
}
|
||||
|
||||
void close_window(window_t window)
|
||||
|
||||
Reference in New Issue
Block a user