winzik/engine/tests/Renderer
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cdy-respawnsive ad389c5efc HD 2D (game.yaml hd), sharp TTF text with bold / outline, WebGL layer composed by the 2D's alpha
All three are opt-in: a game that does not ask for them draws exactly as before.

- Renderer::setHd() (game.yaml `hd: auto` or 2..4; default 1 = off): the view texture is made hd times bigger and
  SDL_RenderSetLogicalSize scales every drawing call to it, so games keep their view coordinates (translate()
  included) while text, circles and positions at fractions of a pixel are drawn at the window's resolution.
  viewPixels() gives the texture's real size (OpenGl::begin / end and WebGl's 'view' stage use it; = the view's
  size without HD).
- Renderer::clear($color, $keepAlpha = false): opaque as before; with true the colour's alpha is kept.
- TtfFont: in HD the glyphs are rendered at their real size and drawn back at their view size; new optional
  arguments style (TtfFont::BOLD / ITALIC), thicken (a thin font made bolder) and outline (draw()'s shadow colour
  becomes an outline around the letters). Without HD and without them: the same font, the same sizes.
- WebGl::setLayer('below', 'view', null): no key colour; the 2D's own alpha says where the 3D shows (clear it with
  clear([0, 0, 0, 0], true)), so smooth text and translucent panels of any colour lie over the 3D. The key colour
  stays the default.

Tests: engine/tests/Renderer/HdTest.php (off by default, a frame in HD, text sizes with and without HD).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 18:40:24 +01:00
..
HdTest.php HD 2D (game.yaml hd), sharp TTF text with bold / outline, WebGL layer composed by the 2D's alpha 2026-11-05 18:40:24 +01:00