libs/render
2D Batched GPU Graphics & Font Atlas Engine
The foundational 2D graphics engine powering all Kale native GUIs. Implements high-throughput CPU-to-GPU dynamic batching capable of drawing hundreds of thousands of textured and colored quads in a single draw call. Fully integrated with stb_truetype for real-time font glyph caching.

High-Throughput Systems Foundation
Engineered to maximize CPU instruction pipelining and data cache locality. Every algorithm avoids heap pointer indirection wherever contiguous stack or arena buffers can be employed.

import "libs/render/batch.kl" as batch;
import "libs/render/font.kl" as font;
fn draw_card(b: *batch.RenderBatch, f: *font.FontAtlas, x: f32, y: f32, w: f32, h: f32) -> void {
// Drop shadow
batch.draw_rect_rounded(b, x + 4.0, y + 4.0, w, h, 8.0, 0x00000088);
// Card background
batch.draw_rect_rounded(b, x, y, w, h, 8.0, 0x0e1838ff);
// Border
batch.draw_rect_outline(b, x, y, w, h, 8.0, 1.5, 0xb91c1cff);
// Header text
font.draw_string(b, f, "Kale Architecture", x + 16.0, y + 24.0, 0xf8fafcff);
}Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:
kale build tests/test_render_batch.kl -o bin/test_render.exe -lglfw3 -lopengl32 -Llibs/stb/vendor./bin/test_render.exeGPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.
Batches rects, borders, drop shadows, and textured glyphs, auto-flushing only upon texture or blend mode changes.
Rasterizes TrueType glyphs into a 1024x1024 alpha texture atlas with pixel-accurate UV coordinate mapping.
Hardware-accelerated hierarchical scissor clipping for scrollable viewports and nested UI panels.