New Main Menu design (#101)

master
kilbith 2017-09-04 14:51:09 +02:00 committed by Maksim Gamarnik
parent 9da7375ab1
commit 717c46c9fe
16 changed files with 49 additions and 32 deletions

View File

@ -56,24 +56,34 @@ local function add_tab(self,tab)
end
end
local function get_bg(tsize, tabname)
tabname = tabname or "common"
return "background[0,0;" .. tsize.width .. "," .. tsize.height .. ";" ..
core.formspec_escape(defaulttexturedir ..
"multicraft_" .. tabname .. "_bg.png") .. ";true]"
end
--------------------------------------------------------------------------------
local function get_formspec(self)
local formspec = ""
local name = self.tablist[self.last_tab_index].name
local tabname = name == "local" and name or nil
if not self.hidden and (self.parent == nil or not self.parent.hidden) then
if self.parent == nil then
local tsize = self.tablist[self.last_tab_index].tabsize or
{width=self.width, height=self.height}
formspec = formspec ..
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
dump(self.fixed_size))
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
dump(self.fixed_size))
formspec = formspec .. get_bg(tsize, tabname)
end
formspec = formspec .. self:tab_header()
formspec = formspec ..
self.tablist[self.last_tab_index].get_formspec(
self,
self.tablist[self.last_tab_index].name,
self, name,
self.tablist[self.last_tab_index].tabdata,
self.tablist[self.last_tab_index].tabsize
)

View File

@ -31,20 +31,31 @@ local function get_formspec(tabview, name, tabdata)
)
retval = retval ..
"button[3.5,4.5;2.6,0.5;world_delete;".. fgettext("Delete") .. "]" ..
"button[6,4.5;2.8,0.5;world_create;".. fgettext("New") .. "]"
"image_button[0.45,4.9;2.9,0.8;" ..
core.formspec_escape(defaulttexturedir ..
"multicraft_local_delete_btn.png") .. ";world_delete;;true;false]" ..
"image_button[3.14,4.9;2.9,0.8;" ..
core.formspec_escape(defaulttexturedir ..
"multicraft_local_new_btn.png") .. ";world_create;;true;false]"
local creative_mode = core.settings:get_bool("creative_mode")
retval = retval ..
"button[8.7,4.5;3.30,0.5;play;".. fgettext("Play") .. "]" ..
"checkbox[0.0,4.25;cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
dump(core.settings:get_bool("creative_mode")) .. "]"..
"textlist[0,0;11.75,3.7;sp_worlds;" ..
"image_button[7,1.5;4.5,1.27;" ..
core.formspec_escape(defaulttexturedir ..
"multicraft_local_play_btn.png") .. ";play;;true;false]" ..
"image_button[7.25,3.15;4.05,0.8;" ..
core.formspec_escape(defaulttexturedir ..
"multicraft_local_creative_" ..
tostring(creative_mode) .. "_btn.png") ..
";cb_creative_mode;;true;false]" ..
"textlist[0,0;6.25,4.63;sp_worlds;" ..
menu_render_worldlist() ..
";" .. index .. ";true]"
return retval
end
local function main_button_handler(this, fields, name, tabdata)
assert(name == "local")
local world_doubleclick = false
@ -70,17 +81,13 @@ local function main_button_handler(this, fields, name, tabdata)
return true
end
if fields["cb_creative_mode"] then
core.settings:set("creative_mode", fields["cb_creative_mode"])
local bool = fields["cb_creative_mode"]
if bool == 'true' then
bool = 'false'
else
bool = 'true'
end
core.settings:set("enable_damage", bool)
return true
end
if fields.cb_creative_mode then
local creative_mode = core.settings:get_bool("creative_mode")
core.settings:set("creative_mode", tostring((not creative_mode)))
core.settings:set("enable_damage", tostring(creative_mode))
return true
end
if fields["cb_server"] then
core.settings:set("enable_server", fields["cb_server"])

View File

@ -33,8 +33,8 @@ local function get_formspec(tabview, name, tabdata)
local retval =
-- Search
"field[0.15,0.35;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
"button[5.8,0.1;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" ..
"field[0.15,0.5;6.05,0.27;te_search;;"..core.formspec_escape(tabdata.search_for).."]"..
"button[5.8,0.25;2,0.1;btn_mp_search;" .. fgettext("Search") .. "]" ..
-- Address / Port
"label[7.75,-0.25;" .. fgettext("Address / Port") .. "]" ..
@ -79,7 +79,7 @@ local function get_formspec(tabview, name, tabdata)
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
"color,span=1;" ..
"text,padding=1]" ..
"table[-0.15,0.6;7.75,5.15;favourites;"
"table[-0.15,0.8;7.75,4.75;favourites;"
if menudata.search_result then
for i = 1, #menudata.search_result do

View File

@ -166,7 +166,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("crosshair_alpha", "255");
settings->setDefault("hud_scaling", "1.0");
settings->setDefault("gui_scaling", "1.0");
settings->setDefault("gui_scaling_filter", "false");
settings->setDefault("gui_scaling_filter", "true");
settings->setDefault("gui_scaling_filter_txr2img", "true");
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
settings->setDefault("hud_hotbar_max_width", "1.0");

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

View File

@ -1 +1 @@
gameid = default
gameid = default

View File

@ -1 +1 @@
gameid = default
gameid = default

View File

@ -1 +1 @@
gameid = default
gameid = default

View File

@ -1 +1 @@
gameid = default
gameid = default

View File

@ -1 +1 @@
gameid = default
gameid = default