alloc big buffers on heap

This commit is contained in:
2026-01-09 05:42:08 +05:00
parent 01df4abcfb
commit bd23c66607
14 changed files with 245 additions and 230 deletions

View File

@@ -1,14 +1,14 @@
#include "tim.h"
void tim_frame(i32 x, i32 y, i32 w, i32 h, u64 color) {
if (tim.event.type == TimEvent_Draw) {
if (tim->event.type == TimEvent_Draw) {
TimRect r = tim_scope_rect_to_absolute(x, y, w, h);
tim_draw_box(r.x, r.y, r.w, r.h, color, color >> 8);
}
}
void label(cstr s, i32 x, i32 y, i32 w, i32 h, u64 color) {
if (tim.event.type == TimEvent_Draw) {
if (tim->event.type == TimEvent_Draw) {
TimText t = tim_scan_str(s);
w = (w == A) ? t.width : w;
h = (h == A) ? t.lines : h;
@@ -28,7 +28,7 @@ bool button(cstr txt, i32 x, i32 y, i32 w, i32 h, u64 color) {
h = (h == A) ? 3 : h;
TimRect r = tim_scope_rect_to_absolute(x, y, w, h);
if (tim.event.type == TimEvent_Draw) {
if (tim->event.type == TimEvent_Draw) {
tim_draw_box(r.x, r.y, r.w, r.h, color >> 16, color >> 8);
tim_draw_str(txt, r.x + (w - tw) / 2, r.y + h / 2, w, color, color >> 8);
}
@@ -39,7 +39,7 @@ bool check(cstr txt, i32* state, i32 x, i32 y, i32 w, u64 color) {
w = (w == A) ? tim_utf8_len(txt) + 4 : w;
TimRect r = tim_scope_rect_to_absolute(x, y, w, 1);
if (tim.event.type == TimEvent_Draw) {
if (tim->event.type == TimEvent_Draw) {
cstr st = *state == -1 ? "-" : *state ? "x" : " ";
tim_draw_str("[ ] ", r.x, r.y, 4, color, color >> 8);
tim_draw_str(st, r.x + 1, r.y, 1, color >> 16, color >> 8);
@@ -56,7 +56,7 @@ bool radio(cstr txt, i32* state, i32 v, i32 x, i32 y, i32 w, u64 color) {
w = (w == A) ? tim_utf8_len(txt) + 4 : w;
TimRect r = tim_scope_rect_to_absolute(x, y, w, 1);
if (tim.event.type == TimEvent_Draw) {
if (tim->event.type == TimEvent_Draw) {
cstr st = *state == v ? "o" : " ";
tim_draw_str("( ) ", r.x, r.y, 4, color, color >> 8);
tim_draw_str(st, r.x + 1, r.y, 1, color >> 16, color >> 8);