Framework, stijl en cutting-edge UI

This commit is contained in:
2025-10-17 18:01:57 +02:00
parent eeee5aba7d
commit e958fcdafe
5 changed files with 180 additions and 47 deletions

46
main.c
View File

@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <curses.h>
#include "box.h"
#include "ui.h"
@@ -15,20 +16,49 @@
int
main(void)
{
struct box *parent;
struct box *ui, *top, *bottom, *left, *right, *buy, *sell, *scam, *title, *desc;
ui_init();
parent = new_vertical_box();
title = new_button_box("Bitcoin");
desc = new_button_box("A crypto-scam :-)");
parent->length = 2;
parent->children[0] = new_button_box("hello!");
parent->children[0]->color = UI_BLUE;
parent->children[1] = new_button_box("quit");
top = new_vertical_box();
top->length = 2;
top->children[0] = title;
top->children[1] = desc;
left = new_chart_box();
left->fills = 5;
buy = new_button_box("buy");
buy->color = UI_GREEN;
sell = new_button_box("sell");
sell->color = UI_RED;
scam = new_button_box("scam");
sell->color = UI_BLUE;
right = new_vertical_box();
right->length = 3;
right->children[0] = buy;
right->children[1] = sell;
right->children[2] = scam;
bottom = new_horizontal_box();
bottom->fills = 3;
bottom->length = 2;
bottom->children[0] = left;
bottom->children[1] = right;
ui = new_vertical_box();
ui->length = 2;
ui->children[0] = top;
ui->children[1] = bottom;
draw_box(ui, 0, 0, ui_width(), 40);
draw_box(parent, 0, 0, 20, 30);
ui_refresh();
sleep(300);
ui_end();