1.4 Examples

The Hollywood SDK comes with several example plugins and makefiles for lots of different platforms. You can study the source code of these examples to learn more about the practical aspects of writing a Hollywood plugin. The following example plugins are currently included with the SDK:

This is a plugin of type HWPLUG_CAPS_SOUND which adds a loader for the AIFF audio file format popular on the macOS platforms to Hollywood. The AIFF file format's layout is very easy to understand so this plugin is a good starting point for learners who want to write a sound plugin. See Sound plugins for details.

This is a plugin of type HWPLUG_CAPS_DISPLAYADAPTER. It is just a very basic example that shows how to replace Hollywood's inbuilt display adapter with a minimal custom display adapter (here based on SDL). It is not optimized in any way and only the most basic functionality has been implemented. Its aim is to get you started with writing custom display adapters, that's why this plugin has deliberately been kept as simple as possible to make it easier to understand the code. Once you have understood this plugin, here are some ideas how you can optimize it:

  1. Add support for hardware double buffers
  2. Add support for video bitmaps that can be drawn to hardware double buffers
  3. Add support for scaling and transforming video bitmaps using the GPU
  4. Add support for offscreen drawing to video bitmaps
  5. Add audio support through SDL

RebelSDL can do all that and in fact this plugin is nothing else than a cut-down version of RebelSDL so as a little exercise you can try to implement all RebelSDL features that have been cut from this plugin.

This is a plugin of type HWPLUG_CAPS_LIBRARY. It adds some primitive functions and constants to Hollywood and is a good starting point if you want to extend Hollywood's command set using your own functions. It can also be used to learn about the way the Lua VM works. See Library plugins for details.

This is a plugin of type HWPLUG_CAPS_IMAGE which adds a loader for the PCX image file format to Hollywood. Have a look at this source code if you intend to write an image loader plugin for Hollywood. See Image plugins for details.

As an exercise, you might want to use the AIFF or PCX plugin source codes as a starting point and extend them to include a saver for these formats as well. See Image saver plugins for details. See Sample saver plugins for details.

More plugin source codes are available at the official Hollywood portal at http://www.hollywood-mal.com. You can find them in the download section next to the binary distributions of the plugins.

Show TOC