Cleaned up demo shadow drawing
This commit is contained in:
parent
0edd7a3ae8
commit
e5445010aa
7
C/test.c
7
C/test.c
@ -9,12 +9,15 @@ int main(void)
|
|||||||
int x = 1, y = 1;
|
int x = 1, y = 1;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
const char *title = "BTUI C Demo";
|
const char *title = "BTUI C Demo";
|
||||||
btui_set_attributes(bt, BTUI_BG_BLUE | BTUI_FG_BLACK);
|
|
||||||
int w = (int)strlen(title);
|
int w = (int)strlen(title);
|
||||||
int center = (bt->width - w) / 2;
|
int center = (bt->width - w) / 2;
|
||||||
btui_fill_box(bt, center-2, 0, w+4, 3);
|
|
||||||
|
btui_set_attributes(bt, BTUI_FG_BLUE | BTUI_BG_NORMAL);
|
||||||
btui_draw_shadow(bt, center-2, 0, w+4, 3);
|
btui_draw_shadow(bt, center-2, 0, w+4, 3);
|
||||||
|
|
||||||
|
btui_set_attributes(bt, BTUI_BG_BLUE | BTUI_FG_BLACK);
|
||||||
|
btui_fill_box(bt, center-2, 0, w+4, 3);
|
||||||
|
|
||||||
btui_move_cursor(bt, center, 1);
|
btui_move_cursor(bt, center, 1);
|
||||||
btui_printf(bt, "%s", title);
|
btui_printf(bt, "%s", title);
|
||||||
btui_set_attributes(bt, BTUI_NORMAL);
|
btui_set_attributes(bt, BTUI_NORMAL);
|
||||||
|
12
Lua/test.lua
12
Lua/test.lua
@ -22,12 +22,14 @@ btui(function(bt)
|
|||||||
bt:write("Pressed: ", key)
|
bt:write("Pressed: ", key)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
bt:withattributes("bg_blue", "fg_black", function()
|
local title = "Lua BTUI Demo"
|
||||||
local title = "Lua BTUI Demo"
|
local w = #title
|
||||||
local w = #title
|
local center = math.floor((bt:width() - w) / 2)
|
||||||
local center = math.floor((bt:width() - w) / 2)
|
bt:withattributes("fg_blue", "bg_normal", function()
|
||||||
bt:fillbox(center-2, 0, w+4, 3)
|
|
||||||
bt:shadow(center-2, 0, w+4, 3)
|
bt:shadow(center-2, 0, w+4, 3)
|
||||||
|
end)
|
||||||
|
bt:withattributes("bg_blue", "fg_black", function()
|
||||||
|
bt:fillbox(center-2, 0, w+4, 3)
|
||||||
bt:move(center, 1)
|
bt:move(center, 1)
|
||||||
bt:write(title)
|
bt:write(title)
|
||||||
end)
|
end)
|
||||||
|
@ -17,12 +17,13 @@ with open_btui() as bt:
|
|||||||
bt.move(x, y)
|
bt.move(x, y)
|
||||||
bt.write(f"Pressed: {key}")
|
bt.write(f"Pressed: {key}")
|
||||||
|
|
||||||
with bt.attributes("bg_blue", "fg_black"):
|
title = "Python BTUI Demo"
|
||||||
title = "Python bt Demo"
|
w = len(title)
|
||||||
w = len(title)
|
center = (bt.width - w) // 2
|
||||||
center = (bt.width - w) // 2
|
with bt.attributes("fg_blue", "bg_normal"):
|
||||||
bt.fill_box(center - 2, 0, w + 4, 3)
|
|
||||||
bt.draw_shadow(center - 2, 0, w + 4, 3)
|
bt.draw_shadow(center - 2, 0, w + 4, 3)
|
||||||
|
with bt.attributes("bg_blue", "fg_black"):
|
||||||
|
bt.fill_box(center - 2, 0, w + 4, 3)
|
||||||
bt.move(center, 1)
|
bt.move(center, 1)
|
||||||
bt.write(title)
|
bt.write(title)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user