Fixing logger and windows version - remove terminal

This commit is contained in:
Vladislav Khorev committed 2026-07-14 20:39:41 +03:00
1 parent 76287dda46
commit a7d17d9afd
27 files changed
+349 -243

No files matched your search

+28 -28
View File
@@ -43,7 +43,7 @@ namespace ZL
Game* Game::s_instance = nullptr;
void Game::onResourcesZipLoaded(unsigned /*handle*/, void* /*userData*/, const char* /*filename*/) {
std::cout << "Resources.zip loaded successfully--0" << std::endl;
logger() << "Resources.zip loaded successfully--0" << std::endl;
if (s_instance) {
s_instance->resourcesDownloadProgress = 1.0f;
// Builds the loadSteps queue (cheap, no GL work); the actual loading
@@ -54,7 +54,7 @@ namespace ZL
}
void Game::onResourcesZipError(unsigned /*handle*/, void* /*userData*/, int /*httpStatus*/) {
std::cout << "Failed to download resources.zip" << std::endl;
logger() << "Failed to download resources.zip" << std::endl;
}
void Game::onResourcesZipProgress(unsigned /*handle*/, void* /*userData*/, int percentComplete) {
@@ -134,7 +134,7 @@ namespace ZL
// Asynchronously download resources.zip; setupPart2() is called on completion.
// The loading screen stays visible until the download finishes.
s_instance = this;
std::cout << "Load resurces step 1-" << std::endl;
logger() << "Load resurces step 1-" << std::endl;
emscripten_async_wget2("resources.zip", "resources.zip", "GET", nullptr, nullptr,
onResourcesZipLoaded, onResourcesZipError, onResourcesZipProgress);
#else
@@ -316,7 +316,7 @@ namespace ZL
loadSteps.push([this]() {
try {
menuManager.setup(gameState.inventory, CONST_ZIP_FILE);
std::cout << "UI loaded successfully" << std::endl;
logger() << "UI loaded successfully" << std::endl;
}
catch (const std::exception& e) {
std::cerr << "Failed to load UI: " << e.what() << std::endl;
@@ -366,10 +366,10 @@ namespace ZL
if (audioPlayer->init()) {
audioPlayer->setMusicVolume(100);
audioPlayer->setSoundVolume(80);
std::cout << "Audio initialized successfully" << std::endl;
logger() << "Audio initialized successfully" << std::endl;
}
else {
std::cout << "Audio initialization failed" << std::endl;
logger() << "Audio initialization failed" << std::endl;
}
});
@@ -480,12 +480,12 @@ namespace ZL
nlohmann::json root;
gameState.save(root);
const std::string path = "start_state.json";
std::cout << "[reset] saveInitialState called, to " << path << std::endl;
logger() << "[reset] saveInitialState called, to " << path << std::endl;
std::ofstream file(path);
if (file.is_open()) {
file << root.dump(2);
std::cout << "[reset] Saved initial state snapshot to " << path << std::endl;
logger() << "[reset] Saved initial state snapshot to " << path << std::endl;
} else {
std::cerr << "[reset] Could not open " << path << " for writing" << std::endl;
}
@@ -796,7 +796,7 @@ namespace ZL
// Teleport callbacks: destination name and position come from the teleport zone data.
auto teleportCallback = [this](const std::string& destName, const Eigen::Vector3f& destPos, float destRotY) {
std::cout << "[TELEPORT] " << " -> " << destName << std::endl;
logger() << "[TELEPORT] " << " -> " << destName << std::endl;
auto it = gameState.locations.find(destName);
if (it == gameState.locations.end()) {
std::cerr << "[TELEPORT] Unknown destination location: " << destName << std::endl;
@@ -903,12 +903,12 @@ namespace ZL
void Game::createShadowMapAndProparateToLocations()
{
if (shadowMap) {
std::cout << "Shadow map already exists, skipping creation" << std::endl;
logger() << "Shadow map already exists, skipping creation" << std::endl;
return;
}
shadowMap = std::make_shared<ShadowMap>(2048, 40.0f, 0.1f, 100.0f);
shadowMap->setLightDirection(Eigen::Vector3f(-0.5f, -1.0f, -0.3f));
std::cout << "Shadow map initialized" << std::endl;
logger() << "Shadow map initialized" << std::endl;
for (auto& [name, loc] : gameState.locations) {
loc->shadowMap = shadowMap;
@@ -1210,7 +1210,7 @@ namespace ZL
menuManager.onOrientationChanged();
}
std::cout << "Window resized (Render Size): " << Environment::width << "x" << Environment::height << std::endl;
logger() << "Window resized (Render Size): " << Environment::width << "x" << Environment::height << std::endl;
//space.clearTextRendererCache();
}
@@ -1300,7 +1300,7 @@ namespace ZL
if (Environment::zoom > zoomMax) {
Environment::zoom = zoomMax;
}
std::cout << "Current zoom: " << Environment::zoom << std::endl;
logger() << "Current zoom: " << Environment::zoom << std::endl;
// Tutorial step3 → step4: any mouse-wheel scroll counts as "zoom gesture".
if (gameState.tutorialStep == TutorialStep::Step3) {
menuManager.advanceTutorialStep();
@@ -1345,7 +1345,7 @@ namespace ZL
currentLocation()->editor.selectInteractiveObject(event.key.keysym.sym - SDLK_0);
} else {
currentLocation()->switchNavigation(event.key.keysym.sym - SDLK_0);
std::cout << "Switched to nav mesh " << (event.key.keysym.sym - SDLK_0) << std::endl;
logger() << "Switched to nav mesh " << (event.key.keysym.sym - SDLK_0) << std::endl;
}
break;
case SDLK_f:
@@ -1376,50 +1376,50 @@ namespace ZL
const char* modeName = (editorMode == EditorMode::Navigation) ? "Navigation"
: (editorMode == EditorMode::InteractiveObjects) ? "InteractiveObjects"
: "None";
std::cout << "[EDITOR] Mode: " << modeName << std::endl;
logger() << "[EDITOR] Mode: " << modeName << std::endl;
}
break;
case SDLK_o:
x = x + 0.05;
std::cout << "current x: " << x << std::endl;
logger() << "current x: " << x << std::endl;
//y = y + 0.002;
//currentLocation->player->hp = 200;
//currentLocation->npcs[0]->walkSpeed += 0.01f;
//std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
//logger() << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
break;
case SDLK_k:
x = x - 0.05;
std::cout << "current x: " << x << std::endl;
std::cout << "Player pos: " << currentLocation()->player->state.position.transpose() << std::endl;
std::cout << "Player rotation: " << currentLocation()->player->state.facingAngle*180.0/M_PI << std::endl;
logger() << "current x: " << x << std::endl;
logger() << "Player pos: " << currentLocation()->player->state.position.transpose() << std::endl;
logger() << "Player rotation: " << currentLocation()->player->state.facingAngle*180.0/M_PI << std::endl;
//currentLocation->npcs[0]->walkSpeed -= 0.01f;
//std::cout << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
//logger() << "Walk speed: " << currentLocation->npcs[0]->walkSpeed << std::endl;
break;
case SDLK_p:
gameState.currentLocationName = "uni_interior";
currentLocation()->player->state.position = Eigen::Vector3f(-0.0189243, 0, -13.4314);
currentLocation()->player->setTarget(currentLocation()->player->state.position);
//std::cout << "Switched to location " << ((currentLocation == locations["location1"]) ? "1" : "2") << std::endl;
//logger() << "Switched to location " << ((currentLocation == locations["location1"]) ? "1" : "2") << std::endl;
break;
case SDLK_l:
//x = x - 1;
//std::cout << "current x: " << x << std::endl;
std::cout << "Azimuth: " << currentLocation()->state.cameraAzimuth << std::endl;
std::cout << "Inclination: " << currentLocation()->state.cameraInclination << std::endl;
//logger() << "current x: " << x << std::endl;
logger() << "Azimuth: " << currentLocation()->state.cameraAzimuth << std::endl;
logger() << "Inclination: " << currentLocation()->state.cameraInclination << std::endl;
break;
case SDLK_c:
std::cout << "SLOW-MO activated!" << std::endl;
logger() << "SLOW-MO activated!" << std::endl;
activateSlowMoEffect();
break;
case SDLK_i:
y = y - 1;
std::cout << "current y: " << y << std::endl;
logger() << "current y: " << y << std::endl;
break;
case SDLK_b:
@@ -1467,7 +1467,7 @@ namespace ZL
if (event.type == SDL_KEYUP) {
if (event.key.keysym.sym == SDLK_r) {
std::cout << "Camera position: x=" << x << " y=" << y << " z=" << z << std::endl;
logger() << "Camera position: x=" << x << " y=" << y << " z=" << z << std::endl;
}
}