Refactoring

Posted on Jul 6, 2020

This last week I got some boring but important work done. After completing some odd jobs like implementing event delegation for Director 2-3 and TrueType font loading, I began refactoring the Director engine to make it flexible enough to handle Movies In A Window (MIAWs), or multiple movies running in parallel.

For those not familiar, Director uses a movie metaphor for development. A movie’s major components are:

  • The cast, which contains cast members. Cast members can be visual (such as bitmaps or text), they can be sounds, or they can be scripts.
  • The stage, where sprites (instances of cast members) are displayed.
  • The score, a sequence of frames which dictate sprite placement, sounds, script execution, and much more.

Previously, all these jobs were handled by an enormous Score class. This worked fine when we were only playing one movie at a time, but to support MIAWs, things needed to be a whole lot more modular. Nathanael separated rendering code into a Stage class, while I separated the Cast and Movie from the Score, which took quite a long time.

After that, I began working on displaying movies within our classic Mac Window manager.

Warlock in a window

Today I began implementing the Lingo side of MIAWs, so I hope to have more news on them soon!