Beispiel #1
0
		public void Load(string filename)
		{
			if (filename == cachedVideo)
				return;
			var video = new VqaReader(GlobalFileSystem.Open(filename));

			cachedVideo = filename;
			Open(video);
		}
Beispiel #2
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();
            });
        }
Beispiel #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 calcuation.
			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);
		}
Beispiel #4
0
		public void Load(string filename)
		{
			if (filename == cachedVideo)
				return;

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

			cachedVideo = filename;
			video = new VqaReader(GlobalFileSystem.Open(filename));

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

			var size = Math.Max(video.Width, video.Height);
			var textureSize = Exts.NextPowerOf2(size);
			var videoSheet = new Sheet(new Size(textureSize, textureSize), false);
			videoSheet.Texture.SetData(video.FrameData);
			videoSprite = new Sprite(videoSheet, new Rectangle(0, 0, video.Width, video.Height), TextureChannel.Alpha);

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

			if (!DrawOverlay)
				return;

			overlay = new uint[2 * textureSize, 2 * textureSize];
			var black = (uint)255 << 24;
			for (var y = 0; y < video.Height; y++)
				for (var x = 0; x < video.Width; x++)
					overlay[2 * y, x] = black;

			var overlaySheet = new Sheet(new Size(2 * textureSize, 2 * textureSize), false);
			overlaySheet.Texture.SetData(overlay);
			overlaySprite = new Sprite(overlaySheet, new Rectangle(0, 0, video.Width, 2 * video.Height), TextureChannel.Alpha);
		}
Beispiel #5
0
 public void CloseVideo()
 {
     Stop();
     video = null;
 }
Beispiel #6
0
        public void Load(string filename)
        {
            if (filename == cachedVideo)
                return;

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

            cachedVideo = filename;
            video = new VqaReader(GlobalFileSystem.Open(filename));

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

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

            videoSheet.Texture.ScaleFilter = TextureScaleFilter.Linear;
            videoSheet.Texture.SetData(video.FrameData);
            videoSprite = new Sprite(videoSheet, new Rectangle(0, 0, video.Width, video.Height), TextureChannel.Alpha);

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

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

            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(new Size(1, Exts.NextPowerOf2(scaledHeight)), false);
            overlaySheet.Texture.SetData(overlay);
            overlaySprite = new Sprite(overlaySheet, new Rectangle(0, 0, 1, scaledHeight), TextureChannel.Alpha);
        }