コード例 #1
0
ファイル: GameWorldXna.cs プロジェクト: gubenkoved/nr-planes
        private void DrawDebugInfo()
        {
            GeometryDrawer debugGeomertyDrawer =
                new GeometryDrawer(
                    //Game.Content.Load<Texture2D>("Debug/line"),
                    Game.Content.Load <Texture2D>("Debug/pixel"),
                    Game.Content.Load <Texture2D>("Debug/point2"),
                    Game.Content.Load <SpriteFont>("Fonts/debug"));

            using (var handle = m_safeDrawableGameComponents.SafeRead())
            {
                foreach (var drawableObj in handle.Items)
                {
                    if (drawableObj is DrawableGameObject)
                    {
                        GameObject gameObject = ((DrawableGameObject)drawableObj).GameObject;

                        debugGeomertyDrawer.Draw(m_spriteBatch, m_coordinatesTransformer, gameObject.CalculateAbsoluteGeometry());

                        if (gameObject is Plane && gameObject is IHaveEquipment <PlaneEquipment> )
                        {
                            foreach (var equipment in ((IHaveEquipment <PlaneEquipment>)gameObject).AllEquipment)
                            {
                                var equipmentGeometry = PolygonGeometry.FromRectangle(new Rect(Vector.Zero, equipment.Size));
                                equipmentGeometry.Rotate(equipment.GetAbsoluteRotation());
                                equipmentGeometry.Translate(equipment.GetAbsolutePosition());

                                debugGeomertyDrawer.Draw(m_spriteBatch, m_coordinatesTransformer, equipmentGeometry, drawCenter: false);
                            }
                        }
                    }
                    else if (drawableObj is DrawableStaticObject)
                    {
                        StaticObject staticObject = ((DrawableStaticObject)drawableObj).StaticObject;

                        debugGeomertyDrawer.Draw(m_spriteBatch, m_coordinatesTransformer, staticObject.AbsoluteGeometry);
                    }
                }
            }
        }
コード例 #2
0
 private void SetUp()
 {
     _geometryDrawer     = new GeometryDrawer(pbDrawField);
     _tabControlHelper   = new TabControlHelper(tabCtrlContours);
     _pointsInputManager = new PointsInputManager(_geometryDrawer, _tabControlHelper);
 }