refactor toml reading a bit
This commit is contained in:
parent
c81f95e571
commit
e9f8dbebbf
@ -560,37 +560,22 @@ static bool initialize(void) {
|
||||
/* engine configuration */
|
||||
{
|
||||
toml_datum_t datum_texture_atlas_size = toml_int_in(engine, "texture_atlas_size");
|
||||
if (!datum_texture_atlas_size.ok) {
|
||||
if (!datum_texture_atlas_size.ok || datum_texture_atlas_size.u.i < 32) {
|
||||
ctx.texture_atlas_size = TEXTURE_ATLAS_SIZE_DEFAULT;
|
||||
} else {
|
||||
if (datum_texture_atlas_size.u.i < 32) {
|
||||
ctx.texture_atlas_size = TEXTURE_ATLAS_SIZE_DEFAULT;
|
||||
} else {
|
||||
ctx.texture_atlas_size = datum_texture_atlas_size.u.i;
|
||||
}
|
||||
}
|
||||
} else
|
||||
ctx.texture_atlas_size = datum_texture_atlas_size.u.i;
|
||||
|
||||
toml_datum_t datum_font_texture_size = toml_int_in(engine, "font_texture_size");
|
||||
if (!datum_font_texture_size.ok) {
|
||||
if (!datum_font_texture_size.ok || datum_font_texture_size.u.i < 1024) {
|
||||
ctx.font_texture_size = TEXT_FONT_TEXTURE_SIZE_DEFAULT;
|
||||
} else {
|
||||
if (datum_font_texture_size.u.i < 1024) {
|
||||
ctx.font_texture_size = TEXT_FONT_TEXTURE_SIZE_DEFAULT;
|
||||
} else {
|
||||
ctx.font_texture_size = datum_font_texture_size.u.i;
|
||||
}
|
||||
}
|
||||
} else
|
||||
ctx.font_texture_size = datum_font_texture_size.u.i;
|
||||
|
||||
toml_datum_t datum_font_oversampling = toml_int_in(engine, "font_oversampling");
|
||||
if (!datum_font_oversampling.ok) {
|
||||
if (!datum_font_oversampling.ok || datum_font_oversampling.u.i < 0) {
|
||||
ctx.font_oversampling = TEXT_FONT_OVERSAMPLING_DEFAULT;
|
||||
} else {
|
||||
if (datum_font_oversampling.u.i < 0) {
|
||||
ctx.font_oversampling = TEXT_FONT_OVERSAMPLING_DEFAULT;
|
||||
} else {
|
||||
ctx.font_oversampling = datum_font_oversampling.u.i;
|
||||
}
|
||||
}
|
||||
} else
|
||||
ctx.font_oversampling = datum_font_oversampling.u.i;
|
||||
|
||||
toml_datum_t datum_font_filtering = toml_string_in(engine, "font_filtering");
|
||||
if (!datum_font_filtering.ok) {
|
||||
@ -619,15 +604,10 @@ static bool initialize(void) {
|
||||
|
||||
/* input */
|
||||
toml_datum_t datum_keybind_slots = toml_int_in(engine, "keybind_slots");
|
||||
if (!datum_keybind_slots.ok) {
|
||||
if (!datum_keybind_slots.ok || datum_keybind_slots.u.i < 1) {
|
||||
ctx.keybind_slots = KEYBIND_SLOTS_DEFAULT;
|
||||
} else {
|
||||
if (datum_keybind_slots.u.i < 1) {
|
||||
ctx.keybind_slots = KEYBIND_SLOTS_DEFAULT;
|
||||
} else {
|
||||
ctx.keybind_slots = datum_keybind_slots.u.i;
|
||||
}
|
||||
}
|
||||
} else
|
||||
ctx.keybind_slots = datum_keybind_slots.u.i;
|
||||
}
|
||||
|
||||
input_state_init(&ctx.input);
|
||||
|
Loading…
Reference in New Issue
Block a user