public void Render(SpriteBatch spriteBatch, Sector sector, ViewController view)
        {
            foreach (World.System system in ChapterMaster.Sector.Systems)
            {
                DrawStar(spriteBatch, system, Color.White, view);
            }
            foreach (WarpLane lane in ChapterMaster.Sector.WarpLanes)
            {
                DrawLine(
                    new Vector2(ChapterMaster.Sector.Systems[lane.systemId1].x + Constants.SystemSize / 2,
                                ChapterMaster.Sector.Systems[lane.systemId1].y + Constants.SystemSize / 2),
                    new Vector2(ChapterMaster.Sector.Systems[lane.systemId2].x + Constants.SystemSize / 2,
                                ChapterMaster.Sector.Systems[lane.systemId2].y + Constants.SystemSize / 2),
                    Color.White, view);
            }

            foreach (Fleet.Fleet fleet in ChapterMaster.Sector.Fleets)
            {
                DrawFleet(spriteBatch, fleet, Color.White, view, sector);
                if (fleet.isSelected)
                {
                    //primitive.Rectangle(new Rectangle(
                    //    (int)((ChapterMaster.Sector.Systems[view.currentSystemId].x + 30 - view.camX)
                    //    * view.zoom + ChapterMaster.GetWidth() / 2),
                    //    (int)((ChapterMaster.Sector.Systems[view.currentSystemId].x + 30 - view.camY)
                    //    * view.zoom + ChapterMaster.GetHeight() / 2),
                    //    (int)(Constants.SYSTEM_WIDTH_HEIGHT * view.scaleX * view.zoom / 2),
                    //    (int)(Constants.SYSTEM_WIDTH_HEIGHT * view.scaleY * view.zoom / 2)),
                    //    Color.Green);
                }
            }
            if (view.systemSelected)
            {
                primitive.Rectangle(new Rectangle(
                                        (int)((ChapterMaster.Sector.Systems[view.currentSystemId].x - view.camX + Constants.SystemSize / 4)
                                              * view.zoom + GameManager.GetWidth() / 2),
                                        (int)((ChapterMaster.Sector.Systems[view.currentSystemId].y - view.camY + Constants.SystemSize / 4)
                                              * view.zoom + GameManager.GetHeight() / 2),
                                        (int)(Constants.SystemSize * view.scaleX * view.zoom / 2),
                                        (int)(Constants.SystemSize * view.scaleY * view.zoom / 2)),
                                    Color.Green);
            }
        }
示例#2
0
 private void DrawProgressBar(SpriteBatch spriteBatch, int x, int y, int width, int height, int progress, Color background, Color fill)
 {
     primitive.Rectangle(new Rectangle(x, y, width, height), background);
     primitive.Rectangle(new Rectangle(x + 2, y + 2, (width - 2) * (progress / 100), height - 2), fill);
 }