Partial entity inspector
This commit is contained in:
@@ -189,7 +189,7 @@ void renderOrientationDirection(ecs_iter_t *it) {
|
||||
Vector2 v = {6.0f, 0.0f};
|
||||
v = Vector2Rotate(v, orientation[i]);
|
||||
v = Vector2Add(v, pos[i]);
|
||||
DrawLine(pos->x, pos->y, v.x, v.y, RED);
|
||||
DrawLine(pos[i].x, pos[i].y, v.x, v.y, RED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,24 @@ void inputPrimaryAction(Game *game, InputState *input) {
|
||||
input->state = INPUT_SELECTED_BUILDING;
|
||||
}
|
||||
selectedCount = ecs_query_entity_count(input->queries.selected);
|
||||
if (IsKeyDown(KEY_LEFT_ALT) && IsKeyDown(KEY_LEFT_SHIFT)) {
|
||||
ecs_iter_t it = ecs_query_iter(ECS, input->queries.selected);
|
||||
while (ecs_iter_next(&it)) {
|
||||
for (i32 i = 0; i < it.count; i++) {
|
||||
ecs_entity_t entity = it.entities[i];
|
||||
bool alreadyInspecting = false;
|
||||
for (i32 j = 0; j < bzArraySize(game->debug.inspecting); j++) {
|
||||
if (game->debug.inspecting[j] == entity) {
|
||||
alreadyInspecting = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!alreadyInspecting)
|
||||
bzArrayPush(game->debug.inspecting, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (selectedCount == 0)
|
||||
|
||||
@@ -29,10 +29,17 @@ ECS_MOVE(Path, dst, src, {
|
||||
})
|
||||
|
||||
ECS_DTOR(Arms, arms, {
|
||||
if (arms->primary)
|
||||
if (arms->primary) {
|
||||
ecs_delete(ECS, arms->primary);
|
||||
if (arms->secondary)
|
||||
arms->primary = 0;
|
||||
}
|
||||
if (arms->secondary) {
|
||||
ecs_delete(ECS, arms->secondary);
|
||||
arms->secondary = 0;
|
||||
}
|
||||
})
|
||||
ECS_MOVE(Arms, dst, src, {
|
||||
*dst = *src;
|
||||
});
|
||||
|
||||
void setupSystems() {
|
||||
@@ -45,7 +52,8 @@ void setupSystems() {
|
||||
.move_dtor = ecs_move(Path)
|
||||
});
|
||||
ecs_set_hooks(ECS, Arms, {
|
||||
.dtor = ecs_dtor(Arms)
|
||||
.dtor = ecs_dtor(Arms),
|
||||
.move_dtor = ecs_move(Arms)
|
||||
});
|
||||
|
||||
ECS_OBSERVER(ECS, entityPathRemove, EcsOnRemove, Path);
|
||||
|
||||
Reference in New Issue
Block a user