summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-08-21 19:40:37 +0400
committerAlexander Gavrilov2012-08-21 19:40:37 +0400
commit15235cc93820a7ff712c71893c5f0df7af4f7873 (patch)
tree079cefa0a3df7c99151a7d1080d45b4b5b7843eb /scripts
parent451e965936c8e3fb911366abe40f2753772acfc2 (diff)
downloaddfhack-15235cc93820a7ff712c71893c5f0df7af4f7873.tar.gz
dfhack-15235cc93820a7ff712c71893c5f0df7af4f7873.tar.bz2
dfhack-15235cc93820a7ff712c71893c5f0df7af4f7873.tar.xz
More work on utilities for making lua viewscreens.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/devel/viewscreen.lua18
-rw-r--r--scripts/gui/hello-world.lua21
2 files changed, 21 insertions, 18 deletions
diff --git a/scripts/devel/viewscreen.lua b/scripts/devel/viewscreen.lua
deleted file mode 100644
index a07ea6f3..00000000
--- a/scripts/devel/viewscreen.lua
+++ /dev/null
@@ -1,18 +0,0 @@
--- Test lua viewscreens.
-
-local gui = require 'gui'
-
-local screen = mkinstance(gui.Screen, {
- onRender = function(self)
- local text = 'Woohoo, lua viewscreen :)'
- local dc = self:renderFrame(COLOR_GREY,'Hello World',#text+6,3)
- dc:seek(3,1):string(text, {fg=COLOR_LIGHTGREEN})
- end,
- onInput = function(self,keys)
- if keys and (keys.LEAVESCREEN or keys.SELECT) then
- self:dismiss()
- end
- end
-})
-
-screen:show()
diff --git a/scripts/gui/hello-world.lua b/scripts/gui/hello-world.lua
new file mode 100644
index 00000000..48f6675e
--- /dev/null
+++ b/scripts/gui/hello-world.lua
@@ -0,0 +1,21 @@
+-- Test lua viewscreens.
+
+local gui = require 'gui'
+
+local text = 'Woohoo, lua viewscreen :)'
+
+local screen = mkinstance(gui.FramedScreen, {
+ frame_title = 'Hello World',
+ frame_width = #text+6,
+ frame_height = 3,
+ onRenderBody = function(self, dc)
+ dc:seek(3,1):string(text, COLOR_LIGHTGREEN)
+ end,
+ onInput = function(self,keys)
+ if keys.LEAVESCREEN or keys.SELECT then
+ self:dismiss()
+ end
+ end
+})
+
+screen:show()