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


C# Datatypes.Size类代码示例

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


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


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