diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sysapp/login/main.lua | 13 | ||||
-rw-r--r-- | src/syslua/lx/tk.lua | 57 |
2 files changed, 39 insertions, 31 deletions
diff --git a/src/sysapp/login/main.lua b/src/sysapp/login/main.lua index a246c87..1e9bba1 100644 --- a/src/sysapp/login/main.lua +++ b/src/sysapp/login/main.lua @@ -51,7 +51,8 @@ function alert(text, on_dismiss) tk.grid({}, { { tk.text({padding = 16}, text) }, { tk.box({center_content = true, height = 40}, - tk.text({background = tk.rgb(0, 255, 0), + tk.text({background = tk.rgb(0, 0, 0), + color = tk.rgb(0, 255, 0), padding = 4, on_click = function() win.close() end}, "Ok")) @@ -84,9 +85,8 @@ local function open_listing(path) tk.text(name), tk.text(tostring(size)), tk.box({center_content = true, width = 32}, - tk.text({background = tk.rgb(128, 128, 255), - padding =2, - text_size = 12, + tk.text({background = tk.rgb(0, 0, 0), + color = tk.rgb(128, 128, 255), on_click = function() open_listing(path) end}, "open")) } @@ -125,9 +125,8 @@ local function fsline(fs) return { tk.text(fs .. ":/"), tk.box({center_content = true, width = 32}, - tk.text({background = tk.rgb(128, 128, 255), - padding =2, - text_size = 12, + tk.text({background = tk.rgb(0, 0, 0), + color = tk.rgb(128, 128, 255), on_click = function() open_listing(fs .. ":/") end}, "open")) } diff --git a/src/syslua/lx/tk.lua b/src/syslua/lx/tk.lua index 628ab91..92043db 100644 --- a/src/syslua/lx/tk.lua +++ b/src/syslua/lx/tk.lua @@ -310,16 +310,22 @@ function tk.image(a, b) image.img = img function image:draw(x0, y0, buf) - local step = 20 - local halfstep = 10 - for x = x0 - (x0 % step), x0 + buf:width(), step do - for y = y0 - (y0 % step), y0 + buf:height(), step do - buf:fillrect(x - x0, y - y0, halfstep, halfstep, buf:rgb(150, 150, 150)) - buf:fillrect(x - x0 + halfstep, y - y0 + halfstep, halfstep, halfstep, buf:rgb(150, 150, 150)) - buf:fillrect(x - x0 + halfstep, y - y0, halfstep, halfstep, buf:rgb(170, 170, 170)) - buf:fillrect(x - x0, y - y0 + halfstep, halfstep, halfstep, buf:rgb(170, 170, 170)) - end - end + local step = 4 + local halfstep = 2 + for y = y0 - (y0 % step), y0 + buf:height(), step do + buf:fillrect(0, y - y0, buf:width(), halfstep, buf:rgb(64, 64, 64)) + buf:fillrect(0, y - y0 + halfstep, buf:width(), halfstep, buf:rgb(80, 80, 80)) + end + -- local step = 20 + -- local halfstep = 10 + -- for x = x0 - (x0 % step), x0 + buf:width(), step do + -- for y = y0 - (y0 % step), y0 + buf:height(), step do + -- buf:fillrect(x - x0, y - y0, halfstep, halfstep, buf:rgb(150, 150, 150)) + -- buf:fillrect(x - x0 + halfstep, y - y0 + halfstep, halfstep, halfstep, buf:rgb(150, 150, 150)) + -- buf:fillrect(x - x0 + halfstep, y - y0, halfstep, halfstep, buf:rgb(170, 170, 170)) + -- buf:fillrect(x - x0, y - y0 + halfstep, halfstep, halfstep, buf:rgb(170, 170, 170)) + -- end + -- end if x0 < self.img:width() and y0 < self.img:height() then buf:blit(0, 0, self.img:sub(x0, y0, self.img:width(), self.img:height())) end @@ -335,8 +341,8 @@ function tk.text(a, b) -- Some defaults opts.text_size = opts.text_size or 16 opts.padding = opts.padding or 2 - opts.background = opts.background or tk.rgb(220, 220, 220) - opts.color = opts.color or tk.rgb(0, 0, 0) + opts.background = opts.background or tk.rgb(0, 0, 0) + opts.color = opts.color or tk.rgb(255, 255, 255) opts.line_spacing = opts.line_spacing or 1 if opts.word_wrap == nil then opts.word_wrap = true end opts.font = opts.font or tk.fonts.default @@ -383,7 +389,7 @@ function tk.box(a, b) opts.min_height = opts.min_height or 8 opts.center_content = opts.center_content or false opts.constrain_size = opts.constrain_size or false - opts.background_color = opts.background_color or tk.rgb(220, 220, 220) + opts.background_color = opts.background_color or tk.rgb(0, 0, 0) opts.control_size = opts.control_size or 12 local box = tk.widget(content.width, content.height, opts) @@ -480,16 +486,16 @@ function tk.box(a, b) end if self.vresize or self.hresize then - buf:rect(self.width - csz - x0, self.height - csz - y0, csz, csz, buf:rgb(0, 0, 0)) - buf:fillrect(self.width - csz + 1 - x0, self.height - csz + 1 - y0, csz - 2, csz - 2, buf:rgb(255, 255, 255)) + buf:rect(self.width - csz - x0, self.height - csz - y0, csz, csz, buf:rgb(0, 255, 255)) + buf:fillrect(self.width - csz + 1 - x0, self.height - csz + 1 - y0, csz - 2, csz - 2, buf:rgb(0, 0, 0)) end if self.hscroll and self.width < self.content.width then local barsize, barpos = self:barcalc(self.content.x, self.content.width, self.width) - buf:fillrect(barpos + 4 - x0, self.height - csz + 2 - y0, barsize - 8, csz - 4, buf:rgb(0, 0, 0)) + buf:fillrect(barpos + 4 - x0, self.height - csz + 2 - y0, barsize - 8, csz - 4, buf:rgb(0, 255, 255)) end if self.vscroll and self.height < self.content.height then local barsize, barpos = self:barcalc(self.content.y, self.content.height, self.height) - buf:fillrect(self.width - csz + 2 - x0, barpos + 4 - y0, csz - 4, barsize - 8, buf:rgb(0, 0, 0)) + buf:fillrect(self.width - csz + 2 - x0, barpos + 4 - y0, csz - 4, barsize - 8, buf:rgb(0, 255, 255)) end end @@ -762,10 +768,10 @@ function tk.window_manager() function win:draw(x0, y0, buf) self:draw_sub(x0, y0, buf, self.content) - buf:rect(-x0, -y0, self.width, self.height, buf:rgb(255, 128, 0)) - buf:fillrect(-x0+1, -y0+1, win.width-2, 20, buf:rgb(255, 255, 255)) + buf:rect(-x0, -y0, self.width, self.height, buf:rgb(0, 128, 128)) + buf:fillrect(-x0+1, -y0+1, win.width-2, 20, buf:rgb(0, 0, 0)) if win.title then - buf:write(-x0+2, -y0+2, win.title, tk.fonts.default, 16, buf:rgb(0, 0, 0)) + buf:write(-x0+2, -y0+2, win.title, tk.fonts.default, 16, buf:rgb(255, 0, 255)) end end @@ -858,12 +864,15 @@ function tk.window_manager() function draw_background(x0, y0, buf) local step = 32 local halfstep = 16 + buf:fillrect(0, 0, buf:width(), buf:height(), buf:rgb(0, 0, 0)) for x = x0 - (x0 % step), x0 + buf:width(), step do for y = y0 - (y0 % step), y0 + buf:height(), step do - buf:fillrect(x - x0, y - y0, halfstep, halfstep, buf:rgb(110, 110, 140)) - buf:fillrect(x - x0 + halfstep, y - y0 + halfstep, halfstep, halfstep, buf:rgb(110, 110, 140)) - buf:fillrect(x - x0 + halfstep, y - y0, halfstep, halfstep, buf:rgb(110, 140, 110)) - buf:fillrect(x - x0, y - y0 + halfstep, halfstep, halfstep, buf:rgb(110, 140, 110)) + buf:fillrect(x - x0, y - y0 + halfstep, step, 1, buf:rgb(0, 0, 255)) + buf:fillrect(x - x0 + halfstep, y - y0, 1, step, buf:rgb(0, 0, 255)) + --buf:fillrect(x - x0, y - y0, halfstep, halfstep, buf:rgb(110, 110, 140)) + --buf:fillrect(x - x0 + halfstep, y - y0 + halfstep, halfstep, halfstep, buf:rgb(110, 110, 140)) + --buf:fillrect(x - x0 + halfstep, y - y0, halfstep, halfstep, buf:rgb(110, 140, 110)) + --buf:fillrect(x - x0, y - y0 + halfstep, halfstep, halfstep, buf:rgb(110, 140, 110)) end end end |