formatting and removed ifdef around setting declaration

This commit is contained in:
David Griswold 2024-07-15 21:43:00 -05:00
parent 33265a7756
commit 4e5ba66038
5 changed files with 43 additions and 55 deletions

View file

@ -201,7 +201,6 @@ void Config::ReadValues() {
ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom);
#endif
// Utility
ReadSetting("Utility", Settings::values.dump_textures);
ReadSetting("Utility", Settings::values.custom_textures);

View file

@ -204,8 +204,8 @@ public:
explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val,
const std::string& name)
requires(ranged)
: value{default_val},
default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {}
: value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val},
label{name} {}
/**
* Returns a reference to the setting's value.
@ -461,8 +461,7 @@ struct Values {
// TODO: Add a null renderer backend for this, perhaps.
#error "At least one renderer must be enabled."
#endif
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"
};
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"};
SwitchableSetting<u32> physical_device{0, "physical_device"};
Setting<bool> use_gles{false, "use_gles"};
Setting<bool> renderer_debug{false, "renderer_debug"};
@ -499,7 +498,6 @@ struct Values {
Setting<u16> custom_bottom_bottom{480, "custom_bottom_bottom"};
Setting<u16> custom_second_layer_opacity{100, "custom_second_layer_opacity"};
#ifdef ANDROID
Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"};
Setting<u16> custom_portrait_top_left{0, "custom_portrait_top_left"};
Setting<u16> custom_portrait_top_top{0, "custom_portrait_top_top"};
@ -509,7 +507,6 @@ struct Values {
Setting<u16> custom_portrait_bottom_top{240, "custom_portrait_bottom_top"};
Setting<u16> custom_portrait_bottom_right{360, "custom_portrait_bottom_right"};
Setting<u16> custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"};
#endif
SwitchableSetting<float> bg_red{0.f, "bg_red"};
SwitchableSetting<float> bg_green{0.f, "bg_green"};

View file

@ -376,30 +376,22 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool
ASSERT(height > 0);
FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen};
u16 top_left = is_portrait_mode ?
Settings::values.custom_portrait_top_left.GetValue() :
Settings::values.custom_top_left.GetValue();
u16 top_right = is_portrait_mode ?
Settings::values.custom_portrait_top_right.GetValue() :
Settings::values.custom_top_right.GetValue();
u16 top_top = is_portrait_mode ?
Settings::values.custom_portrait_top_top.GetValue() :
Settings::values.custom_top_top.GetValue();
u16 top_bottom = is_portrait_mode ?
Settings::values.custom_portrait_top_bottom.GetValue() :
Settings::values.custom_top_bottom.GetValue();
u16 bottom_left = is_portrait_mode ?
Settings::values.custom_portrait_bottom_left.GetValue() :
Settings::values.custom_bottom_left.GetValue();
u16 bottom_right = is_portrait_mode ?
Settings::values.custom_portrait_bottom_right.GetValue() :
Settings::values.custom_bottom_right.GetValue();
u16 bottom_top = is_portrait_mode ?
Settings::values.custom_portrait_bottom_top.GetValue() :
Settings::values.custom_bottom_top.GetValue();
u16 bottom_bottom = is_portrait_mode ?
Settings::values.custom_portrait_bottom_bottom.GetValue() :
Settings::values.custom_bottom_bottom.GetValue();
u16 top_left = is_portrait_mode ? Settings::values.custom_portrait_top_left.GetValue()
: Settings::values.custom_top_left.GetValue();
u16 top_right = is_portrait_mode ? Settings::values.custom_portrait_top_right.GetValue()
: Settings::values.custom_top_right.GetValue();
u16 top_top = is_portrait_mode ? Settings::values.custom_portrait_top_top.GetValue()
: Settings::values.custom_top_top.GetValue();
u16 top_bottom = is_portrait_mode ? Settings::values.custom_portrait_top_bottom.GetValue()
: Settings::values.custom_top_bottom.GetValue();
u16 bottom_left = is_portrait_mode ? Settings::values.custom_portrait_bottom_left.GetValue()
: Settings::values.custom_bottom_left.GetValue();
u16 bottom_right = is_portrait_mode ? Settings::values.custom_portrait_bottom_right.GetValue()
: Settings::values.custom_bottom_right.GetValue();
u16 bottom_top = is_portrait_mode ? Settings::values.custom_portrait_bottom_top.GetValue()
: Settings::values.custom_bottom_top.GetValue();
u16 bottom_bottom = is_portrait_mode ? Settings::values.custom_portrait_bottom_bottom.GetValue()
: Settings::values.custom_bottom_bottom.GetValue();
Common::Rectangle<u32> top_screen{top_left, top_top, top_right, top_bottom};
Common::Rectangle<u32> bot_screen{bottom_left, bottom_top, bottom_right, bottom_bottom};
@ -422,15 +414,14 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
Settings::values.custom_bottom_right.GetValue()),
std::max(Settings::values.custom_top_bottom.GetValue(),
Settings::values.custom_bottom_bottom.GetValue()),
Settings::values.swap_screen.GetValue(),
is_portrait_mode);
Settings::values.swap_screen.GetValue(), is_portrait_mode);
} else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) {
return CustomFrameLayout(std::max(Settings::values.custom_portrait_top_right.GetValue(),
return CustomFrameLayout(
std::max(Settings::values.custom_portrait_top_right.GetValue(),
Settings::values.custom_portrait_bottom_right.GetValue()),
std::max(Settings::values.custom_portrait_top_bottom.GetValue(),
Settings::values.custom_portrait_bottom_bottom.GetValue()),
Settings::values.swap_screen.GetValue(),
is_portrait_mode);
Settings::values.swap_screen.GetValue(), is_portrait_mode);
}
int width, height;

View file

@ -145,7 +145,8 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
* @param height Window framebuffer height in pixels
* @return Newly created FramebufferLayout object with default screen regions initialized
*/
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool is_portrait_mode = false);
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped,
bool is_portrait_mode = false);
/**
* Convenience method to get frame layout by resolution scale