I decided that using 4 SPACES is better than mixing with tabs.

This commit is contained in:
2025-10-18 18:18:29 +02:00
parent e958fcdafe
commit f5faf5ae8c
4 changed files with 182 additions and 177 deletions

7
box.c
View File

@@ -23,6 +23,13 @@ static void draw_container(struct box *, double x, double y, double width, doubl
static void draw_button(struct box *, double x, double y, double width, double height);
void
append_box(struct box *parent, struct box *child)
{
parent->children[parent->length++] = child;
}
static void
draw_rectangle(double fx, double fy, double fwidth, double fheight)
{

1
box.h
View File

@@ -49,5 +49,6 @@ struct box *new_vertical_box(void);
struct box *new_horizontal_box(void);
struct box *new_chart_box(void);
void append_box(struct box *parent, struct box *child);
void draw_box(struct box *, double x, double y, double width, double height);

24
main.c
View File

@@ -24,9 +24,8 @@ main(void)
desc = new_button_box("A crypto-scam :-)");
top = new_vertical_box();
top->length = 2;
top->children[0] = title;
top->children[1] = desc;
append_box(top, title);
append_box(top, desc);
left = new_chart_box();
left->fills = 5;
@@ -39,23 +38,20 @@ main(void)
sell->color = UI_BLUE;
right = new_vertical_box();
right->length = 3;
right->children[0] = buy;
right->children[1] = sell;
right->children[2] = scam;
append_box(right, buy);
append_box(right, sell);
append_box(right, scam);
bottom = new_horizontal_box();
bottom->fills = 3;
bottom->length = 2;
bottom->children[0] = left;
bottom->children[1] = right;
append_box(bottom, left);
append_box(bottom, right);
ui = new_vertical_box();
ui->length = 2;
ui->children[0] = top;
ui->children[1] = bottom;
append_box(ui, top);
append_box(ui, bottom);
draw_box(ui, 0, 0, ui_width(), 40);
draw_box(ui, 0, 0, ui_width()-1, ui_height()-1);
ui_refresh();

3
ui.c
View File

@@ -11,7 +11,8 @@
#include "ui.h"
void ui_init(void)
void
ui_init(void)
{
srand(time(NULL));
initscr();