I decided that using 4 SPACES is better than mixing with tabs.
This commit is contained in:
7
box.c
7
box.c
@@ -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);
|
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
|
static void
|
||||||
draw_rectangle(double fx, double fy, double fwidth, double fheight)
|
draw_rectangle(double fx, double fy, double fwidth, double fheight)
|
||||||
{
|
{
|
||||||
|
|||||||
1
box.h
1
box.h
@@ -49,5 +49,6 @@ struct box *new_vertical_box(void);
|
|||||||
struct box *new_horizontal_box(void);
|
struct box *new_horizontal_box(void);
|
||||||
struct box *new_chart_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);
|
void draw_box(struct box *, double x, double y, double width, double height);
|
||||||
|
|||||||
24
main.c
24
main.c
@@ -24,9 +24,8 @@ main(void)
|
|||||||
desc = new_button_box("A crypto-scam :-)");
|
desc = new_button_box("A crypto-scam :-)");
|
||||||
|
|
||||||
top = new_vertical_box();
|
top = new_vertical_box();
|
||||||
top->length = 2;
|
append_box(top, title);
|
||||||
top->children[0] = title;
|
append_box(top, desc);
|
||||||
top->children[1] = desc;
|
|
||||||
|
|
||||||
left = new_chart_box();
|
left = new_chart_box();
|
||||||
left->fills = 5;
|
left->fills = 5;
|
||||||
@@ -39,23 +38,20 @@ main(void)
|
|||||||
sell->color = UI_BLUE;
|
sell->color = UI_BLUE;
|
||||||
|
|
||||||
right = new_vertical_box();
|
right = new_vertical_box();
|
||||||
right->length = 3;
|
append_box(right, buy);
|
||||||
right->children[0] = buy;
|
append_box(right, sell);
|
||||||
right->children[1] = sell;
|
append_box(right, scam);
|
||||||
right->children[2] = scam;
|
|
||||||
|
|
||||||
bottom = new_horizontal_box();
|
bottom = new_horizontal_box();
|
||||||
bottom->fills = 3;
|
bottom->fills = 3;
|
||||||
bottom->length = 2;
|
append_box(bottom, left);
|
||||||
bottom->children[0] = left;
|
append_box(bottom, right);
|
||||||
bottom->children[1] = right;
|
|
||||||
|
|
||||||
ui = new_vertical_box();
|
ui = new_vertical_box();
|
||||||
ui->length = 2;
|
append_box(ui, top);
|
||||||
ui->children[0] = top;
|
append_box(ui, bottom);
|
||||||
ui->children[1] = bottom;
|
|
||||||
|
|
||||||
draw_box(ui, 0, 0, ui_width(), 40);
|
draw_box(ui, 0, 0, ui_width()-1, ui_height()-1);
|
||||||
|
|
||||||
ui_refresh();
|
ui_refresh();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user