Esempio n. 1
0
        public FLCPlayer(GraphicsDevice setDevice)
        {
            device = setDevice;

            file = null;
            flcFile = null;

            currentFrame = null;
        }
Esempio n. 2
0
 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));
    }
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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;
        }
Esempio n. 8
0
        public void Dispose()
        {
            Stop();

            if (currentFrame != null)
            {
                currentFrame.Dispose();
                currentFrame = null;
            }

            if (flcFile != null)
            {
                flcFile.Dispose();
                flcFile = null;
            }
        }
Esempio n. 9
0
        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);
            }
        }
Esempio n. 10
0
 void player_OnFrameUpdated(Texture2D texture, FLCFile file)
 {
    curTexture = texture;
 }
Esempio n. 11
0
 void player_OnFrameUpdated(Texture2D setTexture, FLCFile file)
 {
     texture = setTexture;
     counter++;
 }
Esempio n. 12
0
 void player_OnPlaybackFinished(FLCFile file, bool didFinishNormally)
 {
    if (didFinishNormally)
    {
       storyboard.NotifyMovieDidFinish();
    }
    else
    {
       if (introFinished != null)
          introFinished(true);
       else
          MainGame.WinWarGame.SetNextGameScreen(new MenuGameScreen(false));
    }
 }
Esempio n. 13
0
 void player_OnPlaybackFinished(FLCFile file)
 {
     Exit();
 }
Esempio n. 14
0
 void flcFile_OnPlaybackStarted(FLCFile file)
 {
     if (OnPlaybackStarted != null)
         OnPlaybackStarted(file);
 }
Esempio n. 15
0
 public FLCChunk(FLCFile setOwnerFile)
 {
     OwnerFile = setOwnerFile;
     SubChunks = new List<FLCChunk>();
 }
Esempio n. 16
0
        public FLCFrameBuffer(FLCFile setFile)
        {
            file = setFile;

            framebuffer = new FLCColor[setFile.Width * setFile.Height];
        }
Esempio n. 17
0
 static void file_OnPlaybackStarted(FLCFile file)
 {
     Console.WriteLine("Playback started");
 }
Esempio n. 18
0
 static void file_OnPlaybackFinished(FLCFile file, bool didFinishNormally)
 {
     Console.WriteLine("Playback finished; " + didFinishNormally);
 }
Esempio n. 19
0
 void flcFile_OnPlaybackFinished(FLCFile file)
 {
     if (OnPlaybackFinished != null)
         OnPlaybackFinished(file);
 }
Esempio n. 20
0
 void flcFile_OnPlaybackFinished(FLCFile file, bool didFinishNormally)
 {
     if (OnPlaybackFinished != null)
     OnPlaybackFinished (file, didFinishNormally);
 }
Esempio n. 21
0
 public FLCChunkColor256(FLCFile setOwnerFile)
     : base(setOwnerFile)
 {
     Colors = new FLCColor[256];
 }
Esempio n. 22
0
 void player_OnFrameUpdated(Texture2D texture, FLCLib.FLCFile file)
 {
     curTexture = texture;
 }