Esempio n. 1
0
        public static void PlayFMVInRadar(World w, VqaReader movie, Action onComplete)
        {
            var player = Ui.Root.Get<VqaPlayerWidget>("PLAYER");
            player.Open(movie);

            player.PlayThen(() =>
            {
                onComplete();
                player.CloseVideo();
            });
        }
Esempio n. 2
0
 public void CloseVideo()
 {
     Stop();
     video = null;
 }
Esempio n. 3
0
        public void Open(VqaReader video)
        {
            this.video = video;

            stopped = true;
            paused = true;
            Game.Sound.StopVideo();
            onComplete = () => { };

            invLength = video.Framerate * 1f / video.Frames;

            var size = Math.Max(video.Width, video.Height);
            var textureSize = Exts.NextPowerOf2(size);
            var videoSheet = new Sheet(SheetType.BGRA, new Size(textureSize, textureSize));

            videoSheet.GetTexture().ScaleFilter = TextureScaleFilter.Linear;
            videoSheet.GetTexture().SetData(video.FrameData);

            videoSprite = new Sprite(videoSheet,
                new Rectangle(
                    0,
                    0,
                    video.Width,
                    video.Height),
                TextureChannel.Alpha);

            var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
            videoOrigin = new float2(
                RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2,
                RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);

            // Round size to integer pixels. Round up to be consistent with the scale calculation.
            videoSize = new float2((int)Math.Ceiling(video.Width * scale), (int)Math.Ceiling(video.Height * AspectRatio * scale));

            if (!DrawOverlay)
                return;

            var scaledHeight = (int)videoSize.Y;
            overlay = new uint[Exts.NextPowerOf2(scaledHeight), 1];
            var black = (uint)255 << 24;
            for (var y = 0; y < scaledHeight; y += 2)
                overlay[y, 0] = black;

            var overlaySheet = new Sheet(SheetType.BGRA, new Size(1, Exts.NextPowerOf2(scaledHeight)));
            overlaySheet.GetTexture().SetData(overlay);
            overlaySprite = new Sprite(overlaySheet, new Rectangle(0, 0, 1, scaledHeight), TextureChannel.Alpha);
        }
Esempio n. 4
0
        public void Load(string filename)
        {
            if (filename == cachedVideo)
                return;
            var video = new VqaReader(Game.ModData.DefaultFileSystem.Open(filename));

            cachedVideo = filename;
            Open(video);
        }