]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/client/client_config.c
refactoring
[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 };
11
12 #define NUM_CONFIG_ENTRIES 5
13 static ConfigEntry config_entries[NUM_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
41 __attribute__((constructor)) static void client_config_init()
42 {
43         config_read("client.conf", config_entries, NUM_CONFIG_ENTRIES);
44 }
45
46 __attribute__((destructor)) static void client_config_deinit()
47 {
48         config_free(config_entries, NUM_CONFIG_ENTRIES);
49 }