This library enables you to embed any swf file as your GUI.
It is a free alternative to the pricey ScaleForm.
Here's a screenshot of the library in action:
You can play with the slider and the color picker.
The library consists of 2 part
SwfUI:This is a fork of Hikari
http://www.ogre3d.org/forums/viewtopic.php?t=41999 , a flash UI Library for Ogre .
I stripped away all the Ogre related part and replace them with abstractions.
I also follow SFML design goal and keep everything as simple as possible.
Feature:
-API independent. You can provide your own render API-specific implementation
-C++ can call action script functions. Action script can call C++ functions through a simple interface. Data types are transparently converted.
-Unicode support
-Automatic capture of keyboard input
-Dynamically load IShockwaveFlashObject from a .ocx file so client machine does not need to have flash installed.
sfFlash:This is the SFML render implementation of SwfUI.
Feature:
-Deadly simple interface. This is how you load a control:
sf::FlashControl test(512,512);
test.load(L"controls.swf");
test.SetPosition(100.0f,200.0f);
test.SetRotation(45.0f);//Yes, your control still works even when it's rotated
test.setRenderQuality(SwfUI::RQ_AUTOHIGH);
And render it:
window.Draw(test);//window is of type sf::RenderWindow
-Efficient rendering through a dirty rectangle system.
-Automatic conversion between flash data types and SFML data types. Currently, only ActionScript colors (passed as floats) are converted to sf::Color.
Limitation:-Windows only
-Performance is not good enough. Currently, i'm using glTexSubImage2D to update the texture. My crappy graphic card does not support PBO so I cannot provide a better implementation.
How SwfUI is implemented:It is the similar to how Hikari did it:
Create a windowless OLE container. Put an IShockwaveFlashObject inside.
Everytime the control need to be redrawn, call OleDraw to draw the dirty part in my own DC.
Copy the dirty part to a separate buffer (make it contiguous) and call glTexSubImage2D to update the texture.
Events are sent using window messages.
TODO:-A proper tutorial
-Better data sharing between C++ and flash (loading flash files from memory, send image from C++ to ActionScript...)
-Get rid of the annoying exceptions in flash.ocx
Help needed:-Someone who can implement a better rending technique (through PBO?)
-Someone who is experienced in COM in general and flash COM interface.
Project page(with download links):https://code.google.com/p/swfui/