This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
rayslides is a minimalistic slideshow presentation tool written in Zig, using raylib for rendering. It's a port of the original slides project, designed for editing, presenting, and PDF-exporting slides on Mac (and other platforms via raylib).
# Build the project
zig build
# Run with a slideshow file
zig build run -- testslides/test_public.sld
# Run tests
zig build testRequirements: Zig 0.15.1 or later (specified in build.zig.zon)
-
main.zig - Application entry point, main loop, input handling (keyboard/mouse), and window management. Contains
AppDataglobal state struct (G),ExportControllerfor PDF export,LaserPointerfor presentation annotations, andBannerfor splash screen. -
parser.zig - Parses
.sldslideshow text files into slide data structures. Handles directives (@bg,@box,@push,@pop,@slide,@pushslide,@popslide), variable substitution (@let), and font configuration. TheParserContextmanages parsing state and template contexts. -
renderer.zig -
SlideshowRendererpre-renders slides intoRenderElementlists (background/text/image), then renders them at runtime with coordinate transformation from internal 1920x1080 space to window size. -
slides.zig - Data structures:
SlideShow(collection of slides with defaults),Slide(items + per-slide settings),SlideItem(background/textbox/img with position, size, color, font),ItemContext(parsing context for directives). -
markdownlineparser.zig - Parses markdown-like inline formatting within text:
**bold**,_italic_,~~underline~~,`code`,<#rrggbbaa>colored</>. -
fonts.zig - Font loading and management, supports custom fonts via
@font,@font_bold, etc. directives. -
texturecache.zig - Caches loaded image textures to avoid redundant loading.
- Parse:
parser.constructSlidesFromBuf()parses .sld file intoSlideShowstruct - Pre-render:
SlideshowRenderer.preRender()converts slides intoRenderElementlists - Render:
SlideshowRenderer.render()draws elements with coordinate scaling
Internal render buffer is fixed at 1920x1080. All .sld coordinates use this space. The renderer scales to actual window size while maintaining aspect ratio.
The .sld format uses directives prefixed with @:
@bg color=#rrggbbaaor@bg img=path- slide background@box x=N y=N w=N h=N fontsize=N color=#rrggbbaa- text box (text follows on subsequent lines)@box img=path x=N y=N- image with auto-dimensions (uses image's natural size)@box img=path x=N y=N scale=0.5- image scaled to 50% of natural size@box img=path x=N y=N scale=0.5 ratio=0.5- scaled with adjusted w/h ratio@box img=path x=N y=N w=N- image with specified width, height auto-calculated@push name/@pop name- save/restore element templates@pushslide name/@popslide name- save/restore slide templates@let var=value- variable substitution ($var$in text)@line_height=N,@fontsize=N,@font=path- global settings
Text supports markdown-like formatting and bullet lists (lines starting with - or >).
- raylib-zig - Zig bindings for raylib (graphics/window)
- pdfgen.c - Embedded C library for PDF export (in src/pdf/)