• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Datatypes.Size类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DeltaEngine.Datatypes.Size的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Size类属于DeltaEngine.Datatypes命名空间,在下文中一共展示了Size类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetupWindowSizeProperties

 private static void SetupWindowSizeProperties(Mock<Window> windowMock)
 {
     Window window = windowMock.Object;
     var currentSize = new Size(1024, 640);
     windowMock.SetupGet(w => w.TotalPixelSize).Returns(() => currentSize);
     #pragma warning disable 0618
     windowMock.SetupSet(w => w.TotalPixelSize).Callback(s =>
     {
         currentSize = s;
         windowMock.Raise(w => w.ViewportSizeChanged += null, s);
     });
     windowMock.SetupGet(w => w.ViewportPixelSize).Returns(() => currentSize);
     bool isFullscreen = false;
     var rememberSizeBeforeFullscreen = new Size();
     windowMock.Setup(w => w.SetFullscreen(It.IsAny<Size>())).Callback((Size displaySize) =>
     {
         isFullscreen = true;
         rememberSizeBeforeFullscreen = window.TotalPixelSize;
         window.TotalPixelSize = displaySize;
     });
     windowMock.Setup(w => w.SetWindowed()).Callback(() =>
     {
         isFullscreen = false;
         window.TotalPixelSize = rememberSizeBeforeFullscreen;
     });
     windowMock.SetupGet(w => w.IsFullscreen).Returns(() => isFullscreen);
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:27,代码来源:TestRenderingResolver.cs


示例2: MovingSprite

		public MovingSprite(string image, Color color, Vector2D position, Size size)
			: base(image, Rectangle.One)
		{
			Size = size;
			Center = position;
			ID += 1;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:MovingSprite.cs


示例3: CreateFontTexts

 private static void CreateFontTexts(Vector2D[] centers, Size size)
 {
     new FontText(Font.Default, "Up", Rectangle.FromCenter(centers[0], size));
     new FontText(Font.Default, "Down", Rectangle.FromCenter(centers[1], size));
     new FontText(Font.Default, "Left", Rectangle.FromCenter(centers[2], size));
     new FontText(Font.Default, "Right", Rectangle.FromCenter(centers[3], size));
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:7,代码来源:KeyTriggerTests.cs


示例4: GetScoreWindowDrawArea

 private static Rectangle GetScoreWindowDrawArea(Size size)
 {
     var left = Brick.OffsetPortrait.X + GridRenderLeftOffset;
     var top = Brick.OffsetPortrait.Y - Brick.ZoomPortrait + ScoreRenderTopOffset;
     var height = Width / size.AspectRatio;
     return new Rectangle(left, top, Width, height);
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:7,代码来源:UserInterfacePortrait.cs


示例5: AutoArrangingMenu

		public AutoArrangingMenu(Size buttonSize, int renderLayer = 0)
			: base("<GeneratedScene>")
		{
			this.buttonSize = buttonSize;
			center = Vector2D.Half;
			this.renderLayer = renderLayer;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:AutoArrangingMenu.cs


示例6: ResetDeviceToNewViewportSize

 private void ResetDeviceToNewViewportSize(Size newSizeInPixel)
 {
     Screen = new ScreenSpace(newSizeInPixel);
     NativeDevice.PresentationParameters.BackBufferWidth = (int)newSizeInPixel.Width;
     NativeDevice.PresentationParameters.BackBufferHeight = (int)newSizeInPixel.Height;
     NativeDevice.Reset(NativeDevice.PresentationParameters);
 }
开发者ID:lilinghui,项目名称:DeltaEngine,代码行数:7,代码来源:XnaDevice.cs


示例7: SetDataColored

		private static Vertex[] SetDataColored(Size size, ShaderWithFormat shader, Material material)
		{
			if ((shader.Flags & ShaderFlags.Textured) != 0)
				return CreateVerticesColoredTextured(size, material.DefaultColor);
			return CreateVerticesColored(size, material.DefaultColor);

		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:PlaneQuad.cs


示例8: Create

		public Logo Create()
		{
			Randomizer random = Randomizer.Current;
			Size size = new Size(random.Get(0.02f, 0.08f));
			var halfWidth = size.Width / 2f;
			var doubleWidth = size.Width * 2f;
			Rectangle view = screen.Viewport;
			Vector2D position = new Vector2D(random.Get(doubleWidth, view.Width - doubleWidth), view.Bottom - size.Height / 2);
			float direction = position.X > 0.5f ? -1 : 1;
			if (random.Get(1, 100) >= 30) direction *= -1;
			float r = direction > 0
				? random.Get(0, view.Width - position.X - doubleWidth)
				: random.Get(0, position.X - doubleWidth);
			var h = random.Get(0.3f, view.Height - 0.05f);
			var angle = Math.Atan((4 * h) / r);
			if (angle == 0)
				angle = 1.57079f;
			var v0 = Math.Sqrt(r * MovingSprite.Gravity / Math.Sin(2 * angle));
			var v_x = (float)(v0 * Math.Cos(angle));
			var v_y = (float)(v0 * Math.Sin(angle));
			v_x *= direction;
			var data = new SimplePhysics.Data()
			{
				Gravity = new Vector2D(0f, MovingSprite.Gravity),
				Velocity = new Vector2D(v_x, -v_y),
				RotationSpeed = random.Get(10, 50) * direction
			};
			return new Logo("DeltaEngineLogo", Color.GetRandomBrightColor(), position, size, data);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:29,代码来源:LogoFactory.cs


示例9: OnFullscreenChanged

		protected override void OnFullscreenChanged(Size displaySize, bool isFullScreenEnabled)
		{
			deviceManager.PreferredBackBufferWidth = (int)displaySize.Width;
			deviceManager.PreferredBackBufferHeight = (int)displaySize.Height;
			deviceManager.IsFullScreen = isFullScreenEnabled;
			base.OnFullscreenChanged(displaySize, isFullScreenEnabled);
		}
开发者ID:caihuanqing0617,项目名称:DeltaEngine.Xna,代码行数:7,代码来源:XnaDevice.cs


示例10: MapInfo

		public static LevelTileType[] MapInfo(Size gridSize)
		{
			size = gridSize;
			var mapData = new LevelTileType[(int)(BathRoomLevelInfo.size.Width * BathRoomLevelInfo.size.Height)];
			for (int i = 0; i < mapData.Length; i++)
				mapData[i] = LevelTileType.Nothing;

			//walls and emoty grid spaces
			SetMapValuesToBlocked(mapData, 0, 0, 0, 23);
			SetMapValuesToBlocked(mapData, 12, 13, 0, 23);
			SetMapValuesToBlocked(mapData, 1, 1, 17, 23);
			SetMapValuesToBlocked(mapData, 11, 11, 0, 6);

			SetTile(mapData, 9, 0, LevelTileType.Blocked);
			SetTile(mapData, 10, 0, LevelTileType.Blocked);
			SetTile(mapData, 11, 0, LevelTileType.Blocked);
			SetTile(mapData, 11, 12, LevelTileType.Blocked);

			//towel shelf
			SetTile(mapData, 6, 8, LevelTileType.Blocked);
			SetTile(mapData, 7, 8, LevelTileType.Blocked);
			SetTile(mapData, 8, 8, LevelTileType.Blocked);
			SetTile(mapData, 6, 9, LevelTileType.Blocked);
			SetTile(mapData, 7, 9, LevelTileType.Blocked);
			SetTile(mapData, 8, 9, LevelTileType.Blocked);

			//plant
			SetTile(mapData, 2, 23, LevelTileType.Blocked);

			//toilet
			SetTile(mapData, 1, 14, LevelTileType.Blocked);

			//towels
			SetTile(mapData, 3, 4, LevelTileType.Blocked);
			SetTile(mapData, 4, 5, LevelTileType.Blocked);

			SetTile(mapData, 5, 15, LevelTileType.Blocked);
			SetTile(mapData, 7, 16, LevelTileType.Blocked);
			SetTile(mapData, 9, 14, LevelTileType.Blocked);

			//stools
			SetTile(mapData, 4, 20, LevelTileType.Blocked);
			SetTile(mapData, 2, 10, LevelTileType.Blocked);

			//toilet paper
			SetTile(mapData, 5, 14, LevelTileType.Blocked);

			//spawn points
			SetTile(mapData, 2, 1, LevelTileType.SpawnPoint);

			//Exit Points
			SetTile(mapData, 7, 23, LevelTileType.ExitPoint);

			//Tower Placeable Points
			SetTile(mapData, 3, 7, LevelTileType.Yellow); //impact tower
			SetTile(mapData, 6, 13, LevelTileType.Red); //fire tower
			SetTile(mapData, 8, 20, LevelTileType.Blue); //water tower
			return mapData;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:59,代码来源:BathRoomLevelInfo.cs


示例11: CreateFromFloat

		public void CreateFromFloat()
		{
			const float Width = 3.51f;
			const float Height = 0.23f;
			var s = new Size(Width, Height);
			Assert.AreEqual(s.Width, Width);
			Assert.AreEqual(s.Height, Height);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:SizeTests.cs


示例12: GetScoreWindowDrawArea

		private static Rectangle GetScoreWindowDrawArea(Size size)
		{
			var left = Brick.OffsetLandscape.X + GridRenderLeftOffset;
			var top = Brick.OffsetLandscape.Y - Brick.ZoomLandscape + ScoreRenderTopOffset;
			const float Width = Grid.Width * Brick.ZoomLandscape + GridRenderWidthOffset;
			var height = Width / size.AspectRatio;
			return new Rectangle(left, top, Width, height);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:UserInterfaceLandscape.cs


示例13: ScreenSpace

 protected ScreenSpace(Window window)
 {
     this.window = window;
     viewportPixelSize = window.ViewportPixelSize;
     window.ViewportSizeChanged += Update;
     window.OrientationChanged += UpdateOrientationChanged;
     current = this;
 }
开发者ID:remy22,项目名称:DeltaEngine,代码行数:8,代码来源:ScreenSpace.cs


示例14: ShowManyRabbits

		public void ShowManyRabbits()
		{
			var viewport = Resolve<ScreenSpace>().Viewport;
			var size = new Size(0.1f);
			for (float x = viewport.Left + size.Width / 2; x <= viewport.Right; x += size.Width)
				for (float y = viewport.Top + size.Height / 2; y <= viewport.Bottom; y += size.Height)
					CreateRabbitWith50Health(new Vector2D(x, y));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:RabbitTests.cs


示例15: Grid3D

		public Grid3D(Vector3D center, Size dimension, float gridScale = 1.0f)
			: base(center)
		{
			this.dimension = dimension;
			this.gridScale = gridScale;
			lines = new List<Line3D>();
			DrawGrid();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:Grid3D.cs


示例16: CreateOrthoProjectionMatrix

		public static Matrix CreateOrthoProjectionMatrix(Size viewportSize)
		{
			return new Matrix(
				2.0f / viewportSize.Width, 0.0f, 0.0f, 0.0f,
				0.0f, 2.0f / -viewportSize.Height, 0.0f, 0.0f,
				0.0f, 0.0f, -1.0f, 0.0f,
				-1.0f, 1.0f, 0.0f, 1.0f);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:LinearMapExtensions.cs


示例17: SetViewport

		public override void SetViewport(Size newSizeInPixel)
		{
			NativeDevice.PresentationParameters.BackBufferWidth = (int)newSizeInPixel.Width;
			NativeDevice.PresentationParameters.BackBufferHeight = (int)newSizeInPixel.Height;
			NativeDevice.Reset(NativeDevice.PresentationParameters);
			NativeDevice.Clear(new Color(0, 0, 0));
			SetModelViewProjectionMatrixFor2D();
		}
开发者ID:caihuanqing0617,项目名称:DeltaEngine.Xna,代码行数:8,代码来源:XnaDevice.cs


示例18: Billboard

		public Billboard(Vector3D position, Size size, Material material,
			BillboardMode billboardMode = BillboardMode.CameraFacing)
			: base(position)
		{
			mode = billboardMode;
			planeQuad = new PlaneQuad(size, material);
			OnDraw<BillboardRenderer>();
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:Billboard.cs


示例19: CalculateArrowDrawArea

		private static Rectangle CalculateArrowDrawArea(Material material, Vector2D start, Vector2D target)
		{
			start += Vector2D.Normalize(start.DirectionTo(target)) * 0.033f;
			target -= Vector2D.Normalize(start.DirectionTo(target)) * 0.033f;
			var distance = start.DistanceTo(target);
			var size = new Size(distance, distance / material.DiffuseMap.PixelSize.AspectRatio);
			return Rectangle.FromCenter((start + target) / 2, size * GameLogic.ArrowSize);
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:Effects.cs


示例20: NearlyEquals

		public void NearlyEquals()
		{
			var s1 = new Size(1, 2);
			Assert.IsTrue(s1.IsNearlyEqual(new Size(0.99999f, 2.00001f)));
			Assert.IsTrue(s1.IsNearlyEqual(new Size(1, 2.00001f)));
			Assert.IsFalse(s1.IsNearlyEqual(new Size(0.9f, 2.00001f)));
			Assert.IsFalse(s1.IsNearlyEqual(new Size(1, 2.1f)));
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:8,代码来源:SizeTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Network.NetState类代码示例发布时间:2022-05-24
下一篇:
C# Datatypes.Rectangle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap