Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified data/art/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed data/art/logo_hovered.png
Binary file not shown.
12 changes: 8 additions & 4 deletions docs/dev/Lua API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5945,17 +5945,21 @@ common text token lists that you can then pass as ``text`` to a ``Label``:
Example 2: The DFHack logo - a graphical button in graphics mode and a text
button in ASCII mode. The ASCII colors use the default for hovering::

local logo_textures=dfhack.textures.loadTileset(
'hack/data/art/logo.png', 8, 12, true),
widgets.Label{
text=widgets.makeButtonLabelText{
chars={
{179, 'D', 'F', 179},
{179, 'H', 'a', 179},
{179, 'c', 'k', 179},
},
tileset=dfhack.textures.loadTileset(
'hack/data/art/logo.png', 8, 12, true),
tileset_hover=dfhack.textures.loadTileset(
'hack/data/art/logo_hovered.png', 8, 12, true),
tileset=logo_textures,
tileset_offset=1,
tileset_stride=8,
tileset_hover=logo_textures,
tileset_hover_offset=5,
tileset_hover_stride=8,
},
on_click=function()
dfhack.run_command{'hotkeys', 'menu', self.name}
Expand Down
7 changes: 5 additions & 2 deletions plugins/lua/hotkeys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local overlay = require('plugins.overlay')
local widgets = require('gui.widgets')

local logo_textures = dfhack.textures.loadTileset('hack/data/art/logo.png', 8, 12, true)
local logo_hovered_textures = dfhack.textures.loadTileset('hack/data/art/logo_hovered.png', 8, 12, true)

local function get_command(cmdline)
local first_word = cmdline:trim():split(' +')[1]
Expand Down Expand Up @@ -41,7 +40,11 @@ function HotspotMenuWidget:init()
{VERT_BAR, 'c', 'k', VERT_BAR},
},
tileset=logo_textures,
tileset_hover=logo_hovered_textures,
tileset_offset=1,
tileset_stride=8,
tileset_hover=logo_textures,
tileset_hover_offset=5,
tileset_hover_stride=8,
},
on_click=function() dfhack.run_command{'hotkeys', 'menu', self.name} end,
},
Expand Down
Loading