/// <summary>Initializes DirectX graphics</summary> /// <returns>true on success, false on failure</returns> public bool InitializeGraphics() { PresentParameters tPresentParas = new PresentParameters(); tPresentParas.SwapEffect = SwapEffect.Discard; tPresentParas.Windowed = true; try { _Device = new Device(0, DeviceType.Hardware, this.Handle, CreateFlags.SoftwareVertexProcessing, tPresentParas); //create main fui class _FNUIMain = new FNUIMain(); _FNUIMain.CreateUI(""); float tFramerate = 0; int tFrames = 0; _FNUIMain.LoadFlashHeader(_Path, ref _Width, ref _Height, ref tFramerate, ref tFrames); this.ClientSize = new Size(_Width, _Height); _Vertices = new CustomVertex.TransformedColoredTextured[4]; _Vertices[0] = new CustomVertex.TransformedColoredTextured(0, 0, 0, 1.0f, Color.White.ToArgb(), 0.0f, 0.0f); _Vertices[1] = new CustomVertex.TransformedColoredTextured(_Width - 1, 0, 0, 1.0f, Color.White.ToArgb(), 1.0f, 0.0f); _Vertices[2] = new CustomVertex.TransformedColoredTextured(_Width - 1, _Height - 1, 0, 1.0f, Color.White.ToArgb(), 1.0f, 1.0f); _Vertices[3] = new CustomVertex.TransformedColoredTextured(0, _Height - 1, 0, 1.0f, Color.White.ToArgb(), 0.0f, 1.0f); _Texture1 = new Texture(_Device, _Width, _Height, 1, 0, Format.A8R8G8B8, Pool.Managed); _Texture2 = new Texture(_Device, _Width, _Height, 1, 0, Format.A8R8G8B8, Pool.Managed); //create a new flash player instance _FNUIFlashPlayer = _FNUIMain.CreateFlashPlayer(); //set the callback delegates and the event notifier _FNUIFlashPlayer.SetDelegates(ResizeTexture, LockRectangle, UnlockRectangle, AddDirtyRectangle); _FNUIFlashPlayer.SetEventNotifier(EventNotifier); //create the flash control at resolution 512x512 and with tex1 and tex2 as textures, //eg. doublebuffering, for singlebuffering, just provide 1 texture _FNUIFlashPlayer.CreateFlashControl(0, _Width, _Height, (IntPtr)0, (IntPtr)1, false); //load a movie _FNUIFlashPlayer.LoadMovie(_Path); return(true); } catch (DirectXException) { return(false); } }
public DrawFlash(IPluginHost host) { host.CreateRenderStateInput(TSliceMode.Single, TPinVisibility.True, out FRenderStatePin); FRenderStatePin.Order = -2; host.CreateTransformInput("Transform", TSliceMode.Single, TPinVisibility.True, out FTransformIn); FTransformIn.Order = -1; host.CreateLayerOutput("Layer", TPinVisibility.True, out FLayerOutput); FLayerOutput.Order = -1; FLastKeyState = new List <int>(); _FNUIMain = new FNUIMain(); _FNUIMain.SetLicenseKey(0, LICENSENAME, LICENSENUMBER); _FNUIMain.CreateUI(""); }
/// <summary>Initializes DirectX graphics</summary> /// <returns>true on success, false on failure</returns> public bool InitializeGraphics() { PresentParameters pp = new PresentParameters(); pp.SwapEffect = SwapEffect.Discard; //pp.IsWindowed = true; pp.Windowed = true; try { m_device = new Device(0, DeviceType.Hardware, this.Handle, CreateFlags.SoftwareVertexProcessing, pp); verts = new CustomVertex.TransformedColoredTextured[4]; verts[0] = new CustomVertex.TransformedColoredTextured( 0, 0, 0, 1.0f, Color.White.ToArgb(), 0.0f, 0.0f); verts[1] = new CustomVertex.TransformedColoredTextured( 511, 0, 0, 1.0f, Color.White.ToArgb(), 1.0f, 0.0f); verts[2] = new CustomVertex.TransformedColoredTextured( 511, 511, 0, 1.0f, Color.White.ToArgb(), 1.0f, 1.0f); verts[3] = new CustomVertex.TransformedColoredTextured( 0, 511, 0, 1.0f, Color.White.ToArgb(), 0.0f, 1.0f); tex1 = new Texture(m_device, 512, 512, 1, 0, Format.A8R8G8B8, Pool.Managed); tex2 = new Texture(m_device, 512, 512, 1, 0, Format.A8R8G8B8, Pool.Managed); //create main fui class fmain = new FNUIMain(); fmain.CreateUI(""); //create a new flash player instance fplayer = fmain.CreateFlashPlayer(); //set the callback delegates and the event notifier fplayer.SetDelegates(ResizeTexture, GetTextureSurfacePointer, ReleaseTextureSurfacePointer, DirtyRect); fplayer.SetEventNotifier(EventNotifier); //create the flash control at resolution 512x512 and with tex1 and tex2 as textures, //eg. doublebuffering, for singlebuffering, just provide 1 texture fplayer.CreateFlashControl(0, 512, 512, (IntPtr)0, (IntPtr)1, true); //load a movie to test fplayer.LoadMovie(Application.StartupPath + "\\SiemensContent\\index.swf"); return(true); } catch (DirectXException) { return(false); } }