From 2ee288cbe00b1b391218fb438def74c1da1e92ac Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sat, 25 Apr 2026 21:17:40 +0300 Subject: [PATCH] Added full screen mode --- proj-windows/CMakeLists.txt | 8 ++++++++ src/Character.cpp | 4 ++-- src/Location.cpp | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/proj-windows/CMakeLists.txt b/proj-windows/CMakeLists.txt index 7994643..fdb6289 100644 --- a/proj-windows/CMakeLists.txt +++ b/proj-windows/CMakeLists.txt @@ -5,6 +5,10 @@ project(space-game001 LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Build option (Windows-only): when ON, the game launches in fullscreen. +# When OFF (default), it launches in a 1280x720 window like before. +option(FULLSCREEN "Launch the game in fullscreen mode" OFF) + include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/ThirdParty.cmake) # =========================================== @@ -100,6 +104,10 @@ target_compile_definitions(space-game001 PRIVATE # SHOW_PATH ) +if(FULLSCREEN) + target_compile_definitions(space-game001 PRIVATE FULLSCREEN) +endif() + # Линкуем с SDL2main, если он вообще установлен target_link_libraries(space-game001 PRIVATE SDL2main_external_lib) diff --git a/src/Character.cpp b/src/Character.cpp index c187afb..c374e5f 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -344,7 +344,7 @@ void Character::update(int64_t deltaMs) { if (isPlayer) { - if (prevFrame == 18 && static_cast(anim.currentFrame) != 18 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2)) + if (prevFrame < 19 && static_cast(anim.currentFrame) >= 19 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2)) { if (attackTarget != nullptr) { @@ -354,7 +354,7 @@ void Character::update(int64_t deltaMs) { } else { - if (prevFrame == 49 && static_cast(anim.currentFrame) != 49 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2)) + if (prevFrame < 50 && static_cast(anim.currentFrame) >= 50 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2)) { if (attackTarget != nullptr) { diff --git a/src/Location.cpp b/src/Location.cpp index e5d187c..b8a5691 100644 --- a/src/Location.cpp +++ b/src/Location.cpp @@ -147,11 +147,12 @@ namespace ZL } } +#ifndef EMSCRIPTEN // Create shadow map (2048x2048, ortho size 40, near 0.1, far 100) shadowMap = std::make_unique(2048, 40.0f, 0.1f, 100.0f); shadowMap->setLightDirection(Eigen::Vector3f(-0.5f, -1.0f, -0.3f)); std::cout << "Shadow map initialized" << std::endl; - +#endif setupNavigation(params.navigationJsonPath);