20 files (~3,830 lines): view protocol, layout, renderer, glyph cache, fonts, gestures, animation, scroll, stacks, modifiers, etc. Internal imports rewritten from "ui/..." to "modules/ui/...". Consumers now `#import "modules/ui"` from any project; no symlink hacks needed. Verified by compiling game/main.sx without its local ui/ — resolves via the Phase 6 stdlib fallback.
21 lines
589 B
Plaintext
Executable File
21 lines
589 B
Plaintext
Executable File
#import "modules/std.sx";
|
|
#import "modules/ui/types.sx";
|
|
#import "modules/ui/glyph_cache.sx";
|
|
|
|
// Global glyph cache pointer for views (Label, Button) to access
|
|
g_font : *GlyphCache = null;
|
|
|
|
set_global_font :: (font: *GlyphCache) {
|
|
g_font = font;
|
|
}
|
|
|
|
// Convenience measurement function for views
|
|
measure_text :: (text: string, font_size: f32) -> Size {
|
|
if g_font == null {
|
|
// Fallback approximate measurement
|
|
scale := font_size / 16.0;
|
|
return Size.{ width = xx text.len * 8.0 * scale, height = font_size };
|
|
}
|
|
g_font.measure_text(text, font_size);
|
|
}
|