public Movie(SFManager sfmgr, SFMovieCreationParams creationParams) { if (sfmgr == null) { MovieID = 0; return; } MovieName = creationParams.MovieName; ViewPort.OX = creationParams.OX; ViewPort.OY = creationParams.OY; ViewPort.Width = creationParams.Width; ViewPort.Height = creationParams.Height; pDataUnmanaged = creationParams.pData; MovieID = 0; // Assigned when the C++ Movie is created. MarkForRelease = false; SFMgr = sfmgr; IsFocused = false; AdvanceWhenGamePaused = false; IsAutoManageViewport = creationParams.IsAutoManageViewport; TheScaleModeType = creationParams.TheScaleModeType; int cpSize = Marshal.SizeOf(typeof(SFMovieCreationParams)); IntPtr pdata = Marshal.AllocCoTaskMem(cpSize); Marshal.StructureToPtr(creationParams, pdata, false); MovieID = SF_CreateMovie(pdata); Marshal.DestroyStructure(pdata, typeof(SFMovieCreationParams)); if (MovieID != -1) { SFMgr.AddMovie(this); } }
/// <summary> /// Movie constructor, moviedef is created automatically. /// </summary> /// <param name="sfmgr">Scaleform manager.</param> /// <param name="creationParams">Movie creation parameters.</param> public Movie(SFManager sfmgr, SFMovieCreationParams creationParams) { if(sfmgr == null) { MovieID = 0; return; } //1. Set parameters like name and viewport MovieName = creationParams.MovieName; ViewPort.OX = creationParams.OX; ViewPort.OY = creationParams.OY; ViewPort.Width = creationParams.Width; ViewPort.Height = creationParams.Height; pDataUnmanaged = creationParams.pData; Depth = creationParams.Depth; // Rendering order. Movie with Depth + 1 will render on top of Movie with Depth MovieID = 0; // Assigned when the C++ Movie is created. MarkForRelease = false; SFMgr = sfmgr; IsFocused = false; AdvanceWhenGamePaused = false; IsAutoManageViewport = creationParams.IsAutoManageViewport; TheScaleModeType = creationParams.TheScaleModeType; int cpSize = Marshal.SizeOf(typeof(SFMovieCreationParams)); IntPtr pCreationParams = Marshal.AllocCoTaskMem(cpSize); Marshal.StructureToPtr(creationParams, pCreationParams, false); MovieID = SF_CreateMovie(pCreationParams); if(MovieID == 0) { return; } //3. Add into SFManager SFMgr.AddMovie(this); }