From 9bb1c5371affb2ff0b83256470dec7461b404264 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 4 May 2017 11:48:08 +0200 Subject: Beginning of tk.lua --- src/sysapp/login/main.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/sysapp/login') diff --git a/src/sysapp/login/main.lua b/src/sysapp/login/main.lua index de258b9..6be064d 100644 --- a/src/sysapp/login/main.lua +++ b/src/sysapp/login/main.lua @@ -6,6 +6,8 @@ local draw = require 'lx.draw' local gui = require 'lx.gui' local mainloop = require 'lx.mainloop' +local tk = require 'lx.tk' + print("Hello, world!") gui.open() @@ -17,8 +19,13 @@ for x = 0, 255, 16 do end end +local f = draw.load_image('root:/logo.png') +local img = tk.image_widget(f) +tk.init(gui, img) + gui.show_cursor() +--[[ local fnt = draw.load_ttf_font('sys:/fonts/vera.ttf') if fnt == nil then print("Could not load vera.ttf!") @@ -32,7 +39,7 @@ gui.on_mouse_down = function (lb, rb, mb) gui.hide_cursor() gui.surface:write(gui.mouse_x, gui.mouse_y, string.format("Click at %d, %d", gui.mouse_x, gui.mouse_y), fnt, 16, gui.surface:rgb(0, 0, 255)) txt_x = gui.mouse_x - txt_y = gui.mouse_y + fnt:text_height(" ") + txt_y = gui.mouse_y + 16 gui.show_cursor() end end @@ -40,9 +47,10 @@ end gui.on_text_input = function(chr) gui.hide_cursor() gui.surface:write(txt_x, txt_y, chr, fnt, 16, gui.surface:rgb(0, 0, 255)) - txt_x = txt_x + fnt:text_width(chr) + txt_x = txt_x + fnt:text_width(chr, 16) gui.show_cursor() end +--]] mainloop.run() -- cgit v1.2.3