alloc big buffers on heap
This commit is contained in:
14
test/test.c
14
test/test.c
@@ -21,9 +21,9 @@ static inline void test_screen(TimEvent* e) {
|
||||
label("|", A, ~0, A, A, 0xf);
|
||||
|
||||
// some information
|
||||
sprintf(buf, "screen: %dx%d", tim.w, tim.h);
|
||||
sprintf(buf, "screen: %dx%d", tim->w, tim->h);
|
||||
label(buf, 2, 0, A, A, 0xf);
|
||||
sprintf(buf, "frame : [%c] %d", ": "[tim.frame & 1], tim.frame);
|
||||
sprintf(buf, "frame : [%c] %d", ": "[tim->frame & 1], tim->frame);
|
||||
label(buf, 2, 1, A, A, 0xf);
|
||||
sprintf(buf, "key : [%d] %s", ke.key, ke.s + (ke.key < 32));
|
||||
label(buf, 2, 2, A, A, 0xf);
|
||||
@@ -34,12 +34,12 @@ static inline void test_screen(TimEvent* e) {
|
||||
label(buf, 2, 4, A, A, 0xf);
|
||||
|
||||
// lower right
|
||||
render_us += tim.render_us;
|
||||
sprintf(buf, "%d µs (Ø %d µs)", tim.render_us, render_us / MAX(tim.frame, 1));
|
||||
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 / TIM_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 / TIM_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
|
||||
@@ -112,7 +112,7 @@ static inline void test_screen(TimEvent* e) {
|
||||
|
||||
i32 main(void) {
|
||||
while (tim_run(1.5)) {
|
||||
test_screen(&tim.event);
|
||||
test_screen(&tim->event);
|
||||
if (tim_is_key_press('q') || tim_is_key_press(TimKey_Escape)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user