#include #include #include #include #include "editor/editor_app.hpp" #include "raylib.h" int main(int argc, char** argv) { std::string path = "assets/levels/floor01.json"; std::string game_path; std::string screenshot; std::string place_asset; float place_x = 0.0f; float place_y = 0.0f; for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], "--level") == 0 && i + 1 < argc) { path = argv[++i]; } else if (std::strcmp(argv[i], "--game") == 0 && i + 1 < argc) { game_path = argv[++i]; } else if (std::strcmp(argv[i], "--screenshot") == 0 && i + 1 < argc) { screenshot = argv[++i]; } else if (std::strcmp(argv[i], "--place") == 0 && i + 3 < argc) { place_asset = argv[++i]; place_x = std::stof(argv[++i]); place_y = std::stof(argv[++i]); } else if (std::strcmp(argv[i], "--help") == 0) { std::printf("usage: editor [--level ] [--game ]\n" " [--screenshot ]\n" " [--place ]\n"); return 0; } } if (game_path.empty()) { for (const char* candidate : {"./cntrl", "./build/cntrl", "../cntrl"}) { if (std::filesystem::exists(candidate)) { game_path = candidate; break; } } if (game_path.empty()) game_path = "./build/cntrl"; } SetTraceLogLevel(LOG_WARNING); InitWindow(1400, 900, "FBC: NIGHT SHIFT - Level Editor"); SetTargetFPS(60); editor::App app(path); app.set_game_path(game_path); app.init(); if (!place_asset.empty()) app.debug_place(place_asset, {place_x, place_y}); int frames = 0; while (!WindowShouldClose() && !app.should_close()) { app.update(); app.draw(); if (!screenshot.empty() && ++frames == 30) { TakeScreenshot(screenshot.c_str()); break; } } app.shutdown(); CloseWindow(); return 0; }