lua use lcd_drawline to draw lines inside rliimages

rewrite draw_text to use new viewport buffer

set_viewport now accepts rliimage to allowe interfacing with rb. functions

fix long standing 2-bit bug with text drawing in lua
fix 2-bit img
saving bug (i'm guessing just a one off, just enabled clipping)

fix font_getstringsize bug

fix shape of numbers draw_num.lua also add auto centering

add page scrolling to printtable

add a new demo script 'stars'

Change-Id: I866905cee82ee89ebc0eb020a56a7ecdb101bf5e
This commit is contained in:
William Wilgus 2024-04-05 00:38:35 -04:00 committed by William Wilgus
parent 7f1b49693c
commit a6570b7d37
7 changed files with 432 additions and 107 deletions

View file

@ -76,7 +76,7 @@ local BLUE = _clr.set(WHITE, 0, 0, 255)
-------------------------------------------
local clrs
local CANCEL_BUTTON = rb.actions.PLA_CANCEL
local LCD_DEPTH = rb.LCD_DEPTH
-- EXAMPLES ---------------------------------------------------------------------- EXAMPLES---------------------------------------------------------------------
function my_blit(dst_val, dx, dy, src_val, sx, sy)
-- user defined blit operation
@ -84,7 +84,7 @@ function my_blit(dst_val, dx, dy, src_val, sx, sy)
--you may change pixels in both the source and dest image
--return nil to stop early
if _lcd.DEPTH < 2 then
if LCD_DEPTH < 2 then
return src_val
end
@ -518,7 +518,7 @@ function twist(img)
for ix = 1, _lcd.W, w do
y_col = y_col + 1
y = ims.y_pos[(y_col % 2) + 1]
if _lcd.DEPTH > 1 then
if LCD_DEPTH > 1 then
_lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BDEQC, colors[1])
else
_lcd:copy(ims.strip, ix, 1, 1, y, w, h, false, _blit.BSAND)
@ -767,10 +767,10 @@ function long_text()
local wait = 0
w = w + wp * 3
h = h + 4
local img = _img.new(w + 1, h)
local img = _img.new(w + 1, h + 1)
img:clear(BLACK)
_draw.rounded_rect_filled(img, 1, 1, w, h, 15, WHITE)
_draw_text(img, 1, 2, nil, nil, nil, BLACK, txt)
_draw_text(img, 1, 1, nil, nil, nil, BLACK, txt)
for p = -w + 1, w - 1 do
wait = 0
@ -858,7 +858,7 @@ function main_menu()
[14] = function(EXIT_) return true end
}
if _lcd.DEPTH < 2 then
if LCD_DEPTH < 2 then
table.remove(mt, 10)
table.remove(ft, 10)
end
@ -880,7 +880,7 @@ _timer("main") -- keep track of how long the program ran
-- Clear the screen
_lcd:clear(BLACK)
if _lcd.DEPTH > 1 then
if LCD_DEPTH > 1 then
--draw a gradient using available colors
if IS_COLOR_TARGET == true then
clrs = {