summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LUA_API.rst9
-rw-r--r--Lua API.html6
-rw-r--r--library/lua/gui.lua10
-rw-r--r--library/lua/gui/dwarfmode.lua6
-rw-r--r--library/modules/Screen.cpp4
5 files changed, 33 insertions, 2 deletions
diff --git a/LUA_API.rst b/LUA_API.rst
index d6044c23..5631e93a 100644
--- a/LUA_API.rst
+++ b/LUA_API.rst
@@ -1211,6 +1211,8 @@ The screen module implements support for drawing to the tiled screen of the game
Note that drawing only has any effect when done from callbacks, so it can only
be feasibly used in the core context.
+Basic painting functions:
+
* ``dfhack.screen.getWindowSize()``
Returns *width, height* of the screen.
@@ -1277,7 +1279,12 @@ be feasibly used in the core context.
In order to actually be able to paint to the screen, it is necessary
to create and register a viewscreen (basically a modal dialog) with
-the game. Screens are managed with the following functions:
+the game.
+
+**NOTE**: As a matter of policy, in order to avoid user confusion, all
+interface screens added by dfhack should bear the "DFHack" signature.
+
+Screens are managed with the following functions:
* ``dfhack.screen.show(screen[,below])``
diff --git a/Lua API.html b/Lua API.html
index 610202ce..0f1ecc3b 100644
--- a/Lua API.html
+++ b/Lua API.html
@@ -1391,6 +1391,7 @@ Returns <em>true, was_only_planned</em> if removed; or <em>false</em> if none fo
<p>The screen module implements support for drawing to the tiled screen of the game.
Note that drawing only has any effect when done from callbacks, so it can only
be feasibly used in the core context.</p>
+<p>Basic painting functions:</p>
<ul>
<li><p class="first"><tt class="docutils literal">dfhack.screen.getWindowSize()</tt></p>
<p>Returns <em>width, height</em> of the screen.</p>
@@ -1455,7 +1456,10 @@ functions in this section, this may be used at any time.</p>
</ul>
<p>In order to actually be able to paint to the screen, it is necessary
to create and register a viewscreen (basically a modal dialog) with
-the game. Screens are managed with the following functions:</p>
+the game.</p>
+<p><strong>NOTE</strong>: As a matter of policy, in order to avoid user confusion, all
+interface screens added by dfhack should bear the &quot;DFHack&quot; signature.</p>
+<p>Screens are managed with the following functions:</p>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">dfhack.screen.show(screen[,below])</span></tt></p>
<p>Displays the given screen, possibly placing it below a different one.
diff --git a/library/lua/gui.lua b/library/lua/gui.lua
index ee3bccb9..3156894d 100644
--- a/library/lua/gui.lua
+++ b/library/lua/gui.lua
@@ -245,9 +245,18 @@ end
-- Framed screen object --
------------------------
+-- Plain grey-colored frame.
GREY_FRAME = {
frame_pen = { ch = ' ', fg = COLOR_BLACK, bg = COLOR_GREY },
title_pen = { fg = COLOR_BLACK, bg = COLOR_WHITE },
+ signature_pen = { fg = COLOR_BLACK, bg = COLOR_GREY },
+}
+
+-- The usual boundary used by the DF screens. Often has fancy pattern in tilesets.
+BOUNDARY_FRAME = {
+ frame_pen = { ch = 0xDB, fg = COLOR_DARKGREY, bg = COLOR_BLACK },
+ title_pen = { fg = COLOR_BLACK, bg = COLOR_GREY },
+ signature_pen = { fg = COLOR_BLACK, bg = COLOR_DARKGREY },
}
function paint_frame(x1,y1,x2,y2,style,title)
@@ -260,6 +269,7 @@ function paint_frame(x1,y1,x2,y2,style,title)
dscreen.fillRect(style.b_frame_pen or style.h_frame_pen or pen,x1+1,y2,x2-1,y2)
dscreen.fillRect(style.l_frame_pen or style.v_frame_pen or pen,x1,y1+1,x1,y2-1)
dscreen.fillRect(style.r_frame_pen or style.v_frame_pen or pen,x2,y1+1,x2,y2-1)
+ dscreen.paintString(style.signature_pen or style.title_pen or pen,x2-7,y2,"DFHack")
if title then
local x = math.max(0,math.floor((x2-x1-3-#title)/2)) + x1
diff --git a/library/lua/gui/dwarfmode.lua b/library/lua/gui/dwarfmode.lua
index 8c761aef..f38b975f 100644
--- a/library/lua/gui/dwarfmode.lua
+++ b/library/lua/gui/dwarfmode.lua
@@ -163,6 +163,12 @@ function MenuOverlay:onRender()
local menu = self.df_layout.menu
if menu then
+ -- Paint signature on the frame.
+ dscreen.paintString(
+ {fg=COLOR_BLACK,bg=COLOR_DARKGREY},
+ menu.x1+1, menu.y2+1, "DFHack"
+ )
+
self:onRenderBody(gui.Painter.new(menu))
end
end
diff --git a/library/modules/Screen.cpp b/library/modules/Screen.cpp
index 7dcbba32..cadd4c6d 100644
--- a/library/modules/Screen.cpp
+++ b/library/modules/Screen.cpp
@@ -158,6 +158,7 @@ bool Screen::drawBorder(const std::string &title)
int dimx = gps->dimx, dimy = gps->dimy;
Pen border(0xDB, 8);
Pen text(0, 0, 7);
+ Pen signature(0, 0, 8);
for (int x = 0; x < dimx; x++)
{
@@ -169,6 +170,9 @@ bool Screen::drawBorder(const std::string &title)
doSetTile(border, 0 * dimy + y);
doSetTile(border, (dimx - 1) * dimy + y);
}
+
+ paintString(signature, dimx-8, dimy-1, "DFHack");
+
return paintString(text, (dimx - title.length()) / 2, 0, title);
}