public FLCPlayer(GraphicsDevice setDevice) { device = setDevice; file = null; flcFile = null; currentFrame = null; }
void player_OnPlaybackFinished(FLCFile file, bool didFinishNormally) { if (OnMovieFinished != null) { OnMovieFinished(!didFinishNormally); } else { // Don't know what to do, so just return to the main menu MainGame.WinWarGame.SetNextGameScreen(new MenuGameScreen(false)); } }
public static FLCChunk CreateFromStream(BinaryReader reader, FLCFile file) { uint size = reader.ReadUInt32(); ChunkType type = (ChunkType)reader.ReadUInt16(); FLCChunk result = null; switch (type) { case ChunkType.FRAME_TYPE: result = new FLCChunkFrameType(file); break; case ChunkType.COLOR_256: result = new FLCChunkColor256(file); break; case ChunkType.BYTE_RUN: result = new FLCChunkByteRun(file); break; case ChunkType.FLI_COPY: result = new FLCChunkFLICopy(file); break; case ChunkType.DELTA_FLC: result = new FLCChunkDeltaFLC(file); break; case ChunkType.DELTA_FLI: result = new FLCChunkDeltaFLI(file); break; default: result = new FLCChunkUnknown(file); reader.BaseStream.Seek(size - 6, SeekOrigin.Current); break; } if (result != null) { result.Size = size; result.Type = type; result.ReadFromStream(reader); } return result; }
static void Main(string[] args) { counter = 0; file = new FLCFile(File.OpenRead("Test.flc")); file.OnFrameUpdated += file_OnFrameUpdated; file.OnPlaybackFinished += file_OnPlaybackFinished; file.OnPlaybackStarted += file_OnPlaybackStarted; file.ShouldLoop = false; file.Open(); file.Play(); while (file.IsPlaying) { Thread.Sleep(1); } }
public async Task<bool> Open(StorageFile setFile) { file = setFile; var str = await file.OpenReadAsync(); if (flcFile != null) { flcFile.OnFrameUpdated -= flcFile_OnFrameUpdated; flcFile.OnPlaybackStarted -= flcFile_OnPlaybackStarted; flcFile.OnPlaybackFinished -= flcFile_OnPlaybackFinished; flcFile.Dispose(); flcFile = null; } flcFile = new FLCFile(str.AsStreamForRead()); flcFile.OnFrameUpdated += flcFile_OnFrameUpdated; flcFile.OnPlaybackStarted += flcFile_OnPlaybackStarted; flcFile.OnPlaybackFinished += flcFile_OnPlaybackFinished; flcFile.Open(); return true; }
static unsafe void file_OnFrameUpdated(FLCFile file) { FLCColor[] colors = file.GetFramebufferCopy(); Bitmap bm = new Bitmap(file.Width, file.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); BitmapData bd = bm.LockBits(new Rectangle(0, 0, file.Width, file.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); byte* ptr = (byte*)bd.Scan0.ToPointer(); for (int y = 0; y < file.Height; y++) { for (int x = 0; x < file.Width; x++) { FLCColor col = colors[x + (y * file.Width)]; *ptr++ = col.B; *ptr++ = col.G; *ptr++ = col.R; *ptr++ = col.A; } } bm.UnlockBits(bd); bm.Save("Images/image" + counter++ + ".jpg", ImageFormat.Jpeg); }
public bool Open(Stream setFile) { file = setFile; if (flcFile != null) { flcFile.OnFrameUpdated -= flcFile_OnFrameUpdated; flcFile.OnPlaybackStarted -= flcFile_OnPlaybackStarted; flcFile.OnPlaybackFinished -= flcFile_OnPlaybackFinished; flcFile.Dispose (); flcFile = null; } flcFile = new FLCFile (file); flcFile.OnFrameUpdated += flcFile_OnFrameUpdated; flcFile.OnPlaybackStarted += flcFile_OnPlaybackStarted; flcFile.OnPlaybackFinished += flcFile_OnPlaybackFinished; flcFile.Open (); return true; }
public void Dispose() { Stop(); if (currentFrame != null) { currentFrame.Dispose(); currentFrame = null; } if (flcFile != null) { flcFile.Dispose(); flcFile = null; } }
void flcFile_OnFrameUpdated(FLCFile file) { FLCColor[] colors = flcFile.GetFramebufferCopy(); if (currentFrame == null) currentFrame = new Texture2D(device, flcFile.Width, flcFile.Height, false, SurfaceFormat.Color); Color[] colorData = new Color[currentFrame.Width * currentFrame.Height]; for (int i = 0; i < colors.Length; i++) { colorData[i] = new Color(colors[i].R, colors[i].G, colors[i].B, colors[i].A); } lock (currentFrame) { currentFrame.SetData<Color>(colorData); if (OnFrameUpdated != null) OnFrameUpdated(currentFrame, file); } }
void player_OnFrameUpdated(Texture2D texture, FLCFile file) { curTexture = texture; }
void player_OnFrameUpdated(Texture2D setTexture, FLCFile file) { texture = setTexture; counter++; }
void player_OnPlaybackFinished(FLCFile file, bool didFinishNormally) { if (didFinishNormally) { storyboard.NotifyMovieDidFinish(); } else { if (introFinished != null) introFinished(true); else MainGame.WinWarGame.SetNextGameScreen(new MenuGameScreen(false)); } }
void player_OnPlaybackFinished(FLCFile file) { Exit(); }
void flcFile_OnPlaybackStarted(FLCFile file) { if (OnPlaybackStarted != null) OnPlaybackStarted(file); }
public FLCChunk(FLCFile setOwnerFile) { OwnerFile = setOwnerFile; SubChunks = new List<FLCChunk>(); }
public FLCFrameBuffer(FLCFile setFile) { file = setFile; framebuffer = new FLCColor[setFile.Width * setFile.Height]; }
static void file_OnPlaybackStarted(FLCFile file) { Console.WriteLine("Playback started"); }
static void file_OnPlaybackFinished(FLCFile file, bool didFinishNormally) { Console.WriteLine("Playback finished; " + didFinishNormally); }
void flcFile_OnPlaybackFinished(FLCFile file) { if (OnPlaybackFinished != null) OnPlaybackFinished(file); }
void flcFile_OnPlaybackFinished(FLCFile file, bool didFinishNormally) { if (OnPlaybackFinished != null) OnPlaybackFinished (file, didFinishNormally); }
public FLCChunkColor256(FLCFile setOwnerFile) : base(setOwnerFile) { Colors = new FLCColor[256]; }
void player_OnFrameUpdated(Texture2D texture, FLCLib.FLCFile file) { curTexture = texture; }