P4.3: render seeded board with real gem sprites (sx, iOS sim)
Adopt the modules/ui UIPipeline framework (as the chess reference app does) and replace the P0 placeholder quad with a BoardView (View protocol, modeled on chess/board_view.sx): - background.png fills the screen; an 8x8 cell.png grid is centered in the safe area; each cell's gem is sampled from gems.png by UV column = gem index (0=red .. 5=purple). - Drive it from board.sx seeded with 1337 (the board_init golden's seed), so the on-screen layout matches that snapshot gem-for-gem. main.sx now hosts the view via UIPipeline (Metal on iOS, GL on desktop) and heap-allocates the board/asset state behind pointers (UFCS method calls on a value-typed global mutate a copy, so mutable state must live behind a pointer as the reference app does). Vendor the C deps the UI module's image/font path needs (stb_image, stb_truetype, kb_text_shape, file_utils); their #include "vendors/..." paths resolve relative to the project root. Evidence: ios-sim build links clean; tools/run_tests.sh 11/11 pass; running app captured at goldens/p4_board.png.
This commit is contained in:
19
vendors/kb_text_shape/kb/LICENSE
vendored
Normal file
19
vendors/kb_text_shape/kb/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
zlib License
|
||||
|
||||
(C) Copyright 2024-2025 Jimmy Lefevre
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
30737
vendors/kb_text_shape/kb/kb_text_shape.h
vendored
Normal file
30737
vendors/kb_text_shape/kb/kb_text_shape.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
vendors/kb_text_shape/kb_text_shape_impl.c
vendored
Normal file
2
vendors/kb_text_shape/kb_text_shape_impl.c
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#define KB_TEXT_SHAPE_IMPLEMENTATION
|
||||
#include "kb/kb_text_shape.h"
|
||||
15
vendors/kb_text_shape/kbts_api.h
vendored
Normal file
15
vendors/kb_text_shape/kbts_api.h
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Minimal API declarations for SX import.
|
||||
// Only the functions/types we actually use — avoids parsing the full 30k-line header.
|
||||
|
||||
typedef struct kbts_shape_context kbts_shape_context;
|
||||
typedef struct kbts_font kbts_font;
|
||||
|
||||
kbts_shape_context *kbts_CreateShapeContext(void *Allocator, void *AllocatorData);
|
||||
void kbts_DestroyShapeContext(kbts_shape_context *Context);
|
||||
kbts_font *kbts_ShapePushFontFromMemory(kbts_shape_context *Context, void *Memory, int Size, int FontIndex);
|
||||
void kbts_GetFontInfo2(kbts_font *Font, void *Info);
|
||||
void kbts_ShapeBegin(kbts_shape_context *Context, unsigned int ParagraphDirection, unsigned int Language);
|
||||
void kbts_ShapeUtf8(kbts_shape_context *Context, const char *Utf8, int Length, unsigned int UserIdGenerationMode);
|
||||
void kbts_ShapeEnd(kbts_shape_context *Context);
|
||||
int kbts_ShapeRun(kbts_shape_context *Context, void *Run);
|
||||
int kbts_GlyphIteratorNext(void *It, void **Glyph);
|
||||
Reference in New Issue
Block a user