當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。