public void DrawScreen() { DrawGalaxy(); Empire currentEmpire = _gameMain.EmpireManager.CurrentEmpire; StarSystem selectedSystem = currentEmpire.SelectedSystem; FleetGroup selectedFleetGroup = currentEmpire.SelectedFleetGroup; _taskBar.Draw(); if (selectedFleetGroup != null) { _fleetView.Draw(); } if (selectedSystem != null) { _systemView.Draw(); } if (_windowShowing != null) { _windowShowing.Draw(); } }
public void DrawScreen() { List <StarSystem> systems = _gameMain.Galaxy.GetStarsInArea(_camera.CameraX, _camera.CameraY, _gameMain.ScreenWidth / _camera.ZoomDistance, _gameMain.ScreenHeight / _camera.ZoomDistance); foreach (StarSystem system in systems) { GorgonLibrary.Gorgon.CurrentShader = _gameMain.StarShader; _gameMain.StarShader.Parameters["StarColor"].SetValue(system.StarColor); system.Sprite.Draw((int)((system.X - _camera.CameraX) * _camera.ZoomDistance), (int)((system.Y - _camera.CameraY) * _camera.ZoomDistance), _camera.ZoomDistance, _camera.ZoomDistance); GorgonLibrary.Gorgon.CurrentShader = null; if (StarNamesVisible && (_whichEmpireFocusedOn.ContactManager.IsContacted(system.DominantEmpire) || system.IsThisSystemExploredByEmpire(_whichEmpireFocusedOn))) { float x = (system.X - _camera.CameraX) * _camera.ZoomDistance; x -= (system.StarName.GetWidth() / 2); float y = ((system.Y + (system.Size * 16)) - _camera.CameraY) * _camera.ZoomDistance; system.StarName.MoveTo((int)x, (int)y); if (system.DominantEmpire != null) { // TODO: Optimize this by moving the text sprite and color shader to StarSystem, where it's updated when ownership changes float percentage = 1.0f; _oldTarget = GorgonLibrary.Gorgon.CurrentRenderTarget; _starName.Width = (int)system.StarName.GetWidth(); _starName.Height = (int)system.StarName.GetHeight(); GorgonLibrary.Gorgon.CurrentRenderTarget = _starName; system.StarName.MoveTo(0, 0); system.StarName.Draw(); GorgonLibrary.Gorgon.CurrentRenderTarget = _oldTarget; //GorgonLibrary.Gorgon.CurrentShader = _gameMain.NameShader; foreach (Empire empire in system.EmpiresWithPlanetsInThisSystem) { /*_gameMain.NameShader.Parameters["EmpireColor"].SetValue(empire.ConvertedColor); * _gameMain.NameShader.Parameters["startPos"].SetValue(percentage); * _gameMain.NameShader.Parameters["endPos"].SetValue(percentage + system.OwnerPercentage[empire]);*/ _starName.Blit(x, y, _starName.Width * percentage, _starName.Height, empire.EmpireColor, BlitterSizeMode.Crop); percentage -= system.OwnerPercentage[empire]; } //GorgonLibrary.Gorgon.CurrentShader = null; } else { system.StarName.Draw(); } } } foreach (Fleet fleet in _gameMain.EmpireManager.GetFleetsWithinArea(_camera.CameraX, _camera.CameraY, _gameMain.ScreenWidth / _camera.ZoomDistance, _gameMain.ScreenHeight / _camera.ZoomDistance)) { var fleetIcon = fleet.Ships.Count > 0 ? fleet.Empire.EmpireRace.FleetIcon : fleet.Empire.EmpireRace.TransportIcon; if (fleet.AdjacentSystem != null) { if (fleet.TravelNodes != null && fleet.TravelNodes.Count > 0) { //Adjacent to a system, but is heading to another system fleetIcon.Draw((int)(((fleet.GalaxyX - 32) - _camera.CameraX) * _camera.ZoomDistance), (int)((fleet.GalaxyY - _camera.CameraY) * _camera.ZoomDistance), 1, 1, fleet.Empire.EmpireColor); } else { //Adjacent to a system, just chilling fleetIcon.Draw((int)(((fleet.GalaxyX + 32) - _camera.CameraX) * _camera.ZoomDistance), (int)((fleet.GalaxyY - _camera.CameraY) * _camera.ZoomDistance), 1, 1, fleet.Empire.EmpireColor); } } else { fleetIcon.Draw((int)((fleet.GalaxyX - _camera.CameraX) * _camera.ZoomDistance), (int)((fleet.GalaxyY - _camera.CameraY) * _camera.ZoomDistance), 1, 1, fleet.Empire.EmpireColor); } } if (_exploredSystemsThisTurn.Count > 0) { _systemView.Draw(); _systemInfoWindow.Draw(); } if (_colonizableFleetsThisTurn.Count > 0) { _colonizeScreen.Draw(); } if (_newResearchTopicsNeeded.Count > 0) { _researchPrompt.Draw(); } }