Skip to content

Commit

Permalink
Fixed mouse selection
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Jun 25, 2024
1 parent 72bd846 commit 679337b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions CentrED/Map/MapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class MapManager

public Art Arts;
public Texmap Texmaps;
public Light Lights;

internal List<Tool> Tools = new();
private Tool _activeTool;
Expand Down Expand Up @@ -70,6 +69,7 @@ public Tool ActiveTool
public bool FlatStatics = false;
public bool AnimatedStatics = true;
public bool ShowGrid = false;
public bool DebugLogging;
public Dictionary<ushort, List<(string, string)>> tileLandBrushesNames = new();

public readonly Camera Camera = new();
Expand Down Expand Up @@ -557,6 +557,10 @@ public void Update(GameTime gameTime, bool isActive, bool processMouse, bool pro
Metrics.Stop("GetMouseSelection");
if (newSelected != Selected)
{
if (DebugLogging)
{
Console.WriteLine($"New selected: {newSelected?.Tile}");
}
ActiveTool.OnMouseLeave(Selected);
Selected = newSelected;
ActiveTool.OnMouseEnter(Selected);
Expand Down Expand Up @@ -1261,7 +1265,7 @@ public void OnWindowsResized(GameWindow window)
_gfxDevice.PresentationParameters.BackBufferHeight,
false,
SurfaceFormat.Color,
DepthFormat.None
DepthFormat.Depth24
);
}
}
1 change: 1 addition & 0 deletions CentrED/UI/Windows/DebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private void DrawGeneralTab()
mapManager.Reset();
}
ImGui.Checkbox("Draw SelectionBuffer", ref CEDGame.MapManager.DebugDrawSelectionBuffer);
ImGui.Checkbox("Debug Logging", ref CEDGame.MapManager.DebugLogging);

ImGui.Separator();
if (ImGui.Button("Server Flush"))
Expand Down
5 changes: 5 additions & 0 deletions Shared/LandTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ public void Write(BinaryWriter writer)
writer.Write(_id);
writer.Write(_z);
}

public override string ToString()
{
return $"Land {Id}:{X},{Y},{Z}";
}
}
2 changes: 1 addition & 1 deletion Shared/StaticTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,6 @@ private void OnTileHueChanged(ushort newHue)

public override string ToString()
{
return $"{Id}:{X},{Y},{Z} {Hue}";
return $"Static {Id}:{X},{Y},{Z} {Hue}";
}
}

0 comments on commit 679337b

Please sign in to comment.