Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __FlashControl_H__
00037 #define __FlashControl_H__
00038
00039 #include "Ogre.h"
00040 #include "IFlashControl.h"
00041 #include "OgreViewportOverlay.h"
00042 #include "../SCOLBasic/SO3Std.h"
00043
00050 class FlashControl : public Hikari::IFlashControl, public Ogre::ManualResourceLoader
00051 {
00053 friend class Hikari::Impl::FlashSite;
00054 friend class Hikari::Impl::FlashHandler;
00055 friend class Hikari::HikariManager;
00056 public:
00058
00059 bool usingAlphaHack;
00060 bool originalDepthWritting;
00061
00062 Ogre::SceneBlendFactor sBlend;
00063 Ogre::SceneBlendFactor dBlend;
00064 bool isFirstInside;
00065 bool onMaterial;
00066 bool isFirstOutside;
00067 OgreViewportOverlay* overlay;
00068 SViewPort * currentViewport;
00069 SScene* currentScene;
00070 size_t texWidth, texHeight, texDepth, texPitch;
00071 string materialName;
00072 string textureName;
00073 bool isIgnoringTransparent;
00074 float transThreshold;
00075
00076
00077 int lastDirtyWidth;
00078 int lastDirtyHeight;
00079
00080 typedef std::map<std::wstring, Hikari::FlashDelegate> DelegateMap;
00081 typedef DelegateMap::iterator DelegateIter;
00082 DelegateMap delegateMap;
00083
00084 TexturePtr texture;
00085 TexturePtr oldTex;
00086 int _tec;
00087 int _pass;
00088 int _unit;
00089 TextureUnitState* texUnit;
00090 bool movieLoaded;
00091
00093 FlashControl(const string& name, Viewport* viewport, int width, int height, const Hikari::Position& position, unsigned short zOrder);
00094 FlashControl(const string& name,SScene* scene,const string& _matName, int width, int height,int techID=0,int passID=0,int unitID = 0);
00095 ~FlashControl();
00096
00098 inline void setZOrder(unsigned short zorder){
00099 if(overlay)
00100 overlay->getOverlay()->setZOrder(zorder);
00101 };
00102 inline unsigned short getZOrder(){
00103 if(overlay)
00104 return overlay->getOverlay()->getZOrder();
00105 else return 0;
00106 };
00107 inline int getRelativeX(int absX){
00108 if(overlay)
00109 return overlay->getRelativeX(absX);
00110 else return -1;
00111 };
00112 inline int getRelativeY(int absY){
00113 if(overlay)
00114 return overlay->getRelativeY(absY);
00115 else return -1;
00116 };
00117 inline bool EnableMode(int mode)
00118 {
00119 if(mode > SO3_FLASH_MAX) return false;
00120
00121 scolFlags |= mode;
00122
00123 return true;
00124 }
00125
00126 inline bool DisableMode(int mode)
00127 {
00128 if(mode > SO3_FLASH_MAX) return false;
00129
00130 scolFlags &= (0xffffffff - mode);
00131
00132 return true;
00133 }
00134
00135
00136
00137
00139 void createControl();
00140 void createMaterial();
00141 bool isPointOverMe(int screenX, int screenY);
00142 void invalidateTotally();
00143 void handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam);
00144 void handleFlashCall(const std::wstring& xmlString);
00145 void update();
00154 void load(const string& movieFilename, Hikari::HikariManager* hikariMgr,int type);
00155
00159 void play();
00160
00164 void stop();
00165
00169 void rewind();
00170
00171
00172
00173
00177 void gotoFrame(long frameNum);
00178
00185 void setLoop(bool shouldLoop);
00186
00197 void setTransparent(bool isTransparent, bool useAlphaHack = false);
00198
00204 void setQuality(short renderQuality);
00205
00211 void setScaleMode(short scaleMode);
00212
00219 void setDraggable(bool isDraggable);
00220
00229 void setIgnoreTransparentPixels(bool shouldIgnore, float threshold = 0.04);
00230
00234 const string & getName() const;
00235
00239 const string & getMaterialName() const;
00240
00272 void bind(const std::wstring& funcName, const Hikari::FlashDelegate& callback);
00273
00279 void unbind(const std::wstring& funcName);
00280
00292 Hikari::FlashValue callFunction(const std::wstring& funcName, const Hikari::Arguments& args = Hikari::Args());
00293
00297 void hide();
00298
00302 void show();
00303
00308 bool getVisibility() const;
00309
00315 void setOpacity(float opacity);
00316
00320 void focus();
00321
00325 void updateZOrder();
00326
00333 void move(int deltaX, int deltaY);
00334
00342 void getExtents(unsigned short &width, unsigned short &height) const;
00343
00353 void getUVScale(float &uScale, float &vScale) const;
00354
00361 void injectMouseMove(int xPos, int yPos, int btn);
00362
00369 void injectMouseDown(int xPos, int yPos, int index);
00370
00377 void injectMouseUp(int xPos, int yPos, int index);
00378
00386 void injectMouseWheel(int relScroll, int xPos, int yPos);
00387
00388 void loadResource(Resource* resource);
00389
00390 void updateTexture();
00391
00392 void applyTexture(string matname, int techidx = 0, int passidx = 0, int unitidx = 0);
00393
00394 void restoreMaterial();
00395
00396 bool isLoaded();
00397 };
00398
00399 #endif