コード例 #1
0
ファイル: Chunk.cs プロジェクト: BartoszF/ArtifactsRider
        /// <summary>
        /// Draw loop
        /// </summary>
        /// <param name="gameTime">Time that passed since last Update loop</param>
        public void Draw(GameTime gameTime)
        {
            for (int y = (int)MathHelper.Clamp(Camera.GetRect.Y / tileSize, 0, map.GetSize()); y < MathHelper.Clamp(((Camera.GetRect.Y + Camera.GetRect.Height) / tileSize) + 1, 0, position.Height / tileSize); y++)
            {
                for (int x = (int)MathHelper.Clamp(Camera.GetRect.X / tileSize, 0, map.GetSize()); x < MathHelper.Clamp(((Camera.GetRect.X + Camera.GetRect.Width) / tileSize) + 1, 0, position.Width / tileSize); x++)
                {
                    if (tiles[x, y].Fixture == null && tiles[x, y].isSolid && !tiles[x, y].Isolated)
                    {
                        tiles[x, y].SetPhysics(map.PhysicalWorld);
                    }

                    tiles[x, y].Draw(gameTime);
                }
            }
        }