Did a small refactoring
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -69,7 +69,8 @@
|
||||
"variant": "cpp",
|
||||
"format": "cpp",
|
||||
"future": "cpp",
|
||||
"cassert": "cpp"
|
||||
"cassert": "cpp",
|
||||
"bitset": "cpp"
|
||||
},
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
}
|
||||
@@ -46,7 +46,21 @@ public:
|
||||
int get_layout_count() const;
|
||||
int get_children_count(flecs::entity base_e) const;
|
||||
struct graph_module {
|
||||
flecs::entity GraphSolve;
|
||||
|
||||
flecs::entity get_layout_grid_base();
|
||||
flecs::entity get_layout_base();
|
||||
flecs::entity create_cell(flecs::entity floor_e,
|
||||
flecs::entity region_e, int id);
|
||||
bool have_cell(flecs::entity floor_e, int id);
|
||||
void grow_cell(flecs::entity seed_e, int id);
|
||||
void queue_grow_cell(flecs::entity seed_e, int id);
|
||||
void growth_module(flecs::world &ecs,
|
||||
const String &module_name);
|
||||
void create_floor_components(
|
||||
flecs::entity floor_e, flecs::entity base_floor_e,
|
||||
const WorldEditor::components::buildings_layout_grid_size
|
||||
&size);
|
||||
graph_module(flecs::world &ecs);
|
||||
};
|
||||
};
|
||||
@@ -801,7 +801,8 @@ void BuildingLayoutGraphUI::draw_2d_grid_view(Control *draw)
|
||||
->grid_size;
|
||||
float disp_size = MIN(size.x, size.y);
|
||||
float multiplier = disp_size / (float)grid_size;
|
||||
print_line(String::num(disp_size) + " " + itos(grid_size));
|
||||
print_line("drawing: " + String::num(disp_size) + " " +
|
||||
itos(grid_size));
|
||||
flecs::entity grid_e = get_current_grid_layout();
|
||||
if (!grid_e.is_valid())
|
||||
return;
|
||||
@@ -835,6 +836,7 @@ void BuildingLayoutGraphUI::draw_2d_grid_view(Control *draw)
|
||||
print_line(String(fe.path()));
|
||||
if (String(fe.name()) == cur_floor ||
|
||||
(cur_floor == "" && pos == 0)) {
|
||||
print_line("draw floor: " + String(fe.name()));
|
||||
draw->draw_rect(Rect2(0, 0, disp_size, disp_size),
|
||||
Color(0, 1, 1, 1), false);
|
||||
// TODO: display children cells
|
||||
@@ -858,6 +860,8 @@ void BuildingLayoutGraphUI::draw_2d_grid_view(Control *draw)
|
||||
float dx = x * disp_size / grid_size;
|
||||
float dy = y * disp_size / grid_size;
|
||||
float dsize = disp_size / grid_size;
|
||||
print_line("draw cell: " + String(fc.name()) +
|
||||
" " + itos(index));
|
||||
if (!colors.has(cell.type))
|
||||
colors[cell.type] = Color(Math::randf(),
|
||||
Math::randf(),
|
||||
@@ -865,6 +869,12 @@ void BuildingLayoutGraphUI::draw_2d_grid_view(Control *draw)
|
||||
1);
|
||||
draw->draw_rect(Rect2(dx, dy, dsize, dsize),
|
||||
colors[cell.type]);
|
||||
print_line(
|
||||
"draw cell: (" + itos(x) + ", " +
|
||||
itos(y) + ") (" + String::num(dx) +
|
||||
", " + String::num(dy) + ") " +
|
||||
String::num(dsize) + " " +
|
||||
(colors[cell.type].operator String()));
|
||||
});
|
||||
}
|
||||
pos++;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -75,6 +75,7 @@ public:
|
||||
String type;
|
||||
int index;
|
||||
};
|
||||
struct final_cell {};
|
||||
struct buildings_layout_graph {};
|
||||
struct buildings_layout_graph_node {
|
||||
int depth;
|
||||
@@ -116,9 +117,17 @@ public:
|
||||
struct buildings_layout_grid_size {
|
||||
int grid_size;
|
||||
List<Pair<int, flecs::entity_t> > floors;
|
||||
int growth_size;
|
||||
};
|
||||
struct belongs {};
|
||||
struct buildings_layout_grid_floor {};
|
||||
struct buildings_layout_grid_floor {
|
||||
Set<int> cells;
|
||||
int grid_size;
|
||||
int size_left;
|
||||
};
|
||||
struct buildings_layout_grid_queue {
|
||||
List<Pair<flecs::entity_t, int> > queue;
|
||||
};
|
||||
struct buildings_layout_commands {
|
||||
struct command {
|
||||
int command;
|
||||
|
||||
Reference in New Issue
Block a user