Hikari

From EQUIS Lab Wiki

Jump to: navigation, search

Hikari is a library that lets you easily use Flash content in Ogre3D.

Hikari allows you to create Flash controls which can be applied as overlays or attached to objects inside the Ogre3D scene. In addition, it gives a control scheme in which actionScript can make external interface function calls to Hikari which in turn can call functions inside your game code, and vice versa. With a nice Flash value converter for proper communication.

The Library gives you the power to load Flash videos into the Flash controls, and layer them in tiers, make pure Ogre materials, check which Flash controls are focused and manage inputs based on if they are over Flash overlays.

It also allows you to control the Flash video by pausing, restarting, stepping forward, stepping backward, fast forwarding and rewinding.

The benefits allow you to easily create Flash interfaces for use in your Ogre game.

A full description can be found here: Hikari Description

There is also a very sparse Hikari Wiki

Installing Hikari

1) Make sure you have OgreSDK, Flash Player 9, Microsoft Visual C++ (2005+) and at least MSVC2005

2) Download the Hikari source code

3) Open the solution in Microsoft Visual Studio, and select Build-mode as release or debug. Then select Build and Build Solution.

4) If the build was successful you should find the .dll and .lib in the debug/release folder in Hikari/lib. The solution should also have built the Demo which you can now run (The demo is written in C#)

Now your ready to work with Hikari!

Using Hikari

To get started you can read this part of the wiki on Getting Started

Important Parts of Hikari

There are 3 very important classes in Hikari: Hikari.h, FlashControl.h, and FlashValue.h

Hikari.h

This is the class that creates the HikariManager. This allows you to create and destroy Flash controls. It also handles global events such as input.

When you create a HikariManager you must specify the file in which your Flash media is stored

From the Hikari Manager you are able to create Flashcontrols, tell which flash controls are focused, if any, and whether the mouse is over a flash control, and if so, if it is over transparent pixels or not. HikariManager also allows you to pass input through either to your game or the FlashControls based on how you define it. A special function allows you to "hook" keyboard input so that it may automatically be passed to FlashControls. Without this Hook you must catch it in the code, store the input and pass the input to the FlashControl manually.

The HikariManager also allows you to specify if the FlashControl is a movable overlay, set the height/width/position/viewports of the controls, and let's you set the Tier and Zorder(priority within a tier) to manage many layers of FlashControls that you may have.

FlashControl.h

The FlashControls are rendered dynamically by Flash and rendered to texture for use in Ogre.

This is the class in which you load your FlashVideos. Upon creation and loading the video will automatically begin to play.

Through the FlashControl you may access play controls of the Flash media ( stop, restart, play, rewind, stepforward, etc.). You are also able to set the transparency of the FlashControl, the Quality, if it can be dragged, and whether to ignore transparent pixels.

FlashControl also allows you to bind local callbacks to certain functions. In this way your Flash media can call functions from actionScript using the ExternalInterface call, in order to call function you have defined in your game code. Contrary you can declare actionScript functions of the loaded media and call them using your game code.

FlashControl in general lets you, check visibility, set focus, move the overlay, find the current screen coordinates of the overlay, find the size and inject mouse events into the Flash media.

FlashValue.h

This class defines the Flash variables and allows you to convert from Flash values to C++ values. This let's your Flash and C++ code send values between each other. It also has facilities to communicate with actionScript.

This is just a brief explanation of what the three main classes in Hikari do. It is highly recommended that you read through the documentation of these three classes.