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


C# Framework.Point类代码示例

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


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

示例1: Update

        public void Update( )
        {
            if( _model.Level.ActiveLayer == null )
            {
                return ;
            }

            Vector2 distance = MouseStatus.WorldPosition - _canvas.GrabPoint ;

            if( distance.Length( ) > 0 )
            {
                _canvas.SelectionRectangle = Extensions.RectangleFromVectors( _canvas.GrabPoint, MouseStatus.WorldPosition ) ;

                var itemsCoveredByDragRectangle = _model.ActiveLayer.Items.Where(
                    i =>
                        {
                            var point = new Point( (int) i.ItemProperties.Position.X, (int) i.ItemProperties.Position.Y ) ;

                            return i.ItemProperties.Visible && _canvas.SelectionRectangle.Contains( point ) ;
                        } ).ToList( ) ;

                itemsCoveredByDragRectangle.Reverse( ) ;
                _model.SelectEditors( new SelectedEditors( itemsCoveredByDragRectangle ) ) ;
            }

            if( MouseStatus.LeftButton == ButtonState.Released )
            {
                _canvas.SetModeToIdle( ) ;
            }
        }
开发者ID:WinterGroveProductions,项目名称:Gleed2D,代码行数:30,代码来源:InputHandlerWhenCreatingTheSelectionRectangle.cs

示例2: Sprite

 public Sprite(Texture2D texture, Point offset, Rectangle source, int hue)
 {
     m_Texture = texture;
     m_Offset = offset;
     m_SourceRect = source;
     m_Hue = hue;
 }
开发者ID:FreeReign,项目名称:UltimaXNA,代码行数:7,代码来源:GUISprite.cs

示例3: Tilemap

 public Tilemap(Node parent, string name, Texture2D tileTexture, Point size, Point tileSize)
     : base(parent, name)
 {
     Body = new Body(this, "Body");
     Render = new TilemapRender(this, "TilemapRender", tileTexture, size, tileSize);
     Render.LinkDependency(TilemapRender.DEPENDENCY_BODY, Body);
 }
开发者ID:HaKDMoDz,项目名称:EntityEngineV4,代码行数:7,代码来源:Tilemap.cs

示例4: Circle_ContainsPoint

        public void Circle_ContainsPoint()
        {
            var circle = new Circle(new Vector2(200.0f, 300.0f), 100.0f);

            var p1 = new Point(-1, -1);
            var p2 = new Point(110, 300);
            var p3 = new Point(200, 300);
            var p4 = new Point(290, 300);
            var p5 = new Point(400, 400);

            bool result;

            circle.Contains(ref p1, out result);
            Assert.AreEqual(false, result);
            circle.Contains(ref p2, out result);
            Assert.AreEqual(true, result);
            circle.Contains(ref p3, out result);
            Assert.AreEqual(true, result);
            circle.Contains(ref p4, out result);
            Assert.AreEqual(true, result);
            circle.Contains(ref p5, out result);
            Assert.AreEqual(false, result);

            Assert.AreEqual(false, circle.Contains(p1));
            Assert.AreEqual(true, circle.Contains(p2));
            Assert.AreEqual(true, circle.Contains(p3));
            Assert.AreEqual(true, circle.Contains(p4));
            Assert.AreEqual(false, circle.Contains(p5));
        }
开发者ID:Mithent,项目名称:MonoGame.Extended,代码行数:29,代码来源:CircleTests.cs

示例5: HandleInput

 public void HandleInput(Point screenInputTouchPosition)
 {
     if(showing)
     {
         HandleTouchInput(screenInputTouchPosition);
     }
 }
开发者ID:ruairitobrien,项目名称:Nathaniel-WP7,代码行数:7,代码来源:PopUpScreen.cs

示例6: SplitItemStackGump

        public SplitItemStackGump(Item item, Point pickupOffset)
            : base(0, 0)
        {
            Item = item;
            m_PickupOffset = pickupOffset;

            IsMoveable = true;

            // Background
            AddControl(new GumpPic(this, 0, 0, 0x085c, 0));
            // Slider
            m_Slider = (HSliderBar)AddControl(new HSliderBar(this, 30, 16, 104, 0, item.Amount, item.Amount, HSliderBarStyle.BlueWidgetNoBar));
            m_LastValue = m_Slider.Value;
            // Ok button
            AddControl(new Button(this, 102, 38, 0x085d, 0x085e, ButtonTypes.Default, 0, 0));
            ((Button)LastControl).GumpOverID = 0x085f;
            ((Button)LastControl).MouseClickEvent += ClickOkayButton;
            // Text entry field
            m_AmountEntry = (TextEntry)AddControl(new TextEntry(this, 30, 39, 60, 16, 0, 0, 5, item.Amount.ToString()));
            m_AmountEntry.HtmlTag = "<big>";
            m_AmountEntry.LegacyCarat = true;
            m_AmountEntry.Hue = 1001;
            m_AmountEntry.ReplaceDefaultTextOnFirstKeypress = true;
            m_AmountEntry.NumericOnly = true;
        }
开发者ID:InjectionDev,项目名称:UltimaXNA,代码行数:25,代码来源:SplitItemStackGump.cs

示例7: Draw

 public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS)
 {
     Vector3 hueVector = Utility.GetHueVector(Hue);
     int width = (int)(m_PercentWidthDrawn * Width);
     spriteBatch.Draw2D(m_Texture, new Rectangle(position.X, position.Y, width, Height), new Rectangle(0, 0, width, Height), hueVector);
     base.Draw(spriteBatch, position, frameMS);
 }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:7,代码来源:GumpPicWithWidth.cs

示例8: Collectable

 public Collectable()
 {
     DimensionsInCells = new Point(1, 1);
     Visible = true;
     RenderLayer = 2;
     Frame = new Rectangle(0, 0, Definitions.CellSizeInPixels, Definitions.CellSizeInPixels);
 }
开发者ID:Ben-P-Leda,项目名称:Bopscotch-Editor,代码行数:7,代码来源:Collectable.cs

示例9: Swap

 public void Swap(Swap swap)
 {
     var from = new Point(swap.From.X, swap.From.Y);
     var to = new Point(swap.To.X, swap.To.Y);
     _animals[from.X, from.Y] = swap.To; swap.To.MoveTo(from.X, from.Y);
     _animals[to.X, to.Y] = swap.From; swap.From.MoveTo(to.X, to.Y);
 }
开发者ID:MSigma,项目名称:ZooBurst,代码行数:7,代码来源:Level.cs

示例10: OnInitialize

 protected override void OnInitialize()
 {
     Position = new Point(0, 0);
     Size = new Point(800, 600);
     AddControl(new ResizePic(this, 0, 0, 3000, 800, 600));
     int rowwidth = 60;
     // caption string
     m_Label = (TextLabel)AddControl(new TextLabel(this, 50, 8, 0, null));
     // object that is hued based on the current overhue.
     m_HueDisplay = (HuedControl)AddControl(new HuedControl(this, 8305));
     LastControl.Position = new Point(745, 15);
     ((HuedControl)LastControl).Hue = 0;
     // unhued object
     AddControl(new HuedControl(this));
     LastControl.Position = new Point(-5, 10);
     ((HuedControl)LastControl).Hue = 0;
     // hue index 1 (uo hue -1), aka one of the "True Black" hues
     AddControl(new HuedControl(this));
     LastControl.Position = new Point(3, 10);
     ((HuedControl)LastControl).Hue = 1;
     for (int i = 0; i < 3000; i++) {
         AddControl(new HuedControl(this));
         LastControl.Position = new Point((i % rowwidth) * 11 - 5, (i / rowwidth) * 10 + 28);
         ((HuedControl)LastControl).Hue = i + 2;
     }
     using (FileStream file = new FileStream("hues0.png", FileMode.Create)) {
         HueData.HueTexture0.SaveAsPng(file, HueData.HueTexture0.Width, HueData.HueTexture0.Height);
     }
     using (FileStream file = new FileStream("hues1.png", FileMode.Create)) {
         HueData.HueTexture1.SaveAsPng(file, HueData.HueTexture1.Width, HueData.HueTexture1.Height);
     }
 }
开发者ID:jorsi,项目名称:UltimaXNA,代码行数:32,代码来源:DebugHuesGumpModule.cs

示例11: Update

        public override void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = Keyboard.GetState();

            MouseState mouseState = Mouse.GetState();
            Vector2 v = new Vector2(mouseState.X, mouseState.Y) / Camera2D.PhoneScale;
            mousePos = new Point((int)v.X, (int)v.Y);

            //if (keyboardState.IsKeyDown(Keys.F1) && prevKeyboardState.IsKeyUp(Keys.F1))
            //    DebugMode = !DebugMode;

            #if WINDOWS
            if (keyboardState.IsKeyDown(Keys.F2) && prevKeyboardState.IsKeyUp(Keys.F2))
            {
                BitSitsGames.bloom.Visible = !BitSitsGames.bloom.Visible;
                BitSitsGames.bloom.Settings = BloomSettings.PresetSettings[5];
            }

            if (keyboardState.IsKeyDown(Keys.F3) && prevKeyboardState.IsKeyUp(Keys.F3))
            {
                bloomSettingsIndex = (bloomSettingsIndex + 1) %
                                     BloomSettings.PresetSettings.Length;

                BitSitsGames.bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex];
            }
            #endif

            if (keyboardState.IsKeyDown(Keys.Space) && prevKeyboardState.IsKeyDown(Keys.Space))
                ShowBonds = !ShowBonds;

            prevKeyboardState = keyboardState;
        }
开发者ID:BitSits,项目名称:BitSits-Framework-10---Atooms-To-Moolecule,代码行数:32,代码来源:DebugComponent.cs

示例12: LayerSection

 public LayerSection(Rectangle bounds, Point position, int order, Texture2D background)
 {
     _bounds = bounds;
     _position = position;
     _order = order;
     _background = background;
 }
开发者ID:JakeGilla,项目名称:WinterEngine,代码行数:7,代码来源:LayerSection.cs

示例13: ColorAtPositionNegativeTest

        public void ColorAtPositionNegativeTest( int x, int y )
        {
            Point position = new Point( x, y );
            Block block = new Block();

            Assert.AreEqual( null, block.ColorAt( position ) );
        }
开发者ID:rutgerk1,项目名称:TddTetris,代码行数:7,代码来源:BlockTest.cs

示例14: Block

 public Block(BlockType type, int x, int y)
     : this()
 {
     Position = new Point(x, y);
     Type = type;
     Rotate = 0;
 }
开发者ID:patrickdean,项目名称:tetris-clone,代码行数:7,代码来源:Block.cs

示例15: Draw

        public override void Draw(SpriteBatchUI spriteBatch, Point position)
        {
            if (m_Texture == null)
            {
                IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
                if (IsFemale)
                {
                    int index = Item.ItemData.AnimID + 60000;
                    int indexTranslated, hueTranslated;
                    if (GumpDefTranslator.ItemHasGumpTranslation(index, out indexTranslated, out hueTranslated))
                    {
                        index = indexTranslated;
                        m_HueOverride = hueTranslated;
                        m_Texture = provider.GetUITexture(index);
                    }
                }
                if (m_Texture == null)
                {
                    int index = Item.ItemData.AnimID + 50000;
                    int indexTranslated, hueTranslated;
                    if (GumpDefTranslator.ItemHasGumpTranslation(index, out indexTranslated, out hueTranslated))
                    {
                        index = indexTranslated;
                        m_HueOverride = hueTranslated;
                        m_Texture = provider.GetUITexture(index);
                    }
                    m_Texture = provider.GetUITexture(index);
                }
                Size = new Point(m_Texture.Width, m_Texture.Height);
            }

            int hue = (Item.Hue == 0 & m_HueOverride != 0) ? m_HueOverride : Item.Hue;
            spriteBatch.Draw2D(m_Texture, new Vector3(position.X, position.Y, 0), Utility.GetHueVector(hue));
            base.Draw(spriteBatch, position);
        }
开发者ID:msx752,项目名称:UltimaXNA,代码行数:35,代码来源:ItemGumplingPaperdoll.cs


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