Basic Entity ID display for debugging
This commit is contained in:
@@ -29,6 +29,8 @@ pub const Simulator = struct {
|
||||
///
|
||||
/// Note: It only works outside of the delete mode
|
||||
show_connections: bool,
|
||||
/// Toggle that tracks whether ID (or possibly something more in the future) of every entity is displayed in GUI
|
||||
display_entity_info: bool,
|
||||
highlighted_entity: ?st.Entity,
|
||||
|
||||
/// Constructor for convenience
|
||||
@@ -40,6 +42,7 @@ pub const Simulator = struct {
|
||||
.auto_continue = false,
|
||||
.delete_mode = false,
|
||||
.show_connections = false,
|
||||
.display_entity_info = false,
|
||||
.highlighted_entity = null,
|
||||
};
|
||||
}
|
||||
@@ -61,8 +64,8 @@ pub const Simulator = struct {
|
||||
}
|
||||
}
|
||||
|
||||
self.road_man.draw(highlighted_road);
|
||||
self.node_man.draw(pos);
|
||||
self.road_man.draw(highlighted_road, self.display_entity_info);
|
||||
self.node_man.draw(pos, self.display_entity_info);
|
||||
|
||||
self.drawRelatedSelectedEntities();
|
||||
}
|
||||
@@ -76,18 +79,18 @@ pub const Simulator = struct {
|
||||
const node = h_entity.node;
|
||||
|
||||
for (node.roads.items) |road| {
|
||||
road.draw(true);
|
||||
road.draw(true, self.display_entity_info);
|
||||
}
|
||||
|
||||
node.draw(c.NODE_RELATED_COLOUR);
|
||||
node.draw(c.NODE_RELATED_COLOUR, self.display_entity_info);
|
||||
},
|
||||
.road => {
|
||||
const road = h_entity.road;
|
||||
|
||||
road.draw(true);
|
||||
road.draw(true, self.display_entity_info);
|
||||
|
||||
road.nodes[0].draw(c.NODE_RELATED_COLOUR);
|
||||
road.nodes[1].draw(c.NODE_RELATED_COLOUR);
|
||||
road.nodes[0].draw(c.NODE_RELATED_COLOUR, self.display_entity_info);
|
||||
road.nodes[1].draw(c.NODE_RELATED_COLOUR, self.display_entity_info);
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -109,6 +112,8 @@ pub const Simulator = struct {
|
||||
self.delete_mode = rl.isKeyDown(.left_shift);
|
||||
self.show_connections = rl.isKeyDown(.left_alt) and !self.delete_mode;
|
||||
|
||||
if (rl.isKeyReleased(.tab)) self.display_entity_info = !self.display_entity_info;
|
||||
|
||||
if (rl.isKeyReleased(.c)) self.clear() catch |err| {
|
||||
std.debug.panic("Failed to clear the entities: {}\n", .{err});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user