Add vsync setting
parent
3359396220
commit
5e478fd9a6
|
@ -5,6 +5,7 @@ struct ClientConfig client_config = {
|
|||
.antialiasing = 4,
|
||||
.mipmap = true,
|
||||
.render_distance = 255.0,
|
||||
.vsync = true,
|
||||
};
|
||||
|
||||
__attribute__((constructor)) static void client_config_init()
|
||||
|
@ -24,7 +25,12 @@ __attribute__((constructor)) static void client_config_init()
|
|||
.type = CT_FLOAT,
|
||||
.key = "render_distance",
|
||||
.value = &client_config.render_distance,
|
||||
},
|
||||
{
|
||||
.type = CT_BOOL,
|
||||
.key = "vsync",
|
||||
.value = &client_config.vsync,
|
||||
}
|
||||
}, 3);
|
||||
}, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ extern struct ClientConfig {
|
|||
unsigned int antialiasing;
|
||||
bool mipmap;
|
||||
double render_distance;
|
||||
bool vsync;
|
||||
} client_config;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,6 +82,9 @@ bool window_init(int width, int height)
|
|||
|
||||
glfwMakeContextCurrent(window.handle);
|
||||
|
||||
if (! client_config.vsync)
|
||||
glfwSwapInterval(0);
|
||||
|
||||
if (glewInit() != GLEW_OK) {
|
||||
fprintf(stderr, "Failed to initialize GLEW\n");
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue