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

            file = null;
            flcFile = null;

            currentFrame = null;
        }
Exemplo 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));
    }
 }
Exemplo 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;
        }
Exemplo 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);
            }
        }
Exemplo 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;
        }
Exemplo 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);
        }
Exemplo 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;
        }
Exemplo n.º 8
0
        public void Dispose()
        {
            Stop();

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

            if (flcFile != null)
            {
                flcFile.Dispose();
                flcFile = null;
            }
        }
Exemplo 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);
            }
        }
Exemplo n.º 10
0
 void player_OnFrameUpdated(Texture2D texture, FLCFile file)
 {
    curTexture = texture;
 }
Exemplo n.º 11
0
 void player_OnFrameUpdated(Texture2D setTexture, FLCFile file)
 {
     texture = setTexture;
     counter++;
 }
Exemplo 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));
    }
 }
Exemplo n.º 13
0
 void player_OnPlaybackFinished(FLCFile file)
 {
     Exit();
 }
Exemplo n.º 14
0
 void flcFile_OnPlaybackStarted(FLCFile file)
 {
     if (OnPlaybackStarted != null)
         OnPlaybackStarted(file);
 }
Exemplo n.º 15
0
 public FLCChunk(FLCFile setOwnerFile)
 {
     OwnerFile = setOwnerFile;
     SubChunks = new List<FLCChunk>();
 }
Exemplo n.º 16
0
        public FLCFrameBuffer(FLCFile setFile)
        {
            file = setFile;

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