apply min button width and height in main menu

This commit is contained in:
in0finite 2019-07-28 21:54:14 +02:00
parent f28aeeb82a
commit 920d4e00b4
3 changed files with 17 additions and 2 deletions

View file

@ -100,7 +100,7 @@ namespace SanAndreasUnity.UI
public static bool DrawMenuEntry(string text) public static bool DrawMenuEntry(string text)
{ {
return GUIUtils.ButtonWithCalculatedSize(text); return GUIUtils.ButtonWithCalculatedSize(text, Instance.minButtonWidth, Instance.minButtonHeight);
} }
public static void RegisterMenuEntry (MenuEntry menuEntry) public static void RegisterMenuEntry (MenuEntry menuEntry)

View file

@ -85,10 +85,25 @@ namespace SanAndreasUnity.Utilities
return ButtonWithCalculatedSize(new GUIContent(text)); return ButtonWithCalculatedSize(new GUIContent(text));
} }
public static bool ButtonWithCalculatedSize(string text, float minWidth, float minHeight)
{
return ButtonWithCalculatedSize(new GUIContent(text), minWidth, minHeight);
}
public static bool ButtonWithCalculatedSize(GUIContent content) public static bool ButtonWithCalculatedSize(GUIContent content)
{
return ButtonWithCalculatedSize(content, 0f, 0f);
}
public static bool ButtonWithCalculatedSize(GUIContent content, float minWidth, float minHeight)
{ {
Vector2 size = CalcScreenSizeForContent (content, GUI.skin.button); Vector2 size = CalcScreenSizeForContent (content, GUI.skin.button);
if (size.x < minWidth)
size.x = minWidth;
if (size.y < minHeight)
size.y = minHeight;
return GUILayout.Button (content, GUILayout.Width (size.x), GUILayout.Height (size.y)); return GUILayout.Button (content, GUILayout.Width (size.x), GUILayout.Height (size.y));
} }

View file

@ -25,7 +25,7 @@
- Chat - Chat
- Android: set font size to 20 ; adapt UI: StartGame scrollview style, JoinGame scrollview style, main menu, options (save, load, use box as scrollview style, size), Utilities size, file browser size ; sliders should be larger ; camera zoom should be configurable (no need for persistence) ; use unsigned (debug) key alias ; increment build number ; test at 800x480 resolution ; - Android: set font size to 23 ; adapt UI: main menu (add min button size), options (save, load, size), Utilities size, file browser size ; sliders should be larger ; camera zoom should be configurable (no need for persistence) ; use unsigned (debug) key alias ; increment build number ; test at 800x480 resolution ;
- Touch input: - Touch input: