Hikari (v0.3)
- DanielSefton
- Ogre Magi
- Posts: 1235
- Joined: Fri Oct 26, 2007 12:36 am
- Location: Mountain View, CA
- x 10
- Contact:
Not had much of a play yet, but awesome stuff so far! Got it overlayed very nicely.
I've been using Flash for 4+ years now, so finally I can use something I'm familiar with in my project. A lovely CEGUI replacement. I'll inform you of my progress.
[Edit]
Input injection working beautifully! Next step, SWF event feedback.
P.S. How do you stop it from moving the window about with right click?
I've been using Flash for 4+ years now, so finally I can use something I'm familiar with in my project. A lovely CEGUI replacement. I'll inform you of my progress.
[Edit]
Input injection working beautifully! Next step, SWF event feedback.
P.S. How do you stop it from moving the window about with right click?
- dazKind
- Gnoblar
- Posts: 24
- Joined: Thu May 04, 2006 10:43 am
- Contact:
This is awesome!
Concerning the code I instantly felt at home after all this time working with Navi. Works mighty fine for its first release!
edit:
Just ran some tests and the results are stunning. No matter what I throw at it comes out all fine. Even a complete & heavily animated website runs at an acceptable speed. You notice that it runs not super smooth but for a first release thats awesome. Even my old flash-based internet-radio-player works without a flaw.
Hikari is definately my new GUI-lib of choice.
Concerning the code I instantly felt at home after all this time working with Navi. Works mighty fine for its first release!
edit:
Just ran some tests and the results are stunning. No matter what I throw at it comes out all fine. Even a complete & heavily animated website runs at an acceptable speed. You notice that it runs not super smooth but for a first release thats awesome. Even my old flash-based internet-radio-player works without a flaw.
Hikari is definately my new GUI-lib of choice.
Last edited by dazKind on Mon Jun 09, 2008 12:33 am, edited 1 time in total.
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
I'm very glad to hear that! The callback system in Hikari is actually very powerful, I will try to put up a mini tutorial tonight.DanielSefton wrote:Not had much of a play yet, but awesome stuff so far! Got it overlayed very nicely.
I've been using Flash for 4+ years now, so finally I can use something I'm familiar with in my project. A lovely CEGUI replacement. I'll inform you of my progress.
[Edit]
Input injection working beautifully! Next step, SWF event feedback.
P.S. How do you stop it from moving the window about with right click?
As for disabling the right-button-drag, I neglected to implement lots of the non-essentials because v0.2 was intended to simply demonstrate and refine the basic implementation. So fear not, more functionality is coming.
Thanks, I tried to keep the API simple and familiar. ^^dazKind wrote:This is awesome!
Concerning the code I instantly felt at home after all this time working with Navi. Works mighty fine for its first release!
- cybereality
- Hobgoblin
- Posts: 563
- Joined: Wed Jul 12, 2006 5:40 pm
- x 12
- johnhpus
- Platinum Sponsor
- Posts: 1186
- Joined: Sat Apr 17, 2004 2:49 am
- x 3
Excellent. It sounds like you're right on top of things. Good work and thanks again for making this public. I'm eager to get the time to try it outside of the current demo.johnpus wrote:
The demo is very cool, but I noticed a slight lag when dragging the slider back and forth.
Any idea on the cause? In Navi there can be a similar lag when using non-Flash sliders and I think it's because it's copying the entire buffer instead of just the dirty area (not at all sure about that). Are you copying the buffer entirely or concentrating on parts that have changed?
That slider is quite the stress-test because of several factors: it employs "live-dragging" (constantly notifies listeners during the drag), updates a small bit of text below the slider, invalidates the area, and alters the material's opacity with every pixel the slider is dragged.
Hikari definitely employs dirty-rectangling-- during updates, only the dirty area is rendered by Flash. This isn't to say that the dirty-rectangling is perfect: I had several issues getting the HardwarePixelBuffer to lock with arbitrary rectangles and so I instead maintain an internal shadow buffer to handle rectangle merging and then blit the entire shadow buffer to the pixel buffer using simple row-memcpy. The method, though imperfect, is still quite effective because profiling shows that the Flash software renderer is, naturally, the biggest CPU hog in the chain-- comparatively, the memcpy is negligible.
Nevertheless, I'll see if I can't find a compatible way to do dirty-rectangle updates directly in Ogre3D, to squeeze the maximum amount of performance out.
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
It's entirely Windows-dependent (ActiveX, OLE, message hooks), and will most definitely remain so. Sorry.pratty70 wrote:Windows only at the moment?
Anyways, for those eager to utilize Flash/ActionScript <-> C++ communication in Hikari, read on.
FlashValue Basics
Hikari::FlashValue is essentially a variant class that represents an ActionScript value. It supports the basic types of: null, boolean, number, and string. You check its type using FlashValue::getType and then you retrieve its value using FlashValue::getBool, getNumber, or getString. When declaring a FlashValue in C++, its type is determined automatically by how you initialize it (see FlashValue.h for more info).
Hikari::Arguments is just a typedef for a vector of FlashValue's.
Communicating from Flash to C++
First, define your callback function in C++, it can be either a member function or a static function, it just needs to have the same signature as the example below:
Code: Select all
FlashValue onPlayerLogin(FlashControl* caller, const Arguments& args)
{
String username = args.at(0).getString();
String password = args.at(1).getString();
bool success = netManager.login(username, password);
if(success)
return "Welcome to the world!";
else
return "Incorrect username/password.";
}
Code: Select all
myFlashControl->bind("playerLogin", &onPlayerLogin);
Code: Select all
myFlashControl->bind("playerLogin", FlashDelegate(this, &MyClass::onPlayerLogin));
Code: Select all
function loginClick(event:MouseEvent):void
{
caption.text = ExternalInterface.call("playerLogin", username, password);
}
Communicating from C++ to Flash
First, define your callback function in ActionScript.
Code: Select all
function setHP(hp:Number):void
{
hpBar.value = hp;
}
Code: Select all
ExternalInterface.addCallback("setHP", setHP);
Code: Select all
myFlashControl->callFunction("setHP", Args(hpValue));
Code: Select all
Args(arg1)(arg2)(arg3)(arg4)...
Voila, I think I've covered the essentials-- if you need any help, feel free to ask, and I hope to see lots of cool creations from you hackers out there!
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
so I wonder if flash 10 will work. Seeing as that apparantly uses hardware acceleration (FINALLY). If they work together it might boost it considerably... or crash horriblyajs15822 wrote:The method, though imperfect, is still quite effective because profiling shows that the Flash software renderer is, naturally, the biggest CPU hog in the chain-- comparatively, the memcpy is negligible.
- DanielSefton
- Ogre Magi
- Posts: 1235
- Joined: Fri Oct 26, 2007 12:36 am
- Location: Mountain View, CA
- x 10
- Contact:
Dude... Are you like, psychic. Before you posted that, I wrote "I hope you'll still be working on Hikari for the release of Flash Player 10. It uses hardware acceleration (FINALLY)".Vectrex wrote:so I wonder if flash 10 will work. Seeing as that apparantly uses hardware acceleration (FINALLY). If they work together it might boost it considerably... or crash horribly
Apparently they are trying to compete with SUN, so it looks very promising. I hope so, because it's important for our project to remain cross-platform. Looks like I'm going to have to keep CEGUI in my project for now, and Linux and Mac will have to endure a less visual UI. =[
Any tips for disabling it now?As for disabling the right-button-drag, I neglected to implement lots of the non-essentials because v0.2 was intended to simply demonstrate and refine the basic implementation. So fear not, more functionality is coming.
Thanks for the guide btw. I think you need to create a Wiki page.
-
- Halfling
- Posts: 52
- Joined: Wed Jun 06, 2007 5:01 pm
-
- Greenskin
- Posts: 102
- Joined: Tue May 10, 2005 11:42 pm
- Location: SF, California
- Contact:
The only problem with using something like boost in a library project is then you are dependent on it. Then people that want to you your library have to get ahold of boost. And they might have to get the right version of boost too. So if I am using an older version of boost and I want to use the library, now I need to upgrade to the latest version of boost (which may not be possible for some people).
I do really like boost however :)
I do really like boost however :)
- KungFooMasta
- OGRE Contributor
- Posts: 2087
- Joined: Thu Mar 03, 2005 7:11 am
- Location: WA, USA
- x 16
- Contact:
Its only 2 small classes required to implement a good callback system. 40 lines of code, or adding a dependency... easy choice.It's kinda frustrating seeing all these UIs that use
things like callbacks and variants and whatnot and
end up coding their own.
Creator of QuickGUI!
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
got this error
Error 1 error C3500: invalid ProgID 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
Error 2 fatal error C1103: fatal error importing progid: 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
I've never used #import before so I'm not sure if I'm supposed to download some flash component or something
edit: Actually, I have flash 10 beta installed. Would that be messing with it?
Error 1 error C3500: invalid ProgID 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
Error 2 fatal error C1103: fatal error importing progid: 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
I've never used #import before so I'm not sure if I'm supposed to download some flash component or something
edit: Actually, I have flash 10 beta installed. Would that be messing with it?
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
I love Boost and am well acquainted with it-- still, like the others say, I didn't want to introduce any extra dependencies. Besides, I didn't actually "code my own", I generated the "FlashDelegate" class automatically using the FastDelegate macros..overlord. wrote:Hey,
looks pretty cool. Have you looked into using boost?
It's kinda frustrating seeing all these UIs that use
things like callbacks and variants and whatnot and
end up coding their own.
bind/signals/slots/any might be worth looking into
anyways, keep up the good work!
Possibly, the API doesn't expose any MSVC-specific code to my knowledge.rtlpixy wrote:I currently use Code::Blocks to develop with Ogre 3D (on Windows).
It is possible, after compiling Hikary libs using MVSC2005, using it with Code::Blocks ?
Flash Player 10 should work (theoretically!) with Hikari-- the GPU acceleration and 3D features are certainly exciting.Dude... Are you like, psychic. Before you posted that, I wrote "I hope you'll still be working on Hikari for the release of Flash Player 10. It uses hardware acceleration (FINALLY)".
Apparently they are trying to compete with SUN, so it looks very promising. I hope so, because it's important for our project to remain cross-platform. Looks like I'm going to have to keep CEGUI in my project for now, and Linux and Mac will have to endure a less visual UI. =[
I have no idea if Adobe will ever release a true, cross-platform runtime (and not just OS-specific controls), but I certainly hope that with their new open-source initiative they will make plans to do so.
Sure, in your mouse input handler, don't inject right-mouse-button events.Any tips for disabling [right-button drag] now?
Hmm, that's interesting-- maybe the beta is messing with the class ID definitions. I want you to open up regedit, go to COMPUTER/HKEY_CLASSES_ROOT, and scroll down to the "ShockwaveFlash.*" area. Give me a listing of which classes (such as ShockwaveFlash.ShockwaveFlash.9) you have listed there.Vectrex wrote:got this error
Error 1 error C3500: invalid ProgID 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
Error 2 fatal error C1103: fatal error importing progid: 'ShockwaveFlash.ShockwaveFlash' c:\Documents and Settings\Administrator\Desktop\Downloads\Programming\Hikari Source - v0.2\Hikari\include\impl\FlashSite.h 25
I've never used #import before so I'm not sure if I'm supposed to download some flash component or something
edit: Actually, I have flash 10 beta installed. Would that be messing with it?
- Zeal
- Ogre Magi
- Posts: 1260
- Joined: Mon Aug 07, 2006 6:16 am
- Location: Colorado Springs, CO USA
Seems like a good idea to just focus on one platform in these early stages, but theoretically, whats holding it back from going multiplatform? I assume there have to be similar things to ActiveX on mac, ect... no?It's entirely Windows-dependent (ActiveX, OLE, message hooks), and will most definitely remain so. Sorry.
I just think it would be wise to adopt a sort of 'platform indepenent' methodology when designing the api (like Ogre), even if you have no immediate plans to support something like that. Then down the road im sure other people will be willing to do all the work for you when it comes to supporting mac/linux ect...
*btw is it pronounced Hickory, like Hickory smoked turkey? What does it mean anyway?
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
The API isn't too platform-dependent, the majority of the Windows-specific stuff is under the covers. The three most implementation-dependent classes-- the OLE site, keyboard hook, and event handler-- are all modularized in their own classes. Just a little more abstraction is needed to make the API truly platform-independent.Zeal wrote:Seems like a good idea to just focus on one platform in these early stages, but theoretically, whats holding it back from going multiplatform? I assume there have to be similar things to ActiveX on mac, ect... no?It's entirely Windows-dependent (ActiveX, OLE, message hooks), and will most definitely remain so. Sorry.
I just think it would be wise to adopt a sort of 'platform indepenent' methodology when designing the api (like Ogre), even if you have no immediate plans to support something like that. Then down the road im sure other people will be willing to do all the work for you when it comes to supporting mac/linux ect...
*btw is it pronounced Hickory, like Hickory smoked turkey? What does it mean anyway?
But you're right-- what's holding Hikari back from multi-platform is my own inexperience with other operating systems. If Linux/Mac talent were to research Flash embedding on their respective OS and offer me a hand, I'd be thrilled.
Hikari (pronounced "Hee-kah-ree") is Japanese for "Light" (as in "a glimmer of light faded from the horizon").
- Zeal
- Ogre Magi
- Posts: 1260
- Joined: Mon Aug 07, 2006 6:16 am
- Location: Colorado Springs, CO USA
Good thats the only point I wanted to make. Im sure if you keep the platform specific stuff low level enough, there will be enough mac/linux fanbois who will be willing to do all the work for you.the majority of the Windows-specific stuff is under the covers.
I mean seriously who isnt foaming at the mouth over Hikari? You now command an army of loyal zombie servants, your will is our command.
- Praetor
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
The Flash activex control is relatively easy to access and wrap. Getting this activex control to consistently work and work well cross-platform is nearly impossible.
The only option to get a cross-platform Flash working is to go for the flash mozilla/opera/safari plugin (instead of the activex control). These are two completely different implementations with two completely different APIs. While you can find info on the interfaces for embedding the Flash activex control, embedding the mozilla plugin version has nearly zero information anywhere and is an outrageous effort to make it work properly. And you get the added bonus of no help in any way from Adobe.
The only option to get a cross-platform Flash working is to go for the flash mozilla/opera/safari plugin (instead of the activex control). These are two completely different implementations with two completely different APIs. While you can find info on the interfaces for embedding the Flash activex control, embedding the mozilla plugin version has nearly zero information anywhere and is an outrageous effort to make it work properly. And you get the added bonus of no help in any way from Adobe.
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
At the very least, there's hope.Praetor wrote:The only option to get a cross-platform Flash working is to go for the flash mozilla/opera/safari plugin (instead of the activex control). These are two completely different implementations with two completely different APIs. While you can find info on the interfaces for embedding the Flash activex control, embedding the mozilla plugin version has nearly zero information anywhere and is an outrageous effort to make it work properly. And you get the added bonus of no help in any way from Adobe.
For the interested, I've just posted some basic tutorials (based on my previous posts) in the Hikari Wiki.
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
ahh. I've got nothing. The installer must have installed the opera/firefox plugins but no activeX at all (It doesn't work in IE). Which is odd.ajs15822 wrote:Hmm, that's interesting-- maybe the beta is messing with the class ID definitions. I want you to open up regedit, go to COMPUTER/HKEY_CLASSES_ROOT, and scroll down to the "ShockwaveFlash.*" area. Give me a listing of which classes (such as ShockwaveFlash.ShockwaveFlash.9) you have listed there.
But is there a way to use the included flash.ocx without flash actually being installed on the computer? Or a different version?
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash]
@="Flash Movie"
[HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\DefaultIcon]
@="C:\\Program Files\\Adobe\\Adobe Flash CS3\\flash.exe,2"
[HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell]
@=""
[HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell\open]
@=""
[HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell\open\command]
@=""C:\\Program Files\\Adobe\\Adobe Flash CS3\\Players\\FlashPlayer.exe" %1"
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
Very peculiar-- have you tried installing this?Vectrex wrote:ahh. I've got nothing. The installer must have installed the opera/firefox plugins but no activeX at all (It doesn't work in IE). Which is odd.ajs15822 wrote:Hmm, that's interesting-- maybe the beta is messing with the class ID definitions. I want you to open up regedit, go to COMPUTER/HKEY_CLASSES_ROOT, and scroll down to the "ShockwaveFlash.*" area. Give me a listing of which classes (such as ShockwaveFlash.ShockwaveFlash.9) you have listed there.
But is there a way to use the included flash.ocx without flash actually being installed on the computer? Or a different version?
Code: Select all
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash] @="Flash Movie" [HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\DefaultIcon] @="C:\\Program Files\\Adobe\\Adobe Flash CS3\\flash.exe,2" [HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell] @="" [HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell\open] @="" [HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash\shell\open\command] @=""C:\\Program Files\\Adobe\\Adobe Flash CS3\\Players\\FlashPlayer.exe" %1"
And yes, you can bundle the actual control with Hikari by placing "Flash.ocx" in the working directory of your executable. You should be able to obtain it by navigating to "C:\WINDOWS\system32\Macromed\Flash", there you will find something like "Flash9b.ocx". Just copy that file to your working directory and rename it to "Flash.ocx" and you're good to go. (To stay legally air-tight while distributing the Flash control, you need to apply for a free license)
- manowar
- Orc
- Posts: 419
- Joined: Thu Apr 07, 2005 2:11 pm
- Location: UK
- Contact:
This sounds like a really good project and I could not wait to test it. Unfortunately I have not managed to compile it. I am using visual studio express 2005.
I do not know much about activeX programming. From what I understand the file flash6.tlh is autogenerated and I guess the problem is related to that file.
Thanks for any help
Code: Select all
1>.\source\FlashControl.cpp(342) : error C2039: 'CallFunction' : is not a member of 'ShockwaveFlashObjects::IShockwaveFlash'
1> c:\documents and settings\administrator\desktop\hikari source - v0.2\hikari\objects\release\flash6.tlh(50) : see declaration of 'ShockwaveFlashObjects::IShockwaveFlash'
1>.\source\FlashControl.cpp(420) : error C2039: 'SetReturnValue' : is not a member of 'ShockwaveFlashObjects::IShockwaveFlash'
1> c:\documents and settings\administrator\desktop\hikari source - v0.2\hikari\objects\release\flash6.tlh(50) : see declaration of 'ShockwaveFlashObjects::IShockwaveFlash'
Thanks for any help
- ajs15822
- OGRE Expert User
- Posts: 570
- Joined: Mon Jan 02, 2006 2:05 am
- Location: Texas
- x 2
- Contact:
It seems that you have the Flash Player 6 ActiveX Control installed, to compile Hikari you need the Flash Player 9 ActiveX Control-- you can download it here (you may need to open the link from Internet Explorer to get the correct distribution).manowar wrote:This sounds like a really good project and I could not wait to test it. Unfortunately I have not managed to compile it. I am using visual studio express 2005.I do not know much about activeX programming. From what I understand the file flash6.tlh is autogenerated and I guess the problem is related to that file.Code: Select all
1>.\source\FlashControl.cpp(342) : error C2039: 'CallFunction' : is not a member of 'ShockwaveFlashObjects::IShockwaveFlash' 1> c:\documents and settings\administrator\desktop\hikari source - v0.2\hikari\objects\release\flash6.tlh(50) : see declaration of 'ShockwaveFlashObjects::IShockwaveFlash' 1>.\source\FlashControl.cpp(420) : error C2039: 'SetReturnValue' : is not a member of 'ShockwaveFlashObjects::IShockwaveFlash' 1> c:\documents and settings\administrator\desktop\hikari source - v0.2\hikari\objects\release\flash6.tlh(50) : see declaration of 'ShockwaveFlashObjects::IShockwaveFlash'
Thanks for any help
Last edited by ajs15822 on Tue Jun 10, 2008 10:42 am, edited 1 time in total.