Consistent title bar + render information in mainmenu (#10764)

This commit is contained in:
SmallJoker 2021-03-30 21:49:15 +02:00 committed by GitHub
parent f345d00a43
commit f4118a4fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 14 deletions

View File

@ -49,7 +49,7 @@ local tabs = {}
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
tabs.about = dofile(menupath .. DIR_DELIM .. "tab_about.lua")
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
@ -98,7 +98,7 @@ local function init_globals()
tv_main:add(tabs.content)
tv_main:add(tabs.settings)
tv_main:add(tabs.credits)
tv_main:add(tabs.about)
tv_main:set_global_event_handler(main_event_handler)
tv_main:set_fixed_size(false)

View File

@ -97,8 +97,8 @@ local function buildCreditList(source)
end
return {
name = "credits",
caption = fgettext("Credits"),
name = "about",
caption = fgettext("About"),
cbf_formspec = function(tabview, name, tabdata)
local logofile = defaulttexturedir .. "logo.png"
local version = core.get_version()
@ -119,11 +119,16 @@ return {
buildCreditList(previous_contributors) .. "," ..
";1]"
-- Render information
fs = fs .. "label[0.75,4.9;" ..
fgettext("Active renderer:") .. "\n" ..
core.formspec_escape(core.get_screen_info().render_info) .. "]"
if PLATFORM ~= "Android" then
fs = fs .. "tooltip[userdata;" ..
fgettext("Opens the directory that contains user-provided worlds, games, mods,\n" ..
"and texture packs in a file manager / explorer.") .. "]"
fs = fs .. "button[0,4.75;3.5,1;userdata;" .. fgettext("Open User Data Directory") .. "]"
fs = fs .. "button[0,4;3.5,1;userdata;" .. fgettext("Open User Data Directory") .. "]"
end
return fs

View File

@ -204,7 +204,8 @@ core.get_screen_info()
display_width = <width of display>,
display_height = <height of display>,
window_width = <current window width>,
window_height = <current window height>
window_height = <current window height>,
render_info = <active render information>
}

View File

@ -1390,9 +1390,21 @@ bool Game::createClient(const GameStartData &start_data)
std::wstring str = utf8_to_wide(PROJECT_NAME_C);
str += L" ";
str += utf8_to_wide(g_version_hash);
{
const wchar_t *text = nullptr;
if (simple_singleplayer_mode)
text = wgettext("Singleplayer");
else
text = wgettext("Multiplayer");
str += L" [";
str += text;
str += L"]";
delete text;
}
str += L" [";
str += driver->getName();
str += L"]";
device->setWindowCaption(str.c_str());
LocalPlayer *player = client->getEnv().getLocalPlayer();

View File

@ -856,14 +856,6 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
lua_pushnumber(L,RenderingEngine::getDisplayDensity());
lua_settable(L, top);
lua_pushstring(L,"display_width");
lua_pushnumber(L,RenderingEngine::getDisplaySize().X);
lua_settable(L, top);
lua_pushstring(L,"display_height");
lua_pushnumber(L,RenderingEngine::getDisplaySize().Y);
lua_settable(L, top);
const v2u32 &window_size = RenderingEngine::get_instance()->getWindowSize();
lua_pushstring(L,"window_width");
lua_pushnumber(L, window_size.X);
@ -872,6 +864,10 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
lua_pushstring(L,"window_height");
lua_pushnumber(L, window_size.Y);
lua_settable(L, top);
lua_pushstring(L, "render_info");
lua_pushstring(L, wide_to_utf8(RenderingEngine::get_video_driver()->getName()).c_str());
lua_settable(L, top);
return 1;
}