Minor code cleanup.

This commit is contained in:
2025-06-16 23:56:46 -05:00
parent f40fd7e840
commit 62b035a0c2
5 changed files with 65 additions and 66 deletions

View File

@@ -224,6 +224,46 @@ void EditorApp::LoadLevel(const std::filesystem::path& level_meta_path)
data_ready = true;
}
void EditorApp::CreateTestLevel() {
loaded_level = new Level();
loaded_level->name = "TestLevel";
loaded_level->author = "dawsh";
loaded_level->cols = 64;
loaded_level->rows = 64;
loaded_level->tileset_path = "tileset.json";
auto layer = new Layer();
layer->name = "Layer 1";
layer->cols = 64;
layer->rows = 64;
layer->cell_height = 16;
layer->cell_width = 16;
layer->binary_path = "layers/1.bin";
layer->InitGrid();
layer->Save();
loaded_level->layers.push_back(layer);
loaded_tileset = new Tileset();
loaded_tileset->name = "MegaCommando";
loaded_tileset->author = "dawsh";
loaded_tileset->tex_height = 1280;
loaded_tileset->tex_width = 1024;
loaded_tileset->tile_width = 16;
loaded_tileset->tile_height = 16;
loaded_tileset->tile_spacing = 0;
loaded_tileset->cols = 80;
loaded_tileset->rows = 60;
loaded_tileset->file_path = "tileset.json";
loaded_tileset->texture_path = "assets/megacommando.png";
loaded_tilesheet = new JGL::Texture("assets/megacommando.png");
write_file_contents("tileset.json", json::deparse(loaded_tileset->Serialize()));
//layer_view->UpdateComponents(loaded_level);
data_ready = true;
SaveCurrentLevel();
}
void EditorApp::SizeCellIndicatorToTilesetSize()
@@ -333,9 +373,14 @@ void EditorApp::CreateWidgets()
app_info_dialog = CreateAppInfoDialogWindow(scene);
auto* fpsgraphwindow = new JUI::Window(scene);
auto* fpsgraph = new JUI::FpsGraph(scene);
auto* fps_graph = new JUI::FpsGraph(scene);
// TODO: Revise to use PseudoDockedElementAtBottomOfViewport coming in the next JUI release.
fps_graph->Size({100_percent, 50_px});
fps_graph->AnchorPoint({1, 1});
fps_graph->Position({100_percent, 100_percent});
fps_graph->BGColor(Colors::Transparent);
fps_graph->BorderColor(Colors::Transparent);
fps_graph->ZIndex(10);
console = new JUI::CommandLine(scene);
console->Close();

View File

@@ -7,8 +7,6 @@ Tileset::Tileset():
{ }
Tileset::Tileset(const std::string& name, const std::filesystem::path& texture_path, int tex_width, int tex_height, int tile_width, int tile_height,
int tile_spacing)
{