-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
348 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Pulsar4X/Pulsar4X.ImGuiNetUI/MapRendering/GalacticMapRender.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using ImGuiSDL2CS; | ||
|
||
namespace Pulsar4X.SDL2UI | ||
{ | ||
public class GalacticMapRender | ||
{ | ||
GlobalUIState _state; | ||
List<SystemState> SystemStates = new List<SystemState>(); | ||
internal Dictionary<Guid,SystemMapRendering> RenderedMaps = new Dictionary<Guid, SystemMapRendering>(); | ||
ImGuiSDL2CSWindow _window; | ||
internal SystemMapRendering PrimarySysMap { get; set; } | ||
|
||
public GalacticMapRender(ImGuiSDL2CSWindow window, GlobalUIState state) | ||
{ | ||
_state = state; | ||
_window = window; | ||
|
||
} | ||
|
||
internal void SetFaction() | ||
{ | ||
int i = 0; | ||
double startangle = Math.PI * 0.5; | ||
float angleIncrease = 0.01f; | ||
int startR = 32; | ||
int radInc = 5; | ||
foreach (var item in _state.StarSystemStates) | ||
{ | ||
|
||
SystemMapRendering map = new SystemMapRendering(_window, _state); | ||
map.SetSystem(item.Value.StarSystem); | ||
RenderedMaps[item.Key] = map; | ||
var x = (startR + radInc * i) * Math.Sin(startangle - angleIncrease * i); | ||
var y = (startR + radInc * i) * Math.Cos(startangle - angleIncrease * i); | ||
map.GalacticMapPosition.X = x; | ||
map.GalacticMapPosition.Y = y; | ||
i++; | ||
} | ||
} | ||
|
||
internal void DrawNameIcons() | ||
{ | ||
foreach (var kvp in RenderedMaps) | ||
{ | ||
var sysid = kvp.Key; | ||
var sysmap = kvp.Value; | ||
sysmap.DrawNameIcons(); | ||
} | ||
} | ||
|
||
internal void Draw() | ||
{ | ||
foreach (var kvp in RenderedMaps) | ||
{ | ||
var sysid = kvp.Key; | ||
var sysmap = kvp.Value; | ||
sysmap.Draw(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.