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


C# RenderTexture.draw方法代码示例

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


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

示例1: Game

		public Game()
		{

			// http://forum.starling-framework.org/topic/framerate-drops-a-lot
			// http://forum.starling-framework.org/topic/30-fps-in-chrome-but-60-fps-in-internet-explorer-huh
			// http://forum.starling-framework.org/topic/frame-rate-oddities
			// http://forums.tigsource.com/index.php?topic=23953.0
			// IE 59
			// FF 56
			// Chrome, 62? after a restart of chrome!

			var info = new TextField(100, 400, "Welcome to StarlingRenderTextureExperiment!");
			addChild(info);

			var maxframe = new Stopwatch();
			var maxframe_elapsed = 0.0;


			var xinfo = new TextField(400, 300, "Welcome to StarlingRenderTextureExperiment!");
			var xsw = new Stopwatch();
			xsw.Start();

			var content_rot = new Sprite();

			var texture0 = Texture.fromBitmap(new ActionScript.Images.jsc());

			////var cc = 128; // 10 FPS
			//var cc = 64; // 33 FPS, 44 FPS
			var cc = 128; //59

			var bytes = 0;

			var texsize = 512;

			#region new_tile

			Func<Image> new_tile = delegate
			{

				//var rtex = new RenderTexture(2048, 2048, true, 1);
				var rtex = new RenderTexture(texsize, texsize, true, 1);
				var rimg = new Image(rtex);


				var img0 = new Image(texture0);

				img0.scaleX = 0.3;
				img0.scaleY = 0.3;

				Action updatetexture = delegate
				{
					rtex.drawBundled(
						new Action(
							delegate
							{
								for (int iy = 0; iy <= cc; iy++)
									for (int ix = 0; ix <= cc; ix++)
									{


										img0.x = ix * 64 * img0.scaleX;
										img0.y = iy * 64 * img0.scaleY;

										if (img0.x < rtex.width)
											if (img0.y < rtex.height)
												rtex.draw(img0);
									}
							}
						).ToFunction()
					);

				};

				updatetexture();

				ApplicationSprite.__stage.stage3Ds[0].context3DCreate +=
					delegate
					{
						rtex = new RenderTexture(texsize, texsize, true, 1);

						updatetexture();

						rimg.texture = rtex;
					};

				bytes += texsize * texsize * 6;

				return rimg;
			};
			#endregion


			var memory_for_text = new RenderTexture(1024, 1024, true, 1);

			//        Error: Error #3691: Resource limit for this resource type exceeded.
			//at flash.display3D::Context3D/createTexture()

			var count = 0;

			for (int iy = -1; iy <= 4; iy++)
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationSprite.cs


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