Rendering

An indexed frame, drawn on the CPU.

The canvas is the game resolution from game.json, 320×240 by default. Positions you set on a Transform are world pixels. A scene shown by a camera is shifted by that camera’s view, in whole pixels, so art does not shimmer. A scene with no camera draws world as screen — that is where HUD and menus belong. Move the camera, not the level.

Each picture is an indexed bitmap plus a palette. The software renderer walks the scene twice: opaque pixels front to back, claiming coverage, then translucent pixels back to front. Opacity between 0 and 1 is ordered dither. The GPU uploads the index frame and the palette and resolves color in a shader.

Positions are floats. Drawing truncates to whole pixels. Round yourself when something moves every frame and you want the pixels to sit still.

RenderComponent

SpriteRenderer, TextRenderer, TileMap, and ParticleEmitter share SortingOrder (default 0, ties keep scene order) and Opacity (0 hidden, 1 solid). Enabled = false, or an inactive object, drops the renderer from the scene’s draw list. To draw pixels from code, derive PixelRenderer and implement OnDraw. Do not derive RenderComponent yourself.

SpriteRenderer

Sprite is a sprite GUID. Empty draws nothing. Palette is an optional .wep override. FlipX and FlipY mirror about the pivot, so the sprite stays in place.

Slice is Single, Three, or Nine. Borders are native pixels. Corners stay 1:1 and the edges stretch. Sliced sprites ignore rotation. The pivot comes from the sprite, or from the Transform when the sprite has none.

var sr = Owner.GetComponent<SpriteRenderer>();
sr.FlipX = direction < 0;
sr.Slice = SpriteRenderer.SliceMode.Nine;
sr.BorderLeft = sr.BorderRight = sr.BorderTop = sr.BorderBottom = 4;

TextRenderer

Text is stamped into one cached bitmap from a .wfnt font, then drawn like a sprite, so Transform rotation and scale apply. An empty Font uses the project’s default 5×7 font. Palette recolors with a .wep.

Layout: LetterSpacing, LineSpacing, Kerning, Alignment (Left, Center, Right), MaxWidth for word wrap, MonospaceWidth, padding, CurveAngle to bend onto an arc, shadow offset and palette slot, Case, and FallbackCharacter. From a script, SetText and SetNumber change the string without allocating.

Tile maps, particles, animation

TileMap (WillEngine.Core.TileMaps) draws a .wtm map built from a .wts tile set. ParticleEmitter (WillEngine.Core.Particles) emits indexed particles; disabling it stops and clears them. SpriteAnimator plays .wanim clips on the sprite of the same object. Disabling the animator freezes it.

Scenes draw by DrawOrder. A scene is drawn once per camera that shows it. A camera picture whose camera did not move, and whose scene did not change, is not drawn again.