Public Types | Public Member Functions | Public Attributes | Friends

FlashControl Class Reference

#include <FlashControl.h>

Inheritance diagram for FlashControl:
SFlashControl

List of all members.

Public Types

typedef std::map< std::wstring,
Hikari::FlashDelegate > 
DelegateMap
typedef DelegateMap::iterator DelegateIter

Public Member Functions

 FlashControl (const string &name, Viewport *viewport, int width, int height, const Hikari::Position &position, unsigned short zOrder)
 FlashControl (const string &name, SScene *scene, const string &_matName, int width, int height, int techID=0, int passID=0, int unitID=0)
 ~FlashControl ()
void setZOrder (unsigned short zorder)
unsigned short getZOrder ()
int getRelativeX (int absX)
int getRelativeY (int absY)
bool EnableMode (int mode)
bool DisableMode (int mode)
void createControl ()
void createMaterial ()
bool isPointOverMe (int screenX, int screenY)
void invalidateTotally ()
void handleKeyEvent (UINT msg, WPARAM wParam, LPARAM lParam)
void handleFlashCall (const std::wstring &xmlString)
void update ()
void load (const string &movieFilename, Hikari::HikariManager *hikariMgr, int type)
void play ()
void stop ()
void rewind ()
void gotoFrame (long frameNum)
void setLoop (bool shouldLoop)
void setTransparent (bool isTransparent, bool useAlphaHack=false)
void setQuality (short renderQuality)
void setScaleMode (short scaleMode)
void setDraggable (bool isDraggable)
void setIgnoreTransparentPixels (bool shouldIgnore, float threshold=0.04)
const string & getName () const
const string & getMaterialName () const
void bind (const std::wstring &funcName, const Hikari::FlashDelegate &callback)
void unbind (const std::wstring &funcName)
Hikari::FlashValue callFunction (const std::wstring &funcName, const Hikari::Arguments &args=Hikari::Args())
void hide ()
void show ()
bool getVisibility () const
void setOpacity (float opacity)
void focus ()
void updateZOrder ()
void move (int deltaX, int deltaY)
void getExtents (unsigned short &width, unsigned short &height) const
void getUVScale (float &uScale, float &vScale) const
void injectMouseMove (int xPos, int yPos, int btn)
void injectMouseDown (int xPos, int yPos, int index)
void injectMouseUp (int xPos, int yPos, int index)
void injectMouseWheel (int relScroll, int xPos, int yPos)
void loadResource (Resource *resource)
void updateTexture ()
void applyTexture (string matname, int techidx=0, int passidx=0, int unitidx=0)
void restoreMaterial ()
bool isLoaded ()

Public Attributes

bool usingAlphaHack
bool originalDepthWritting
Ogre::SceneBlendFactor sBlend
Ogre::SceneBlendFactor dBlend
bool isFirstInside
bool onMaterial
bool isFirstOutside
OgreViewportOverlayoverlay
SViewPortcurrentViewport
SScenecurrentScene
size_t texWidth
size_t texHeight
size_t texDepth
size_t texPitch
string materialName
string textureName
bool isIgnoringTransparent
float transThreshold
int lastDirtyWidth
int lastDirtyHeight
DelegateMap delegateMap
TexturePtr texture
TexturePtr oldTex
int _tec
int _pass
int _unit
TextureUnitState * texUnit
bool movieLoaded

Friends

class Hikari::Impl::FlashSite
class Hikari::Impl::FlashHandler
class Hikari::HikariManager

Detailed Description

The Ogre-FlashControl class is an instance of the Flash Player that is rendered dynamically to a texture and wrapped in an optional movable overlay using the Ogre3D engine. NOTES: Based on original FlashControl Class, but undocked of Hikari Lib by Zed Games Development Team

Definition at line 50 of file FlashControl.h.


Member Typedef Documentation

typedef DelegateMap::iterator FlashControl::DelegateIter

Definition at line 81 of file FlashControl.h.

typedef std::map<std::wstring, Hikari::FlashDelegate> FlashControl::DelegateMap

Definition at line 80 of file FlashControl.h.


Constructor & Destructor Documentation

FlashControl::FlashControl ( const string &  name,
Viewport *  viewport,
int  width,
int  height,
const Hikari::Position &  position,
unsigned short  zOrder 
)

Definition at line 66 of file FlashControl.cpp.

FlashControl::FlashControl ( const string &  name,
SScene scene,
const string &  _matName,
int  width,
int  height,
int  techID = 0,
int  passID = 0,
int  unitID = 0 
)

Definition at line 134 of file FlashControl.cpp.

FlashControl::~FlashControl (  )

Definition at line 185 of file FlashControl.cpp.


Member Function Documentation

void FlashControl::applyTexture ( string  matname,
int  techidx = 0,
int  passidx = 0,
int  unitidx = 0 
)

Definition at line 495 of file FlashControl.cpp.

void FlashControl::bind ( const std::wstring &  funcName,
const Hikari::FlashDelegate &  callback 
)

Binds a local callback to a certain function name so that your Flash movie can call the function from ActionScript using ExternalInterface.call('functionName').

Parameters:
funcNameThe name to bind this callback to.
callbackThe local function to call, see below for examples of declaring a FlashDelegate.
        // Example declaration of a compatible function (static function):
        FlashValue myStaticFunction(FlashControl* caller, const Arguments& args)
        {
                // Handle the callback here
                return FLASH_VOID;
        }

        // Example declaration of a compatible function (member function):
        FlashValue MyClass::myMemberFunction(FlashControl* caller, const Arguments& args)
        {
                // Handle the callback here
                return "Some return value!";
        }

        // FlashDelegate (member function) instantiation:
        FlashDelegate callback(this, &MyClass::myMemberFunction); // within a class
        FlashDelegate callback2(pointerToClassInstance, &MyClass::myMemberFunction);

        // FlashDelegate (static function) instantiation:
        FlashDelegate callback(&myStaticFunction);

Definition at line 732 of file FlashControl.cpp.

Hikari::FlashValue FlashControl::callFunction ( const std::wstring &  funcName,
const Hikari::Arguments &  args = Hikari::Args() 
)

Attempts to call a function declared as a callback in the ActionScript of the currently-loaded movie.

Parameters:
funcNameThe name of the callback that was declared using 'ExternalInterface.addCallback(funcName, function)' in the ActionScript of the currently-loaded movie.
argsThe arguments to pass to the ActionScript function.
Returns:
If the invocation was successful and the ActionScript function returned a value, returns a FlashValue with a non-null type.
Note:
It is highly recommended to use the 'Args(arg1)(arg2)(arg3)...' helper class to pass arguments.

Definition at line 747 of file FlashControl.cpp.

void FlashControl::createControl (  )

Definition at line 254 of file FlashControl.cpp.

void FlashControl::createMaterial (  )

Definition at line 326 of file FlashControl.cpp.

bool FlashControl::DisableMode ( int  mode ) [inline]

Definition at line 126 of file FlashControl.h.

bool FlashControl::EnableMode ( int  mode ) [inline]

Definition at line 117 of file FlashControl.h.

void FlashControl::focus (  )

Gives this FlashControl keyboard focus. Additionally, if this FlashControl is an overlay, pops it to the front.

Definition at line 783 of file FlashControl.cpp.

void FlashControl::getExtents ( unsigned short &  width,
unsigned short &  height 
) const

Retrieves the width and height that this FlashControl was created with.

Parameters:
[out]widthThe unsigned short that will be used to store the retrieved width.
[out]heightThe unsigned short that will be used to store the retrieved height.

Definition at line 878 of file FlashControl.cpp.

const Ogre::String & FlashControl::getMaterialName (  ) const

Retrieves the name of the Ogre::Material used by this FlashControl.

Definition at line 727 of file FlashControl.cpp.

const Ogre::String & FlashControl::getName (  ) const

Returns the name of this FlashControl.

Definition at line 722 of file FlashControl.cpp.

int FlashControl::getRelativeX ( int  absX ) [inline]

Definition at line 107 of file FlashControl.h.

int FlashControl::getRelativeY ( int  absY ) [inline]

Definition at line 112 of file FlashControl.h.

void FlashControl::getUVScale ( float &  uScale,
float &  vScale 
) const

Gets the UV scale of this FlashControl's internal texture. On certain systems we must compensate for lack of NPOT-support on the videocard by using the next-highest POT texture. Normally, FlashControl overlays compensate their texture coordinates automatically however FlashControls created as pure materials will need to adjust their own by use of this function.

Parameters:
[out]uScaleThe Ogre::Real that will be used to store the retrieved U-scale.
[out]vScaleThe Ogre::Real that will be used to store the retrieved V-scale.
bool FlashControl::getVisibility (  ) const

Returns whether or not the FlashControl overlay is currently visible. (See FlashControl::hide and FlashControl::show) If this FlashControl was not created as an overlay, always returns false.

Definition at line 770 of file FlashControl.cpp.

unsigned short FlashControl::getZOrder (  ) [inline]

Definition at line 102 of file FlashControl.h.

void FlashControl::gotoFrame ( long  frameNum )

Navigates the currently-loaded movie to a certain frame and stops there.

Definition at line 651 of file FlashControl.cpp.

void FlashControl::handleFlashCall ( const std::wstring &  xmlString )

Definition at line 1094 of file FlashControl.cpp.

void FlashControl::handleKeyEvent ( UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1088 of file FlashControl.cpp.

void FlashControl::hide (  )

If this FlashControl was created as an overlay, hides the overlay.

Definition at line 760 of file FlashControl.cpp.

void FlashControl::injectMouseDown ( int  xPos,
int  yPos,
int  index 
)

Injects a mouse-down event into this FlashControl (in the control's local coordinate-space).

Parameters:
xPosThe local X-coordinate.
yPosThe local Y-coordinate.

Definition at line 926 of file FlashControl.cpp.

void FlashControl::injectMouseMove ( int  xPos,
int  yPos,
int  btn 
)

Injects a mouse-move event into this FlashControl (in the control's local coordinate-space).

Parameters:
xPosThe local X-coordinate.
yPosThe local Y-coordinate.

Definition at line 895 of file FlashControl.cpp.

void FlashControl::injectMouseUp ( int  xPos,
int  yPos,
int  index 
)

Injects a mouse-up event into this FlashControl (in the control's local coordinate-space).

Parameters:
xPosThe local X-coordinate.
yPosThe local Y-coordinate.

Definition at line 969 of file FlashControl.cpp.

void FlashControl::injectMouseWheel ( int  relScroll,
int  xPos,
int  yPos 
)

Injects a mouse-wheel event into this FlashControl (in the control's local coordinate-space).

Parameters:
relScrollThe relative scroll amount of the mouse-wheel.
xPosThe local X-coordinate of the mouse.
yPosThe local Y-coordinate of the mouse.

Definition at line 1012 of file FlashControl.cpp.

void FlashControl::invalidateTotally (  )

Definition at line 1078 of file FlashControl.cpp.

bool FlashControl::isLoaded (  )

Definition at line 1254 of file FlashControl.cpp.

bool FlashControl::isPointOverMe ( int  screenX,
int  screenY 
)

Definition at line 1027 of file FlashControl.cpp.

void FlashControl::load ( const string &  movieFilename,
Hikari::HikariManager *  hikariMgr,
int  type 
)

Loads a movie (a .swf file) into this FlashControl and begins playing.

Parameters:
movieFilenameThe filename of the movie to load.
Note:
The specified movie should reside in the "assetsDirectory" that was declared when the HikariManager was instantiated.
void FlashControl::loadResource ( Resource *  resource )
void FlashControl::move ( int  deltaX,
int  deltaY 
)

If this FlashControl was created as an overlay, moves the overlay in relative amounts.

Parameters:
deltaXThe amount (in pixels) to move the overlay in the X-axis.
deltaYThe amount (in pixels) to move the overlay in the Y-axis.

Definition at line 872 of file FlashControl.cpp.

void FlashControl::play (  )

Plays the currently-loaded movie.

Definition at line 636 of file FlashControl.cpp.

void FlashControl::restoreMaterial (  )

Definition at line 229 of file FlashControl.cpp.

void FlashControl::rewind (  )

Rewinds the currently-loaded movie to the beginning.

Definition at line 646 of file FlashControl.cpp.

void FlashControl::setDraggable ( bool  isDraggable )

Sets whether this FlashControl is draggable via the right-mouse-button, this is only applicable to FlashControls created as an overlay.

Parameters:
isDraggableWhether or not this FlashControl should be draggable.

Definition at line 711 of file FlashControl.cpp.

void FlashControl::setIgnoreTransparentPixels ( bool  shouldIgnore,
float  threshold = 0.04 
)

Sets whether or not mouse-clicks over transparent pixels should be ignored (this is on by default), this is only applicable to transparent FlashControls created as an overlay.

Parameters:
shouldIgnoreWhether or not transparent pixels should be ignored.
thresholdThe opacity threshold (in percent, 0 to 1.0), pixels with opacities less than this amount will be ignored.
void FlashControl::setLoop ( bool  shouldLoop )

Sets whether or not the currently-loaded movie should restart when it reaches the end.

Parameters:
shouldLoopWhether the currently-loaded movie should loop.

Definition at line 656 of file FlashControl.cpp.

void FlashControl::setOpacity ( float  opacity )

Sets the opacity of this FlashControl.

Parameters:
opacityThe opacity as a Real value; 0 is totally transparent, 1 is totally opaque.
void FlashControl::setQuality ( short  renderQuality )

Sets the Flash rendering quality for the currently-loaded movie.

Parameters:
renderQualityThe RenderQuality to use.

Definition at line 680 of file FlashControl.cpp.

void FlashControl::setScaleMode ( short  scaleMode )

Sets the scaling mode to use when the aspect ratio of the movie and control do not match.

Parameters:
scaleModeThe ScaleMode to use.

Definition at line 705 of file FlashControl.cpp.

void FlashControl::setTransparent ( bool  isTransparent,
bool  useAlphaHack = false 
)

Sets whether or not the currently-loaded movie should use a transparent background instead of the default background-color.

Parameters:
isTransparentWhether or not the movie should use "transparent" rendering.
useAlphaHackWith some Flash versions, there are certain glitches with transparent rendering (usually with text and aliased geometry). Set this parameter to 'true' to use an alternative alpha-rendering hack that may mitigate these issues at the cost of some performance.

Definition at line 661 of file FlashControl.cpp.

void FlashControl::setZOrder ( unsigned short  zorder ) [inline]

Definition at line 98 of file FlashControl.h.

void FlashControl::show (  )

If this FlashControl was created as an overlay, shows the overlay.

Definition at line 765 of file FlashControl.cpp.

void FlashControl::stop (  )

Stops the currently-loaded movie.

Definition at line 641 of file FlashControl.cpp.

void FlashControl::unbind ( const std::wstring &  funcName )

Un-binds the specified callback.

Parameters:
funcNameThe name that the callback was bound to.

Definition at line 740 of file FlashControl.cpp.

void FlashControl::update (  )

Definition at line 1116 of file FlashControl.cpp.

void FlashControl::updateTexture (  )

Definition at line 402 of file FlashControl.cpp.

void FlashControl::updateZOrder (  )

Update ZOrder

Definition at line 789 of file FlashControl.cpp.


Friends And Related Function Documentation

friend class Hikari::HikariManager [friend]

Definition at line 55 of file FlashControl.h.

friend class Hikari::Impl::FlashHandler [friend]

Definition at line 54 of file FlashControl.h.

friend class Hikari::Impl::FlashSite [friend]

Definition at line 53 of file FlashControl.h.


Member Data Documentation

Definition at line 87 of file FlashControl.h.

Definition at line 86 of file FlashControl.h.

Definition at line 88 of file FlashControl.h.

Reimplemented in SFlashControl.

Definition at line 69 of file FlashControl.h.

Definition at line 68 of file FlashControl.h.

Ogre::SceneBlendFactor FlashControl::dBlend

Definition at line 63 of file FlashControl.h.

Definition at line 82 of file FlashControl.h.

Definition at line 64 of file FlashControl.h.

Definition at line 66 of file FlashControl.h.

Definition at line 73 of file FlashControl.h.

Definition at line 78 of file FlashControl.h.

Definition at line 77 of file FlashControl.h.

Definition at line 71 of file FlashControl.h.

Definition at line 90 of file FlashControl.h.

Definition at line 85 of file FlashControl.h.

Definition at line 65 of file FlashControl.h.

Definition at line 60 of file FlashControl.h.

Definition at line 67 of file FlashControl.h.

Ogre::SceneBlendFactor FlashControl::sBlend

Definition at line 62 of file FlashControl.h.

Definition at line 70 of file FlashControl.h.

Definition at line 70 of file FlashControl.h.

Definition at line 70 of file FlashControl.h.

Definition at line 84 of file FlashControl.h.

Definition at line 72 of file FlashControl.h.

TextureUnitState* FlashControl::texUnit

Definition at line 89 of file FlashControl.h.

Definition at line 70 of file FlashControl.h.

Definition at line 74 of file FlashControl.h.

Definition at line 59 of file FlashControl.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines