tim_draw_lot -> tim_fill
This commit is contained in:
@@ -119,7 +119,7 @@ i32 main(void) {
|
|||||||
// draw every 10 ms
|
// draw every 10 ms
|
||||||
while (tim_run(60)) {
|
while (tim_run(60)) {
|
||||||
TimCell bg = tim_cell(" ", 0, BG);
|
TimCell bg = tim_cell(" ", 0, BG);
|
||||||
tim_draw_lot(bg, 0, 0, tim->w, tim->h);
|
tim_fill(bg, 0, 0, tim->w, tim->h);
|
||||||
|
|
||||||
if (snek.state == RUN) {
|
if (snek.state == RUN) {
|
||||||
game();
|
game();
|
||||||
|
|||||||
@@ -360,8 +360,8 @@ void tim_draw_row(TimCell cell, i32 x, i32 y, i32 w);
|
|||||||
// draw column of cells
|
// draw column of cells
|
||||||
void tim_draw_col(TimCell cell, i32 x, i32 y, i32 h);
|
void tim_draw_col(TimCell cell, i32 x, i32 y, i32 h);
|
||||||
|
|
||||||
// fill lot (area) of cells
|
// fill area with cells
|
||||||
void tim_draw_lot(TimCell cell, i32 x, i32 y, i32 w, i32 h);
|
void tim_fill(TimCell cell, i32 x, i32 y, i32 w, i32 h);
|
||||||
|
|
||||||
// draw string to line, tags potential wide characters
|
// draw string to line, tags potential wide characters
|
||||||
void tim_draw_str(cstr s, i32 x, i32 y, i32 w, u8 fg, u8 bg);
|
void tim_draw_str(cstr s, i32 x, i32 y, i32 w, u8 fg, u8 bg);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void tim_draw_col(TimCell cell, i32 x, i32 y, i32 h) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tim_draw_lot(TimCell cell, i32 x, i32 y, i32 w, i32 h) {
|
void tim_fill(TimCell cell, i32 x, i32 y, i32 w, i32 h) {
|
||||||
if (w > 0 && h > 0) {
|
if (w > 0 && h > 0) {
|
||||||
for (i32 iy = MAX(y, 0); iy < MIN(y + h, tim->h); iy++) {
|
for (i32 iy = MAX(y, 0); iy < MIN(y + h, tim->h); iy++) {
|
||||||
for (i32 ix = MAX(x, 0); ix < MIN(x + w, tim->w); ix++) {
|
for (i32 ix = MAX(x, 0); ix < MIN(x + w, tim->w); ix++) {
|
||||||
@@ -71,7 +71,7 @@ void tim_draw_box(i32 x, i32 y, i32 w, i32 h, u8 fg, u8 bg) {
|
|||||||
tim_draw_row(tim_cell("─", fg, bg), x + 1 , y + h - 1, w - 2);
|
tim_draw_row(tim_cell("─", fg, bg), x + 1 , y + h - 1, w - 2);
|
||||||
tim_draw_col(tim_cell("│", fg, bg), x , y + 1 , h - 2);
|
tim_draw_col(tim_cell("│", fg, bg), x , y + 1 , h - 2);
|
||||||
tim_draw_col(tim_cell("│", fg, bg), x + w - 1, y + 1 , h - 2);
|
tim_draw_col(tim_cell("│", fg, bg), x + w - 1, y + 1 , h - 2);
|
||||||
tim_draw_lot(tim_cell(" ", fg, bg), x + 1 , y + 1 , w - 2, h - 2);
|
tim_fill(tim_cell(" ", fg, bg), x + 1 , y + 1 , w - 2, h - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tim_draw_invert(i32 x, i32 y, i32 w) {
|
void tim_draw_invert(i32 x, i32 y, i32 w) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ void tim_label(cstr s, i32 x, i32 y, i32 w, i32 h, TimStyle style) {
|
|||||||
h = (h == A) ? t.lines : h;
|
h = (h == A) ? t.lines : h;
|
||||||
TimRect r = tim_scope_rect_to_absolute(x, y, w, h);
|
TimRect r = tim_scope_rect_to_absolute(x, y, w, h);
|
||||||
TimCell c = tim_cell(" ", style.fg, style.bg);
|
TimCell c = tim_cell(" ", style.fg, style.bg);
|
||||||
tim_draw_lot(c, r.x, r.y, r.w, r.h);
|
tim_fill(c, r.x, r.y, r.w, r.h);
|
||||||
TimLine l = {.s = s, .line = ""};
|
TimLine l = {.s = s, .line = ""};
|
||||||
for (i32 i = 0; tim_next_line(&l); i++) {
|
for (i32 i = 0; tim_next_line(&l); i++) {
|
||||||
tim_draw_str(l.line, r.x, r.y + i, l.width, c.fg, c.bg);
|
tim_draw_str(l.line, r.x, r.y + i, l.width, c.fg, c.bg);
|
||||||
|
|||||||
Reference in New Issue
Block a user