forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hide-interface.lua
37 lines (33 loc) · 1.01 KB
/
hide-interface.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local gui = require('gui')
local widgets = require('gui.widgets')
TransparentScreen = defclass(TransparentScreen, gui.ZScreen)
TransparentScreen.ATTRS {
focus_path='hide-interface',
pass_movement_keys=true,
pass_mouse_clicks=false,
defocusable=false,
}
function TransparentScreen:init()
self:addviews{
widgets.Panel{
frame_background=gui.TRANSPARENT_PEN,
visible=function() return dfhack.screen.inGraphicsMode() end,
},
widgets.Panel{
frame={h=5, w=50},
frame_background=gui.CLEAR_PEN,
frame_style=gui.FRAME_PANEL,
visible=function() return not dfhack.screen.inGraphicsMode() end,
subviews={
widgets.Label{
auto_width=true,
text='Interface cannot be hidden in ASCII mode.',
}
},
},
}
end
function TransparentScreen:onDismiss()
view = nil
end
view = view and view:raise() or TransparentScreen{}:show()