Skip to main content
History: Hikari Wrapper for MOGRE
View published page
Source of version: 4
(current)
Wrapper for ((Hikari)) - With this you can embedd __Adobe Flash__ to a ((MOGRE|Mogre)) application, e.g. to show a ((-GUI|GUI)). Details in this [http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=8390|forum thread]. !!Download The last version is available here : [http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=8390| HikariWrapper for Mogre 1.7.1] . vs2008 only at the moment. The source code is available here : [http://bitbucket.org/mogre/mogreaddons/src/tip/HikariWrapper/ | source code at bitbucket] !!Prerequisite You must have the flash.ocx plugin in folder of your exe. it's included in the hikariwrapper zip file. !!Setting up Hikari use this code to set up hikari : {CODE(wrap="1", colors="c#")}HikariManager _HikariManager = new HikariManager("path\\to\\flashfiles");{CODE} For creating a new flash control, use this code : {CODE(wrap="1", colors="c#")}FlashControl _FpsControl = _HikariManager.CreateFlashOverlay("Fps", viewport, 130, 91, RelativePosition.TopLeft, 0, 0); _FpsControl.Load("fps.swf");{CODE} Alternatively, if you want to create a flash material without adding it on an overlay, use this code instead {CODE(wrap="1", colors="c#")}FlashControl _FpsControl = _HikariManager.CreateFlashMaterial("Fps", 130, 91);{CODE} this will create internaly a new ogre material, containing your flash control, you can then assign this material to an entity, using SetMaterialName, for example: {CODE(wrap="1", colors="c#")}_MyEntity.SetMaterialName("FpsMaterial");{CODE} Finally, don't forget to add a call to the Update function of your hikari manager in a framelistener, for example : {CODE(wrap="1", colors="c#")}bool Main_FrameStarted(FrameEvent evt) { _HikariManager.Update(); } {CODE} !!Calling an actionscript function from csharp You need to add the specific line of code in the actionscript code of your flash control, like in this exemple : {CODE(wrap="1", colors="c#")}function testflash() { } //here, the first parameter is the name of your function outside of flash, the second is the reference to our function ExternalInterface.addCallback("testflash",testflash); {CODE} next, you need to use the csharp flash control object to call the function : {CODE(wrap="1", colors="c#")}//args is the array of parameters passed to the actionscript function object[] args = new object[0]; _MyFlashControl.CallFunction("testflash",args);{CODE} !!Calling a csharp function from actionscript let say we have a csharp function we want to call from flash. {CODE(wrap="1", colors="c++")}//the function signature must always be like this public void testCsharp(object[] args) { }{CODE} first, create a new callbackhandler delegate : {CODE(wrap="1", colors="c#")}CallbackHandler _testcsharp;{CODE} next, bind it to a our csharp function {CODE(wrap="1", colors="c#")}_testcsharp = this.testCsharp;{CODE} then bind it to our flashcontrol {CODE(wrap="1", colors="c#")}//the first param is the name of our function in action script, the second is the reference to our delegate _MyFlashControl.Bind("testCsharp",_testcsharp);{CODE} finally, call the function from actionscript like this : {CODE(wrap="1", colors="c#")}//add parameter for our csharp function after the first one ExternalInterface.call("testCsharp"); {CODE} !!known issues *__memory leak__ : like hikari, hikariwrapper suffer from memory leak. however, a cross platform, memoryleak free version of hikari, named akarui exist. but it haven't be integrated with ogre, and thus haven't be implemented with hikariwrapper for now. The code is still available, so if you want to give it a shot, just send a pm to [http://www.ogre3d.org/addonforums/memberlist.php?mode=viewprofile&u=8879|gantz] *__flashcontrol.materialname__ : the materialname property of flashcontrol is buggy, and don't return the correct material name. instead, use ControlIDMaterial where ControlID is the name of your flashcontrol *__Flash 10__ : last time i tested it, flash 10 make hikariwrapper crash. it safer to ignore this version for now, and only use flash9. the activex components (flash9.ocx) is included in the hikariwrapper zip *__Perfomance concern__ : try to avoid using a lot of animated flash in your gui. things like tweener still acceptable performance wise, but full screen animation usually perform badly. *__video playback__ : you can playback video by integrating directly your flv video in your flash control. streaming won't work (mainly because of the offline nature of hikari) __Todo: Copy screenshot from forum to this page.__
Search by Tags
Search Wiki by Freetags
Latest Changes
Compiled API Reference
Overlay Editor
Introduction - JaJDoo Shader Guide - Basics
RT Shader System
RapidXML Dotscene Loader
One Function Ogre
One Function Ogre
...more
Search
Find
Online Users
249 online users
OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username
Password
CapsLock is on.
Remember me (for 1 year)
Log in