Skip to content

Commit 18c583e

Browse files
WuzzyRealBadAngel
Wuzzy
authored andcommittedNov 9, 2014
Add tooltips to main menu subgames button bar
1 parent 9b551d5 commit 18c583e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed
 

‎builtin/fstk/buttonbar.lua

+5-4
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ local function buttonbar_formspec(self)
5757
end
5858

5959
formspec = formspec ..
60-
string.format("image_button[%f,%f;%f,%f;%s;%s;%s;true;%s]",
60+
string.format("image_button[%f,%f;%f,%f;%s;%s;%s;true;%s]tooltip[%s;%s]",
6161
btn_pos.x, btn_pos.y, self.btn_size, self.btn_size,
6262
self.buttons[i].image, btn_name, self.buttons[i].caption,
63-
borders)
63+
borders, btn_name, self.buttons[i].tooltip)
6464
else
6565
--print("end of displayable buttons: orientation: " .. self.orientation)
6666
--print( "button_end: " .. (btn_pos.y + self.btn_size - (self.btn_size * 0.05)))
@@ -140,11 +140,12 @@ local buttonbar_metatable = {
140140

141141
delete = function(self) ui.delete(self) end,
142142

143-
add_button = function(self, name, caption, image)
143+
add_button = function(self, name, caption, image, tooltip)
144144
if caption == nil then caption = "" end
145145
if image == nil then image = "" end
146+
if tooltip == nil then tooltip = "" end
146147

147-
table.insert(self.buttons,{ name=name, caption=caption, image=image})
148+
table.insert(self.buttons,{ name=name, caption=caption, image=image, tooltip=tooltip})
148149
if self.orientation == "horizontal" then
149150
if ( (self.btn_size * #self.buttons) + (self.btn_size * 0.05 *2)
150151
> self.size.x ) then

‎builtin/mainmenu/tab_singleplayer.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ local function singleplayer_refresh_gamebar()
5353

5454
local image = nil
5555
local text = nil
56+
local tooltip = core.formspec_escape(gamemgr.games[i].name)
5657

5758
if gamemgr.games[i].menuicon_path ~= nil and
5859
gamemgr.games[i].menuicon_path ~= "" then
@@ -69,7 +70,7 @@ local function singleplayer_refresh_gamebar()
6970
text = text .. "\n" .. part3
7071
end
7172
end
72-
btnbar:add_button(btn_name, text, image)
73+
btnbar:add_button(btn_name, text, image, tooltip)
7374
end
7475
end
7576

0 commit comments

Comments
 (0)
Please sign in to comment.