summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2024-08-29 00:32:28 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2024-08-29 00:32:28 +0330
commit7f7ced3f7f61d6cd31a43c5d03d606879295d624 (patch)
treeebd1c1ee0f317bb343d5ee7b10ade8c7a400f2f1 /src/main.c
parent353546db994b2f71eeae731209f08da1a326a2f3 (diff)
added fps cap
added clang lsp configs added restrict for pointers may have added max and min width and height consts fixed bug in tui_get_cursor_pos added <ENTER> as left click behavior
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main.c b/src/main.c
index 1a4ce8a..c1a2563 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,10 +1,13 @@
-#include "ui/tui.h"
#include <stdio.h>
#include <unistd.h>
+#include "ui/tui.h"
+
bool is_clicked = false;
-void on_button_click(MOUSE_ACTION mouse_action) { is_clicked = !is_clicked; }
+void on_button_click(const MOUSE_ACTION *mouse_action) {
+ is_clicked = !is_clicked;
+}
WIDGET *ui_build(TUI *tui) {
if (is_clicked) {
@@ -17,10 +20,7 @@ WIDGET *ui_build(TUI *tui) {
tui_make_box(
20, 3,
tui_make_column(tui_make_widget_array(
- 2,
- tui_make_text(
- "This is the second page",
- COLOR_BLUE),
+ 2, tui_make_text("This is the second page", COLOR_BLUE),
tui_make_button(tui_make_text(" Back", COLOR_RED),
on_button_click))),
@@ -34,10 +34,9 @@ WIDGET *ui_build(TUI *tui) {
tui_make_row(tui_make_widget_array(
2, tui_make_box(50, 0, NULL, COLOR_NO_COLOR),
tui_make_button(
- tui_make_box(
- 16, 3,
- tui_make_text("\nClick here", COLOR_BLUE),
- COLOR_WHITE),
+ tui_make_box(16, 3,
+ tui_make_text("\nClick here", COLOR_BLUE),
+ COLOR_WHITE),
on_button_click))))),
COLOR_MAGENTA);
}
@@ -46,7 +45,7 @@ WIDGET *ui_build(TUI *tui) {
int main() {
TUI *tui = tui_init();
- tui_start_app(tui, ui_build);
+ tui_start_app(tui, ui_build, 144);
tui_delete(tui);