add gui.TRANSPARENT_PEN for clearing the UI layer

develop
Myk Taylor 2023-01-12 12:44:50 -08:00
parent 079d5e4178
commit 15998f2ebe
No known key found for this signature in database
3 changed files with 9 additions and 4 deletions

@ -3663,6 +3663,10 @@ Misc
The black pen used to clear the screen. In graphics mode, it will clear the The black pen used to clear the screen. In graphics mode, it will clear the
foreground and set the background to the standard black tile. foreground and set the background to the standard black tile.
* ``TRANSPARENT_PEN``
A pen that will clear all textures from the UI layer, making the tile transparent.
* ``KEEP_LOWER_PEN`` * ``KEEP_LOWER_PEN``
A pen that will write tiles over existing background tiles instead of clearing A pen that will write tiles over existing background tiles instead of clearing

@ -10,6 +10,7 @@ local getval = utils.getval
local to_pen = dfhack.pen.parse local to_pen = dfhack.pen.parse
CLEAR_PEN = to_pen{tile=909, ch=32, fg=0, bg=0, write_to_lower=true} CLEAR_PEN = to_pen{tile=909, ch=32, fg=0, bg=0, write_to_lower=true}
TRANSPARENT_PEN = to_pen{tile=0, ch=0}
KEEP_LOWER_PEN = to_pen{ch=32, fg=0, bg=0, keep_lower=true} KEEP_LOWER_PEN = to_pen{ch=32, fg=0, bg=0, keep_lower=true}
local FAKE_INPUT_KEYS = { local FAKE_INPUT_KEYS = {

@ -128,10 +128,10 @@ static bool doSetTile_map(const Pen &pen, int x, int y) {
return false; return false;
long texpos = pen.tile; long texpos = pen.tile;
if (texpos == 0) { if (!texpos && pen.ch)
texpos = init->font.large_font_texpos[(uint8_t)pen.ch]; texpos = init->font.large_font_texpos[(uint8_t)pen.ch];
} if (texpos)
vp->screentexpos_interface[index] = texpos; vp->screentexpos_interface[index] = texpos;
return true; return true;
} }
@ -196,7 +196,7 @@ static bool doSetTile_default(const Pen &pen, int x, int y, bool map)
*texpos_lower = pen.tile; *texpos_lower = pen.tile;
else else
*texpos = pen.tile; *texpos = pen.tile;
} else { } else if (pen.ch) {
screen[0] = uint8_t(pen.ch); screen[0] = uint8_t(pen.ch);
*texpos_lower = 909; // basic black background *texpos_lower = 909; // basic black background
} }