コード例 #1
0
        public void Render(DwarfTime gameTime, ChunkManager chunks, Camera camera, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, DwarfCorp.Shader effect, bool renderingForWater)
        {
            if (GUIObject != null)
            {
                if (Enabled && IsVisible && camera.IsInView(GetBoundingBox()))
                {
                    Vector3 screenPos = camera.Project(GlobalTransform.Translation);
                    GUIObject.LocalBounds = new Rectangle((int)screenPos.X - GUIObject.LocalBounds.Width / 2,
                                                          (int)screenPos.Y - GUIObject.LocalBounds.Height / 2, GUIObject.LocalBounds.Width,
                                                          GUIObject.LocalBounds.Height);

                    GUIObject.IsVisible = true;
                }
                else
                {
                    GUIObject.IsVisible = false;
                }
            }
        }
コード例 #2
0
ファイル: WorldGUIObject.cs プロジェクト: scorvi/dwarfcorp
        public override void Render(DwarfTime gameTime, ChunkManager chunks, Camera camera, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice, Microsoft.Xna.Framework.Graphics.Effect effect, bool renderingForWater)
        {
            if (GUIObject != null)
            {
                if (Enabled && IsVisible && camera.IsInView(GetBoundingBox()))
                {
                    Vector3 screenPos = camera.Project(GlobalTransform.Translation);
                    GUIObject.LocalBounds = new Rectangle((int) screenPos.X - GUIObject.LocalBounds.Width/2,
                        (int) screenPos.Y - GUIObject.LocalBounds.Height/2, GUIObject.LocalBounds.Width,
                        GUIObject.LocalBounds.Height);

                    GUIObject.IsVisible = true;
                }
                else
                {
                    GUIObject.IsVisible = false;
                }
            }
            base.Render(gameTime, chunks, camera, spriteBatch, graphicsDevice, effect, renderingForWater);
        }