diff options
| author | Alexander Gavrilov | 2012-08-22 12:28:01 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-08-22 12:28:01 +0400 |
| commit | 2b79582e99654282a03ee10424db380942b04b10 (patch) | |
| tree | 7d1318c51ac1a6e64fe731b13c5a7f64f25db2cc /library | |
| parent | 8969fc9435859399441cc5bc4f4308411183ef46 (diff) | |
| download | dfhack-2b79582e99654282a03ee10424db380942b04b10.tar.gz dfhack-2b79582e99654282a03ee10424db380942b04b10.tar.bz2 dfhack-2b79582e99654282a03ee10424db380942b04b10.tar.xz | |
Implement a policy of marking DFHack-owned screens with a signature.
Diffstat (limited to 'library')
| -rw-r--r-- | library/lua/gui.lua | 10 | ||||
| -rw-r--r-- | library/lua/gui/dwarfmode.lua | 6 | ||||
| -rw-r--r-- | library/modules/Screen.cpp | 4 |
3 files changed, 20 insertions, 0 deletions
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); } |
