- Add -sUSE_FREETYPE=1 to Emscripten build flags
- Extend Font class with FT_Library, FT_Face, and FT_Stroker handles
- Rewrite FontAtlas to use FreeType with on-demand stroked glyph loading
- Text outlines now use FT_Stroker for vector-based stroking before
rasterization, eliminating gaps at corners with thick outlines
- Use glTexSubImage2D for incremental atlas updates (major perf fix)
- Disable canvas border in shell.html per Emscripten docs (alignment fix)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements SFML-compatible text outlines using multi-pass rendering:
- Draws text 8 times at offset positions (N, NE, E, SE, S, SW, W, NW)
with outline color, then draws fill text on top
- Uses existing outlineThickness_ and outlineColor_ properties
- Refactored Text::draw() with helper lambda for code reuse
- Removed debug logging code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The FontAtlas class was missing move semantics, causing the GPU texture
to be deleted immediately after creation. When FontAtlas was moved into
the cache with std::move(), the default move constructor copied textureId_,
then the original's destructor deleted the texture the cache was using.
Added:
- Move constructor that transfers ownership and clears source textureId_
- Move assignment operator with proper cleanup of existing resources
- Deleted copy operations since GPU textures can't be shared
Also cleaned up the text fragment shader to use proper alpha sampling.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
RenderTexture fix:
- Add flippedY_ flag to Texture class for tracking FBO textures
- RenderTexture marks its texture as Y-flipped
- Sprite::draw() flips V coordinates for flipped textures
- This should fix upside-down entities and grid content
Text debug:
- Log first glyph UV coordinates
- Log texture binding in drawTriangles for Text shader
- Warn if Text shader used without texture bound
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Texture::setSize() method for RenderTexture to set its texture dimensions
- RenderTexture::create() now sets texture size (was 0,0 causing Sprite::draw to bail)
- Add debug output to FontAtlas::load showing glyph count and non-zero pixels
- Add debug output to Text::draw showing atlas texture ID and colors
These fixes should enable grid rendering (RenderTexture now has proper size).
Debug output will help diagnose why text shows as solid boxes instead of glyphs.
Co-Authored-By: Claude <noreply@anthropic.com>
Text rendering fix:
- Add ShaderType parameter to drawTriangles() to allow explicit shader selection
- Text::draw() now properly uses text shader (alpha-only sampling)
- Previously drawTriangles() always overrode to sprite shader
RenderTexture fix:
- Add pushRenderState/popRenderState to save/restore viewport and projection
- RenderTexture::clear() now sets viewport/projection to FBO dimensions
- RenderTexture::display() restores previous state
- This fixes grid rendering which uses RenderTexture for tile chunks
Co-Authored-By: Claude <noreply@anthropic.com>
- Sprite::draw(): Textured quad rendering with UV coordinates and color tint
- Text::draw(): Glyph rendering using FontAtlas cache, supports multi-line
- Text::getLocalBounds()/getGlobalBounds(): Calculate text dimensions
- VertexArray::draw(): Full primitive support (Triangles, TriangleFan,
TriangleStrip, Quads, Lines, LineStrip, Points)
- View::getTransform(): Proper camera transform using translate/rotate/scale
Frames and sprites now render in browser. Text shows glyph positions but
texture sampling needs debugging. Grid rendering not yet working.
Co-Authored-By: Claude <noreply@anthropic.com>
Shape rendering now works:
- Shape::draw() generates triangle vertices for fill and outline
- RectangleShape, CircleShape, ConvexShape provide getPointCount()/getPoint()
- Shapes render with correct fill color, outline color, and outline thickness
Transform class fully implemented:
- translate(), rotate(), scale() modify the 3x3 affine matrix
- transformPoint() applies transform to Vector2f
- operator* combines transforms
- getInverse() computes inverse transform
Transformable::getTransform() now computes proper transform from:
- position, rotation, scale, and origin
RenderStates now has transform, blendMode, shader members
Canvas sizing fixed for Emscripten:
- EM_ASM sets canvas size after SDL window creation
- SDL_GL_MakeCurrent called after canvas resize
Result: RectangleShape UI elements render in correct positions!
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>