Adapt interface to display notch of mac laptops (#8666)

* Adapt interface to display notch of mac laptops

* `macNotchHeight` as a separate variable, and description for mac notch setting
This commit is contained in:
Alex Gusev
2023-06-04 22:43:07 +06:00
committed by GitHub
parent 97a603204b
commit 32c146cdf1
39 changed files with 365 additions and 281 deletions

View File

@@ -113,6 +113,8 @@ public class Vars implements Loadable{
public static final float tilePayload = tilesize * tilesize;
/** icon sizes for UI */
public static final float iconXLarge = 8*6f, iconLarge = 8*5f, iconMed = 8*4f, iconSmall = 8*3f;
/** macbook screen notch height */
public static float macNotchHeight = 32f;
/** for map generator dialog */
public static boolean updateEditorOnChange = false;
/** all choosable player colors in join/host dialog */

View File

@@ -490,6 +490,10 @@ public class SettingsMenuDialog extends BaseDialog{
graphics.checkPref("skipcoreanimation", false);
graphics.checkPref("hidedisplays", false);
if(OS.isMac){
graphics.checkPref("macnotch", false);
}
if(!mobile){
Core.settings.put("swapdiagonal", false);
}

View File

@@ -293,6 +293,11 @@ public class HudFragment{
//core info
parent.fill(t -> {
t.top();
if(Core.settings.getBool("macnotch") ){
t.margin(macNotchHeight);
}
t.visible(() -> shown);
t.name = "coreinfo";

View File

@@ -100,6 +100,9 @@ public class MenuFragment{
float fx = (int)(width / 2f);
float fy = (int)(height - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Scl.scl(30f) : 0f);
if(Core.settings.getBool("macnotch") ){
fy -= Scl.scl(macNotchHeight);
}
Draw.color();
Draw.rect(logo, fx, fy, logow, logoh);
@@ -277,7 +280,7 @@ public class MenuFragment{
addButton(text, Styles.none, callback);
}
/**
/**
* Adds a custom button to the menu.
* If {@link MenuButton#submenu} is null or the player is on mobile, {@link MenuButton#runnable} is invoked on click.
* Otherwise, {@link MenuButton#submenu} is shown.