Makarui, a wrapper for akarui

GantZ

11-11-2010 12:54:00

In replacement of hikari, i have work lately on implementing akarui for mogre. i now got a working version, and want to share it for everyone :)

Main features of makarui compared to hikariwrapper :

  1. Flash plugin agnostic. you can use flash 9, 10 or better with this version. (flash 10 recommended)[/*:m]
  2. Better memory management, unlike the old activex version.[/*:m]
  3. Better performance with transparent flash control with flash 10 plugin. no more need of alpha hack.[/*:m]
  4. Optimization of the callback code[/*:m][/list:u]

    Known issues

    1. Missing implementation of code like SetLoop(), SetQuality(), SetScaleMode(). basically what goes with setting property for a flash control. you can still set various property for your flashcontrol on creation but not at runtime[/*:m]
    2. ExternalInterface.call must be used with setTimeout on flash 10 plugin[/*:m]
    3. FlashMaterial is untested[/*:m]
    4. No implementation of Flash 9 legacy alpha hack from hikari[/*:m][/list:u]

      Usage example

      It work basically the same way than Hikariwrapper, the initialisation is the main difference

      MakaruiManager makaruiMgr = new MakaruiManager("..\\media\\",this.window); //don't forget the last slash on the assets directory, the second parameter is the renderwindow
      FlashControl controls = makaruiMgr.CreateFlashOverlay("controls.swf", this.viewport, 350, 400, RelativePosition.Center, 1, 0,true); //this function replace the old load function, just provide the control you want to load when you create your flash overlay. it's also here that your provide the position, the scalemode and the transparency settings.


      Binary

      You need to have NPSWF32.dll in the same directory of Makarui. you can find it in in your windows\system32 directory (sysWOW64 for 64 bit os, i guess), search for the macromed directory.

      compiled against mogre 1.7.1, vs2008 version :

      Makarui (12.04.2011)

      Here the demo of Hikari, ported to Makarui :

      Makarui demo

      If you want to compile it from source, it's available on bitbucket, on the mogre addons repository :

      http://bitbucket.org/mogre/mogreaddons/src

      you will need to compile both akarui (under the akarui directory) and Makarui.

      Dependencies used for akarui :
      1. Npapi-headers : http://code.google.com/p/npapi-headers/[/*:m][/list:u]

        Dependencies used for Makarui :
        1. headers of Boost 1.40 (the version used by mogre)[/*:m]
        2. Mois[/*:m]
        3. Mogre 1.7.1, Akarui (obviously :))[/*:m]
        4. Npapi-headers[/*:m][/list:u]

smiley80

11-11-2010 16:54:48

Nice!
Makarui flash control inside a Miyagi panel:


FlashMaterial is untested

CreateFlashMaterial doesn't seem to create a Material (MaterialManager.Singleton.GetByName returns null for FlashControl.MaterialName), and MakaruiManager.Update throws a NullReferenceException.

issingle

12-11-2010 13:09:24

any one have some performance test data about makarui? :D
thx

GantZ

12-11-2010 16:21:47

@smiley80

thanks for the report ! right now, i haven't too much time to look into this issue, but it shouldn't taking too long to fix it. good to see you have been able to include it with miyagi quite fast :)

@issingle

i plan on making some stress test flash control to see how makarui perform vs hikariwrapper. so far, it perform better with transparent control than hikariwrapper. i still need to make some benchmark on this. stay tuned ;)

mstoyke

14-11-2010 02:40:08

Gantz, this is awesome. I've never used flash, so I can't test it properly, but I know somebody who might be interested in this and I will tell him to try it and send any feedback to you.

alamata

27-12-2010 21:25:50

sorry for my intervention in this topic... :oops:

but can you provide a functionnal sample,... :oops:

thanks for your comprehension,...

GantZ

27-12-2010 22:50:16

here you go :

http://sourceforge.net/projects/mogre/files/mogre/1.7.1/MakaruiDemo.7z/download

compiled against mogre 1.7.1, vs2008. it's the debug version, so you need to have vs2008 installed to run it (express or better)

you can directly run the exe in the debug folder. the csharp source code as well as the .fla files are included. it's a straight port of my old hikariwrapper demo.

alamata

28-12-2010 02:01:15

Thanks for a lot for your patience,... :wink: :D


perhaps the first step of an new story for me,... :D

THX,...

alamata

30-12-2010 11:43:37

FlashMaterial is untested


CreateFlashMaterial doesn't seem to create a Material (MaterialManager.Singleton.GetByName returns null for FlashControl.MaterialName), and MakaruiManager.Update throws a NullReferenceException.


.... hope this issue will be corrected soon... :roll:

thx for all your job,... :wink:

kongkana

11-04-2011 15:24:28

ExternalInterface.call must be used with setTimeout on flash 10 pluginCould you please explain me what does it mean?
Do you have any flash sample code?
I use "controls.fla" from HikariDemo but it doesn't callback when I click any button.

Thanks.

GantZ

11-04-2011 18:02:59

basically, instead of using this code in the flash function :

ExternalInterface.call("FunctionName",funcArg1, funcArg2);

you use this one :

setTimeout(ExternalInterface.call,0,"FunctionName",funcArg1, funcArg2);

where the first parameter second parameter is the delay you want to have. Here its 0 ms, but you could also put 1 (at least I haven't got any error with either 0 or 1 ms), the only thing that you must
avoid is calling ExternalInterface.call directly.

kongkana

12-04-2011 05:48:04

Thank you very much GantZ.
I did as you said but it still doesn't work. :(
All UI in "control.swf" doesn't interact with mouse event, I can't click button, can't drag slide bar, can't click colour palette.
I debug in the code, it always return false in function "PluginHost::getSingleton()->pluginFuncs()->event(nppHandle, &event)" in PlugunInstance.cpp.
Which https://developer.mozilla.org/en/NPP_HandleEvent said that If the plug-in handles the event, the function should return true.
If the plug-in ignores the event, the function returns false.

I don't understand why NPP_HandleEvent ignore my event.
Does anyone get the same problem with me??? Any solution???

Thanks.

GantZ

12-04-2011 19:20:46

Check that you correctly use InjectMouseDown of the manager, alternatively, you can directly inject an event on the flash control, using the InjectMouseDown function of the FlashControl Class.

As a reference, I have uploaded source code + binary of an updated version of the makarui demo

https://bitbucket.org/mogre/mogreaddons/downloads/MakaruiDemo.7z

It also contains the updated .fla files for Makarui. On a side note, this demo use the latest version of Makarui from the repository available here:

https://bitbucket.org/mogre/mogreaddons/downloads/Makarui_12_04_2011.zip

the link in the first post as also been updated.

kongkana

25-04-2011 08:02:15

Actually, I don't use Makarui because my project is C++. So I convert your C# Makarui to C++.
The reason why I can't click any button is my bugs when converting your code.
And now, I successfully make it works.

Anyway, Thank you very much :D

zephod

21-11-2011 20:41:43

"Known issues:
...
Missing implementation of code like SetLoop(), SetQuality(), SetScaleMode(). "

Any work been done on implementing these?