Running apps
An app is one Rio source file. To run it, a Rinc:
-
Starts fresh: an empty app space, every voice stopped, no typed text waiting.
-
Compiles the whole app, with
pcauto-imported, as memory says. If it doesn't compile, it doesn't run, and the first error is shown. Nothing of it runs. -
Runs its top-level code, then its
mainproc if it has one. -
Runs frames, if the app has
update*ordraw*(exported, so the Rinc can find them), 60 times a second until the app is left. Each frame:- The Rinc sets the buttons, sticks and triggers as they are now, and queues what was typed since the last frame.
- It calls
update, thendraw, each if the app has it. - It shows the screen as the app left it. The screen isn't cleared between frames.
An app with neither
updatenordrawisn't a game: it's done oncemainreturns.
A runtime error stops the app, showing the error and its line. log writes a line where the Rinc
shows text: on the screen while an app starts or once it's done (but not over a game's frames), and to
a serial port or a terminal.
An app is left for another with pc.launch, or for home with the system key.
Leaving stops every voice.
Frames come 60 a second. An app that takes too long gets its frames late (how a Rinc catches up, if it
does, is its own), so for real time, use pc.appTime().