From 108a4a0c2c14d70c366bbfaa65b7287824fb33da Mon Sep 17 00:00:00 2001 From: A404M Date: Fri, 30 Aug 2024 16:08:44 +0330 Subject: added last_frame in nano seconds updated example --- src/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b77e944..77c5f49 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,4 @@ +#include #include #include @@ -11,6 +12,9 @@ void on_button_click(const MOUSE_ACTION *mouse_action) { WIDGET *ui_build(TUI *tui) { if (is_clicked) { + char frame[20+3+1]; + const uint64_t fps = 1000000000/tui->last_frame; + sprintf(frame, "%ldfps", fps); return tui_make_box( -1, -1, tui_make_column(tui_make_widget_array( @@ -20,7 +24,7 @@ WIDGET *ui_build(TUI *tui) { tui_make_box( 20, 3, tui_make_column(tui_make_widget_array( - tui_make_text("This is the second page", COLOR_BLUE), + tui_make_text(frame, COLOR_BLUE), tui_make_button(tui_make_text(" Back", COLOR_RED), on_button_click))), COLOR_WHITE))))), -- cgit v1.2.3