Table of contents
Hikari is a small yet powerful library that makes it easy to use Flash content in Ogre3D. The possible applications include:
- Create the interface for your game in Flash
- Play Flash movies as cut-scenes in your game
- Embed Flash mini-games in your game
- Combine Flash with 3D to make novel interfaces
- Use Flash for animated decals on 3D models
And it doesn't stop there! I'm excited to see what other uses people will dream up.
- Design your content in Flash
- Export to SWF files.
- Create the HikariManager.
- Create a FlashControl for each SWF using the HikariManager.
- Load the SWF files into each respective FlashControl.
- Bind callbacks in ActionScript and C++.
- Inject mouse input into the HikariManager.
- Call HikariManager::update from your update loop.
The major features of Hikari are:
- Efficient updating with dirty-rectangling
- Full transparency support
- Load the Flash ActiveX control from the registry or a local file
- Create a FlashControl as a movable overlay or pure material
- Bind C++ functions to handle function calls from ActionScript
- Call ActionScript callbacks from C++
- Support for basic ActionScript types (null, boolean, number, string)
- International string support
- Minimal impact on application size
Hikari is licensed under the Lesser GNU Public License (LGPL) with one stipulation:
If you use it, tell me about it! (email me: ajs15822 at gmail dot com)
For the curious, when you create a FlashControl using the HikariManager, this is what happens:
- The Flash ActiveX control is loaded (either from Flash.ocx in the working directory or from the registry).
- It is embedded into a Windowless OLE site.
- An event handler is bound to the OLE object to handle various Flash events.
- Invalidations are caught, the dirty area is expanded.
- Mouse input is injected by translating it into native window messages which are then sent directly to the Windowless site.
- Keyboard input is handled by directing all keyboard messages (using a message hook) to the focused FlashControl. (To accommodate complex keyboard input)
- During a global update, if a FlashControl is dirty, the dirty area is rendered and merged with an internal buffer, which is then blit to a dynamic texture using Ogre3D's facilities.
HikariWrapper.zip includes the sources and a runnable demo. (look to the forum thread - maybe there is a newer version available)
A forum topic is dedicated to the wrapper: HikariWrapper forum topic