当前位置: 首页>>代码示例>>C#>>正文


C# Sheet.GetTexture方法代码示例

本文整理汇总了C#中OpenRA.Graphics.Sheet.GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Sheet.GetTexture方法的具体用法?C# Sheet.GetTexture怎么用?C# Sheet.GetTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenRA.Graphics.Sheet的用法示例。


在下文中一共展示了Sheet.GetTexture方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawVertexBuffer

 public void DrawVertexBuffer(IVertexBuffer<Vertex> buffer, int start, int length, PrimitiveType type, Sheet sheet, BlendMode blendMode)
 {
     shader.SetTexture("DiffuseTexture", sheet.GetTexture());
     renderer.Device.SetBlendMode(blendMode);
     shader.Render(() => renderer.DrawBatch(buffer, start, length, type));
     renderer.Device.SetBlendMode(BlendMode.None);
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:SpriteRenderer.cs

示例2: Open

		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);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:47,代码来源:VqaPlayerWidget.cs

示例3: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			// Bitmap data is generated in a background thread and then flipped
			front = new byte[4 * 256 * 256];
			back = new byte[4 * 256 * 256];

			var rect = new Rectangle((int)(255 * SRange[0]), (int)(255 * (1 - VRange[1])), (int)(255 * (SRange[1] - SRange[0])) + 1, (int)(255 * (VRange[1] - VRange[0])) + 1);
			var mixerSheet = new Sheet(new Size(256, 256));
			mixerSheet.GetTexture().SetData(front, 256, 256);
			mixerSprite = new Sprite(mixerSheet, rect, TextureChannel.Alpha);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:13,代码来源:ColorMixerWidget.cs

示例4: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			sRange[0] += STrim;
			sRange[1] -= STrim;
			vRange[0] += VTrim;
			vRange[1] -= VTrim;

			// Bitmap data is generated in a background thread and then flipped
			front = new byte[4 * 256 * 256];
			back = new byte[4 * 256 * 256];

			var rect = new Rectangle((int)(255 * sRange[0]), (int)(255 * (1 - vRange[1])), (int)(255 * (sRange[1] - sRange[0])) + 1, (int)(255 * (vRange[1] - vRange[0])) + 1);
			var mixerSheet = new Sheet(SheetType.BGRA, new Size(256, 256));
			mixerSheet.GetTexture().SetData(front, 256, 256);
			mixerSprite = new Sprite(mixerSheet, rect, TextureChannel.Alpha);
			GenerateBitmap();
		}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:19,代码来源:ColorMixerWidget.cs

示例5: Initialize

        public override void Initialize(WidgetArgs args)
        {
            base.Initialize(args);

            using (var hueBitmap = new Bitmap(256, 256))
            {
                var hueSheet = new Sheet(new Size(256, 256));
                hueSprite = new Sprite(hueSheet, new Rectangle(0, 0, 256, 1), TextureChannel.Alpha);

                var bitmapData = hueBitmap.LockBits(hueBitmap.Bounds(),
                    ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                unsafe
                {
                    var c = (int*)bitmapData.Scan0;
                    for (var h = 0; h < 256; h++)
                        *(c + h) = HSLColor.FromHSV(h / 255f, 1, 1).RGB.ToArgb();
                }

                hueBitmap.UnlockBits(bitmapData);
                hueSheet.GetTexture().SetData(hueBitmap);
            }
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:22,代码来源:HueSliderWidget.cs


注:本文中的OpenRA.Graphics.Sheet.GetTexture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。