diff --git a/data/art/icons.png b/data/art/icons.png new file mode 100644 index 000000000..141d9f79f Binary files /dev/null and b/data/art/icons.png differ diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 90815708d..9f3d590dd 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1692,6 +1692,7 @@ static const LuaWrapper::FunctionReg dfhack_textures_module[] = { WRAPM(Textures, getDfhackLogoTexposStart), WRAPM(Textures, getGreenPinTexposStart), WRAPM(Textures, getRedPinTexposStart), + WRAPM(Textures, getIconsTexposStart), { NULL, NULL } }; diff --git a/library/include/modules/Textures.h b/library/include/modules/Textures.h index e088ce477..e3e5a8ec0 100644 --- a/library/include/modules/Textures.h +++ b/library/include/modules/Textures.h @@ -31,9 +31,15 @@ void cleanup(); DFHACK_EXPORT long getDfhackLogoTexposStart(); /** - * Get the texpos for the UI pin tiles. Each are 2x2 grids. + * Get the first texpos for the UI pin tiles. Each are 2x2 grids. */ DFHACK_EXPORT long getGreenPinTexposStart(); DFHACK_EXPORT long getRedPinTexposStart(); + +/** + * Get the first texpos for the DFHack icons. It's a 5x2 grid. + */ +DFHACK_EXPORT long getIconsTexposStart(); + } } diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 9293e737c..62f4d2beb 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -1694,7 +1694,7 @@ function List:onRenderBody(dc) local function paint_icon(icon, obj) if type(icon) ~= 'string' then - dc:char(nil,icon) + dc:tile(nil,icon) else if current then dc:string(icon, obj.icon_pen or self.icon_pen or cur_pen) diff --git a/library/modules/Textures.cpp b/library/modules/Textures.cpp index 3ae8658c8..78ed53d97 100644 --- a/library/modules/Textures.cpp +++ b/library/modules/Textures.cpp @@ -21,6 +21,7 @@ static long g_num_dfhack_textures = 0; static long g_dfhack_logo_texpos_start = -1; static long g_green_pin_texpos_start = -1; static long g_red_pin_texpos_start = -1; +static long g_icons_texpos_start = -1; // Converts an arbitrary Surface to something like the display format // (32-bit RGBA), and converts magenta to transparency if convert_magenta is set @@ -117,6 +118,8 @@ void Textures::init(color_ostream &out) { &g_green_pin_texpos_start); g_num_dfhack_textures += load_textures(out, "hack/data/art/red-pin.png", &g_red_pin_texpos_start); + g_num_dfhack_textures += load_textures(out, "hack/data/art/icons.png", + &g_icons_texpos_start); DEBUG(textures,out).print("loaded %ld textures\n", g_num_dfhack_textures); @@ -160,3 +163,7 @@ long Textures::getGreenPinTexposStart() { long Textures::getRedPinTexposStart() { return g_red_pin_texpos_start; } + +long Textures::getIconsTexposStart() { + return g_icons_texpos_start; +}