mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 08:30:28 +00:00
Hide battery charge indicator on small screens (fixes #3714)
This commit is contained in:
parent
2dfe3f24b4
commit
4e9b2555df
@ -583,6 +583,7 @@ theme::theme(const config& cfg, const SDL_Rect& screen)
|
||||
, unit_image_()
|
||||
, palette_()
|
||||
, border_()
|
||||
, screen_dimensions_(screen)
|
||||
{
|
||||
do_resolve_rects(expand_partialresolution(cfg), cfg_);
|
||||
set_resolution(screen);
|
||||
@ -613,6 +614,8 @@ theme& theme::operator=(theme&& other)
|
||||
|
||||
bool theme::set_resolution(const SDL_Rect& screen)
|
||||
{
|
||||
screen_dimensions_ = screen;
|
||||
|
||||
bool result = false;
|
||||
|
||||
int current_rating = 1000000;
|
||||
@ -756,7 +759,10 @@ void theme::add_object(const config& cfg)
|
||||
border_ = border_t(c);
|
||||
}
|
||||
|
||||
if(!desktop::battery_info::does_device_have_battery()) {
|
||||
// Battery charge indicator is always hidden if there isn't enough horizontal space
|
||||
// (GitHub issue #3714)
|
||||
static const int BATTERY_ICON_MIN_WIDTH = 1152;
|
||||
if(!desktop::battery_info::does_device_have_battery() || screen_dimensions_.w < BATTERY_ICON_MIN_WIDTH) {
|
||||
if(const config& c = cfg.child("no_battery")) {
|
||||
modify(c);
|
||||
}
|
||||
|
@ -308,4 +308,6 @@ private:
|
||||
object main_map_, mini_map_, unit_image_, palette_;
|
||||
|
||||
border_t border_;
|
||||
|
||||
SDL_Rect screen_dimensions_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user