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
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Hikari Wrapper for MOGRE
View 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
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
37 online users