]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/client/client_config.c
cc49c97b19a295d6829e4ff3c52c183731be8393
[dragonblocks_alpha.git] / src / client / client_config.c
1 #include "config.h"
2 #include "client/client_config.h"
3
4 struct ClientConfig client_config = {
5         .antialiasing = 4,
6         .mipmap = true,
7         .view_distance = 255.0,
8         .vsync = true,
9         .meshgen_threads = 4,
10         .swap_mouse_buttons = true,
11 };
12
13 static ConfigEntry config_entries[] = {
14         {
15                 .type = CONFIG_UINT,
16                 .key = "antialiasing",
17                 .value = &client_config.antialiasing,
18         },
19         {
20                 .type = CONFIG_BOOL,
21                 .key = "mipmap",
22                 .value = &client_config.mipmap,
23         },
24         {
25                 .type = CONFIG_FLOAT,
26                 .key = "view_distance",
27                 .value = &client_config.view_distance,
28         },
29         {
30                 .type = CONFIG_BOOL,
31                 .key = "vsync",
32                 .value = &client_config.vsync,
33         },
34         {
35                 .type = CONFIG_UINT,
36                 .key = "meshgen_threads",
37                 .value = &client_config.meshgen_threads,
38         },
39         {
40                 .type = CONFIG_BOOL,
41                 .key = "swap_mouse_buttons",
42                 .value = &client_config.meshgen_threads,
43         },
44 };
45
46 __attribute__((constructor)) static void client_config_init()
47 {
48         config_read("client.conf", config_entries, sizeof config_entries / sizeof *config_entries);
49 }
50
51 __attribute__((destructor)) static void client_config_deinit()
52 {
53         config_free(config_entries, sizeof config_entries / sizeof *config_entries);
54 }