Programming Macaw OS

Programming Macaw OS

Every program in Macaw OS is a Lua file, from the Calculator to the level editor to the games. You can open any of them in Code to see how it works. Your own programs run the same way. Each gets a window on the desktop and uses the same drawing, sound and 3D calls.

This guide shows you how to write your own. If you've never written a program before, start at the top. If you already know Lua, skip to the page for what you want to make.

Start here

What you can make

PageWhat's in it
DrawingShapes, text, colours, pictures, drawing into pictures, the screen's size and colours
Input and soundThe keyboard and mouse, sound effects, notes, and songs from the Music app
Game cartsA game in a folder with its sprites, map, sounds and music, and the editors for each
3DTextured meshes, a camera and lights, and scenes of objects that move, collide and can be clicked
The graphics chipOpenGL-style 3D with matrices, draw calls, lighting and reflecting water
LevelsLevels built in Brushwork that you walk round in your own program
AppsButtons, text boxes and lists, menus, dialogs, drag and drop
Files and the systemThe disk, what Lua can do here, busy programs, saved passwords, System Extensions
MemoryYour program's own memory, with addresses, peek and poke, malloc and free, and the window's picture
CWriting programs in C, with pointers, structs, the C library and Macaw OS's calls
NetworkingTalking to other people's computers on the Macaw network

Where to look

The machine

Screen640x360 to start with, or 640x480, 800x600 or 1024x768. It shows 256 colours, 8 colours or thousands
Sound4 effect voices, plus the S16 music chip with 16 voices of synth or recorded instruments
InputKeyboard and mouse
LanguageLua 5.4, and C89 (see C)
Disk/system and /games come with Macaw OS and can't be changed. /home is yours

Macaw OS runs the same programs on Windows, on PowerPC Macs (Mac OS X and Mac OS 9), on the Raspberry Pi and in a web browser. A program can't reach the computer underneath. It only sees the Macaw disk and the Macaw network (and shares the clipboard).