Module klyph
klyph is a 2D game engine in pure Kotlin/Native on SDL3 and SDL_GPU. A game is a Gradle project with one plugin and one dependency, and it compiles to a native executable for macOS, Linux or Windows. This site holds the guide and the API reference.
Guide
Read the pages in order for a tour, or jump to a topic. The contents page has the same list.
-
Getting started: the build files, SDL3 on each system, a first window with
runAppand theKLYPH_*variables. -
Sprites and animation: assets, sprites, sheets, animations and the camera.
-
Entities, systems and scenes: the world, phases and the order of a frame, the fixed step, scenes,
Lifetime,Fade, resources and events. -
Input: the keyboard by position and by label, the mouse in points and in the world, and gamepads.
-
Audio: sound effects with pitch and pan, music with fades, volumes and running without a device.
-
Collisions and particles: colliders, layers,
Overlapevents, shape queries and particle emitters. -
Platformers: solids, one-way ledges, kinematic bodies and sweep queries, with gravity, coyote time and a jump buffer written as game code.
-
Scrolling worlds: a camera that follows what the player sees and shakes, a sky and parallax layers, repeating textures, sprite origins and the scene clock.
-
Tile maps: levels painted in the Tiled editor, drawn as tile layers, with solids from the tiles marked solid and tiles changed while the game runs.
-
Text, canvas and overlay: fonts, the
Textcomponent, drawing onapp.canvasand the debug overlay. -
Shipping: the distribution zip, SDL3 at runtime, fullscreen, the cursor and screenshots on CI.
-
Performance: what each engine stage costs and how to keep a frame cheap.
API reference
The two modules below hold every public declaration. A game depends on klyph; klyph-platform comes with it and holds the colors, images, key names and window a game uses alongside it.
All modules:
The klyph engine: the frame loop, entities and scenes, sprites and the camera, text and the canvas, tile maps from the Tiled editor, input, audio, collisions with solids and kinematic bodies, and particles. A game depends on this module, which brings in klyph-platform with it.
The SDL3, stb_image and stb_vorbis bindings and the thin Kotlin API over them that the klyph engine is built on. It is the only module that touches C interop. Games depend on klyph, which brings this module in as an API dependency.