New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add main_menu_style setting #6737
Conversation
builtin/mainmenu/init.lua
Outdated
if PLATFORM == "Android" then | ||
menustyle = "simple" | ||
else | ||
menustyle = full |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be the string "full" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes, thanks
builtin/mainmenu/init.lua
Outdated
menustyle = "simple" | ||
else | ||
menustyle = "full" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
menustyle = PLATFORM == "Android" and "simple" or "full"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know about that, thanks.
builtin/mainmenu/init.lua
Outdated
@@ -24,6 +24,15 @@ mt_color_dark_green = "#25C191" | |||
|
|||
local menupath = core.get_mainmenu_path() | |||
local basepath = core.get_builtin_path() | |||
local menustylesetting = core.settings:get("main_menu_style") | |||
local menustyle = menustylesetting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local menustyle = core.settings:get("main_menu_style")
, superfluous menustylesetting
EDIT:
local menustyle = core.settings:get("main_menu_style") or "default"
As there's no entry for the default value in defaultsettings.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If menustylesetting
is set to "default", then menustyle
depends on the platform. Should I just use menustyle
and then just redefine it?
builtin/mainmenu/init.lua
Outdated
@@ -24,6 +24,11 @@ mt_color_dark_green = "#25C191" | |||
|
|||
local menupath = core.get_mainmenu_path() | |||
local basepath = core.get_builtin_path() | |||
local menustyle = core.settings:get("main_menu_style") | |||
local menustyle = menustylesetting | |||
if menustyle == "default" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local menustyle = core.settings:get("main_menu_style") or "default"
if menustyle == "default" then
menustyle = PLATFORM == "Android" and "simple" or "full"
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I could swear I had changed this in my last commit. Will do ASAP.
Also, what does the or "default"
do? In settingtypes.txt, I set the default to the value default
, so I don't think that should be needed. But this is the only lua I've ever written, so I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core.settings:get
does not care about settingtypes.txt
. That file is only used (yet) to display accurate information in the Advanced Settings dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok. Where does it check? I've been looking at the code, but I'm having trouble figuring it out. Do I just need to add it to defaultsettings.cpp
?
Also, in minetest/src/script/lua_api/l_mainmenu.cpp
, I see lua_pushstring(L,"display_width");
and lua_pushstring(L,"display_height");
. Are these available from lua then, because I've been looking for a way to check screen size rather than platform, for tablets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed menustylesetting reference, added to defaultsettings.cpp
This is needed for Windows 10 laptops that toggle between Desktop and Tablet modes. It's the first half, and then the second half are the touchscreen controls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works.
|
@paramat maybe an android tablet? |
|
why
Because there's no keyboard.
Obviously, paramat.
…On Thu, Dec 28, 2017, 12:53 PM Paramat ***@***.***> wrote:
Above i'm referring to a switchable laptop, i know this is useful for
large-screen tablets.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6737 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWXKYoxWybrQpchnzi_PTrQV6Qgn7Mebks5tE9WTgaJpZM4Q1vrQ>
.
|
Even if you wanted touchscreen, you'd still likely want the full menu. Simple is just for small devices. In fact, I've been trying to find some way to set the default based on screen size rather than platform, but I'm having issues finding needed lua variables to do so. |
I misunderstood. |
In |
👍 from sfan5, implied by merge. |
Same as #6080, but using a branch besides master, and without the annoying (unintentional) reversion commit.
This adds a setting to change between the simple (currently Android) UI and the full computer UI. By default, Android uses the simple menu, while other platforms use the full one. (If there is a way to detect screen size from Minetest, I'd rather base the default on that than the platform, but I don't know of a way to do that.)