diff options
author | Alex Auvolat <alex@adnab.me> | 2018-04-01 18:13:40 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-04-01 18:13:40 +0200 |
commit | 45b7ea4c94bed7abcf8b27e5d716be240110740d (patch) | |
tree | c554ba85a436b9ff0e2c981266b907a2235c2ac6 /src/syslua | |
parent | 0fcc7fcab8cc13fb9ab54feafbd46cf15b4871ea (diff) | |
download | kogata-45b7ea4c94bed7abcf8b27e5d716be240110740d.tar.gz kogata-45b7ea4c94bed7abcf8b27e5d716be240110740d.zip |
Retrowave/cyberpunk theme try
Diffstat (limited to 'src/syslua')
-rw-r--r-- | src/syslua/lx/tk.lua | 57 |
1 files changed, 33 insertions, 24 deletions
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 |