Made debug UI more readable by using float formatting.

WorldChunkRefactoring
Martin Felis 2023-09-26 17:00:25 +02:00
parent e91b64e82f
commit e2bb11380d
2 changed files with 11 additions and 11 deletions

View File

@ -7,7 +7,7 @@ public class Game : Spatial
{
// ui elements
private Label _framesPerSecondLabel;
private Label _tileLabel;
private Label _centerLabel;
private Label _tileOffsetLabel;
private Label _numTilesLabel;
private Label _mouseWorldLabel;
@ -50,7 +50,7 @@ public class Game : Spatial
Container debugStatsContainer = (Container)FindNode("DebugStatsContainer");
_framesPerSecondLabel = debugStatsContainer.GetNode<Label>("fps_label");
_tileLabel = debugStatsContainer.GetNode<Label>("tile_label");
_centerLabel = debugStatsContainer.GetNode<Label>("center_label");
_tileOffsetLabel = debugStatsContainer.GetNode<Label>("tile_offset_label");
_numTilesLabel = debugStatsContainer.GetNode<Label>("num_tiles_label");
_mouseWorldLabel = debugStatsContainer.GetNode<Label>("mouse_world_label");
@ -183,7 +183,7 @@ public class Game : Spatial
_currentTile = _hexGrid.GetHexAt(new Vector2(centerCoord.x, centerCoord.z));
_tileLabel.Text = centerCoord.ToString();
_centerLabel.Text = centerCoord.ToString("F3");
_tileOffsetLabel.Text = _currentTile.OffsetCoords.ToString();
}
@ -237,9 +237,9 @@ public class Game : Spatial
HexCell cellAtCursor = _hexGrid.GetHexAt(new Vector2(position.x, position.z));
Transform highlightTransform = Transform.Identity;
_mouseWorldLabel.Text = position.ToString();
_mouseTileOffsetLabel.Text = cellAtCursor.OffsetCoords.ToString();
_mouseTileCubeLabel.Text = cellAtCursor.CubeCoords.ToString();
_mouseWorldLabel.Text = position.ToString("F3");
_mouseTileOffsetLabel.Text = cellAtCursor.OffsetCoords.ToString("N");
_mouseTileCubeLabel.Text = cellAtCursor.CubeCoords.ToString("N");
_mouseTileHighlight.Transform = highlightTransform;
if (inputEvent is InputEventMouseButton && ((InputEventMouseButton)inputEvent).Pressed)
@ -270,9 +270,9 @@ public class Game : Spatial
{
Transform highlightTransform = tile.GlobalTransform;
_mouseTileHighlight.Transform = highlightTransform;
_mouseWorldLabel.Text = highlightTransform.origin.ToString();
_mouseTileOffsetLabel.Text = tile.OffsetCoords.ToString();
_mouseTileCubeLabel.Text = tile.Cell.CubeCoords.ToString();
_mouseWorldLabel.Text = highlightTransform.origin.ToString("F3");
_mouseTileOffsetLabel.Text = tile.OffsetCoords.ToString("N");
_mouseTileCubeLabel.Text = tile.Cell.CubeCoords.ToString("N");
_player.Navigation.FindPath(_player, _player.GlobalTranslation, tile.GlobalTranslation);
}

View File

@ -110,9 +110,9 @@ margin_top = 18.0
margin_right = 113.0
margin_bottom = 32.0
rect_pivot_offset = Vector2( -335, -33 )
text = "Tile"
text = "Center"
[node name="tile_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
[node name="center_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 117.0
margin_top = 18.0
margin_right = 149.0