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


C# Rectangle.ContainsPoint方法代码示例

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


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

示例1: Update

		public override void Update(GameTime gt)
		{
			if ((Dialogs.Count > 0 && Dialogs.Peek() != this) || !Visible || !Game.IsActive)
				return;

			rotClickArea = new Rectangle(235 + DrawAreaWithOffset.X, 58 + DrawAreaWithOffset.Y, 99, 123);

			if (((Mouse.GetState().LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed) ||
				(Mouse.GetState().RightButton == ButtonState.Released && PreviousMouseState.RightButton == ButtonState.Pressed)) &&
				rotClickArea.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y))
			{
				charRender.Facing++;
			}

			base.Update(gt);
		}
开发者ID:weedindeed,项目名称:EndlessClient,代码行数:16,代码来源:CreateCharacterDialog.cs

示例2: _getMouseOverActual

		private bool _getMouseOverActual()
		{
			var skinDrawLoc = _getSkinDrawLoc();
			var actualDrawAreaRect = new Rectangle((int)skinDrawLoc.X, (int)skinDrawLoc.Y, m_skinSourceRect.Width,
				m_skinSourceRect.Height);
			bool mouseOverActual = actualDrawAreaRect.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y);
			return mouseOverActual;
		}
开发者ID:weedindeed,项目名称:EndlessClient,代码行数:8,代码来源:CharacterRenderer.cs

示例3: Update

		public override void Update(GameTime gameTime)
		{
			if (!Visible || !EOGame.Instance.IsActive)
				return;

			MouseState mouseState = Mouse.GetState();
			//this is our own button press handler
			if (MouseOver && mouseState.LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed)
			{
				if (!Selected)
				{
					((EOChatRenderer)parent).SetSelectedTab(WhichTab);
				}

				//logic for handling the close button (not actually a button, was I high when I made this...?)
				if ((WhichTab == ChatTabs.Private1 || WhichTab == ChatTabs.Private2) && closeRect != null)
				{
					Rectangle withOffset = new Rectangle(DrawAreaWithOffset.X + closeRect.Value.X, DrawAreaWithOffset.Y + closeRect.Value.Y, closeRect.Value.Width, closeRect.Value.Height);
					if (withOffset.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y))
					{
						ClosePrivateChat();
					}
				}
			}
			else if (Selected && mouseState.RightButton == ButtonState.Released && PreviousMouseState.RightButton == ButtonState.Pressed && WhichTab != ChatTabs.None)
			{
				XNAControl tmpParent = parent.GetParent(); //get the panel containing this tab, the parent is the chatRenderer
				if (tmpParent.DrawAreaWithOffset.Contains(mouseState.X, mouseState.Y))
				{
					int adjustedY = mouseState.Y - tmpParent.DrawAreaWithOffset.Y;
					int level = (int)Math.Round(adjustedY / 13.0) - 1;
					if (level >= 0 && scrollBar.ScrollOffset + level < chatStrings.Count)
					{
						EOGame.Instance.Hud.SetChatText("!" + chatStrings.Keys[scrollBar.ScrollOffset + level].Who + " ");
					}
				}
			}

			base.Update(gameTime);
		}
开发者ID:weedindeed,项目名称:EndlessClient,代码行数:40,代码来源:ChatPanel.cs


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