Better drawing of layout tiles
This commit is contained in:
@@ -873,12 +873,46 @@ void BuildingLayoutGraphUI::draw_2d_grid_view(Control *draw)
|
||||
Color(0.1f, 0.1f, 0.1f, 1.0f),
|
||||
false);
|
||||
if (fc.has<WorldEditor::components::
|
||||
outside_wall>())
|
||||
outside_wall>()) {
|
||||
draw->draw_circle(
|
||||
Vector2(dx + 0.5f * dsize,
|
||||
dy + 0.5f * dsize),
|
||||
dsize * 0.4f,
|
||||
Color(0, 0, 1, 1));
|
||||
if (fc.has<WorldEditor::components::
|
||||
outside_wall_west>())
|
||||
draw->draw_rect(
|
||||
Rect2(dx - dsize * 0.25f,
|
||||
dy, dsize * 0.25f,
|
||||
dsize),
|
||||
Color(0, 0, 1, 1),
|
||||
true);
|
||||
if (fc.has<WorldEditor::components::
|
||||
outside_wall_east>())
|
||||
draw->draw_rect(
|
||||
Rect2(dx + dsize, dy,
|
||||
dsize * 0.25f,
|
||||
dsize),
|
||||
Color(0, 0, 1, 1),
|
||||
true);
|
||||
if (fc.has<WorldEditor::components::
|
||||
outside_wall_north>())
|
||||
draw->draw_rect(
|
||||
Rect2(dx,
|
||||
dy - dsize * 0.25f,
|
||||
dsize,
|
||||
dsize * 0.25),
|
||||
Color(0, 0, 1, 1),
|
||||
true);
|
||||
if (fc.has<WorldEditor::components::
|
||||
outside_wall_south>())
|
||||
draw->draw_rect(
|
||||
Rect2(dx, dy + dsize,
|
||||
dsize,
|
||||
dsize * 0.25),
|
||||
Color(0, 0, 1, 1),
|
||||
true);
|
||||
}
|
||||
if (fc.has<WorldEditor::components::border>())
|
||||
draw->draw_circle(
|
||||
Vector2(dx + 0.5f * dsize,
|
||||
|
||||
@@ -114,8 +114,20 @@ growth_module::growth_module(flecs::world &ecs)
|
||||
.ptr());
|
||||
if (!neighbor_e.is_valid()) {
|
||||
outside = true;
|
||||
break;
|
||||
if (id == west_id)
|
||||
e.add<WorldEditor::components::
|
||||
outside_wall_west>();
|
||||
else if (id == east_id)
|
||||
e.add<WorldEditor::components::
|
||||
outside_wall_east>();
|
||||
else if (id == north_id)
|
||||
e.add<WorldEditor::components::
|
||||
outside_wall_north>();
|
||||
else if (id == south_id)
|
||||
e.add<WorldEditor::components::
|
||||
outside_wall_south>();
|
||||
}
|
||||
#if 0
|
||||
if (!e.parent()
|
||||
.get<WorldEditor::components::
|
||||
buildings_layout_grid_floor>()
|
||||
@@ -123,26 +135,30 @@ growth_module::growth_module(flecs::world &ecs)
|
||||
outside = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
flecs::log::dbg("outside: %d", outside);
|
||||
#if 0
|
||||
for (i = 0; i < (int)neighbors.size(); i++) {
|
||||
int id = neighbors[i];
|
||||
print_line("id=" + itos(id));
|
||||
String neighbor_name = "cell_" + itos(id);
|
||||
flecs::entity neighbor_e =
|
||||
e.parent().lookup(neighbor_name.ascii().ptr());
|
||||
if (!neighbor_e.is_valid())
|
||||
continue;
|
||||
const WorldEditor::components::buildings_layout_grid_cell
|
||||
*neighbor_cell = neighbor_e.get<
|
||||
WorldEditor::components::
|
||||
buildings_layout_grid_cell>();
|
||||
if (cell.type != neighbor_cell->type) {
|
||||
border = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef MAKE_BORDER
|
||||
for (i = 0; i < (int)neighbors.size(); i++) {
|
||||
int id = neighbors[i];
|
||||
print_line("id=" + itos(id));
|
||||
String neighbor_name =
|
||||
"cell_" + itos(id);
|
||||
flecs::entity neighbor_e =
|
||||
e.parent().lookup(
|
||||
neighbor_name.ascii()
|
||||
.ptr());
|
||||
if (!neighbor_e.is_valid())
|
||||
continue;
|
||||
const WorldEditor::components::buildings_layout_grid_cell
|
||||
*neighbor_cell = neighbor_e.get<
|
||||
WorldEditor::components::
|
||||
buildings_layout_grid_cell>();
|
||||
if (cell.type != neighbor_cell->type) {
|
||||
border = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (outside) {
|
||||
e.add<WorldEditor::components::
|
||||
|
||||
@@ -123,6 +123,10 @@ public:
|
||||
struct border {};
|
||||
struct belongs_room {};
|
||||
struct outside_wall {};
|
||||
struct outside_wall_east {};
|
||||
struct outside_wall_west {};
|
||||
struct outside_wall_north {};
|
||||
struct outside_wall_south {};
|
||||
struct corridoor {};
|
||||
struct buildings_layout_grid_floor {
|
||||
Set<int> cells;
|
||||
|
||||
Reference in New Issue
Block a user