renamed types and constants

This commit is contained in:
2026-01-09 02:21:50 +05:00
parent b725182544
commit f7b4809db8
9 changed files with 300 additions and 524 deletions

View File

@@ -1,8 +1,8 @@
#include "../tim.h"
static inline void test_screen(struct event* e) {
static struct event me;
static struct event ke;
static inline void test_screen(TimEvent_t* e) {
static TimEvent_t me;
static TimEvent_t ke;
static int render_us;
char buf[64];
@@ -37,9 +37,9 @@ static inline void test_screen(struct event* e) {
render_us += tim.render_us;
sprintf(buf, "%d µs (Ø %d µs)", tim.render_us, render_us / MAX(tim.frame, 1));
label(buf, ~2, ~2, A, A, 0xf);
sprintf(buf, "%d cells (%.0f %%)", tim.w * tim.h, 100.0 * tim.w * tim.h / MAX_CELLS);
sprintf(buf, "%d cells (%.0f %%)", tim.w * tim.h, 100.0 * tim.w * tim.h / TIM_MAX_CELLS);
label(buf, ~2, ~1, A, A, 0xf);
sprintf(buf, "%d bytes (%.0f %%)", tim.buf_size, 100.0 * tim.buf_size / MAX_BUF);
sprintf(buf, "%d bytes (%.0f %%)", tim.buf_size, 100.0 * tim.buf_size / TIM_MAX_BUF);
label(buf, ~2, ~0, A, A, 0xf);
// multi line label
@@ -63,8 +63,10 @@ static inline void test_screen(struct event* e) {
}
// edit
static struct edit ed1 = {.s = "Edit 1"};
static struct edit ed2 = {0};
static TimEdit_t ed1;
static TimEdit_t ed2;
edit_init(&ed1, 32, "Edit 1");
edit_init(&ed2, 32, "");
edit(&ed1, 1, 10, 32, 0xff00ff);
sprintf(buf, "cursor: %d length: %d", ed1.cursor, ed1.length);
label(buf, 2, 13, A, A, 0xf);
@@ -111,7 +113,7 @@ static inline void test_screen(struct event* e) {
int main(void) {
while (tim_run(1.5)) {
test_screen(&tim.event);
if (is_key_press('q') || is_key_press(ESCAPE_KEY)) {
if (is_key_press('q') || is_key_press(TimKey_Escape)) {
break;
}
}