Added full screen mode

This commit is contained in:
Vladislav Khorev 2026-04-25 21:17:40 +03:00
parent 348aa632dd
commit 2ee288cbe0
3 changed files with 12 additions and 3 deletions

View File

@ -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)

View File

@ -344,7 +344,7 @@ void Character::update(int64_t deltaMs) {
if (isPlayer)
{
if (prevFrame == 18 && static_cast<int>(anim.currentFrame) != 18 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2))
if (prevFrame < 19 && static_cast<int>(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<int>(anim.currentFrame) != 49 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2))
if (prevFrame < 50 && static_cast<int>(anim.currentFrame) >= 50 && (currentState == AnimationState::ACTION_ATTACK || currentState == AnimationState::ACTION_ATTACK_2))
{
if (attackTarget != nullptr)
{

View File

@ -147,11 +147,12 @@ namespace ZL
}
}
#ifndef EMSCRIPTEN
// Create shadow map (2048x2048, ortho size 40, near 0.1, far 100)
shadowMap = std::make_unique<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;
#endif
setupNavigation(params.navigationJsonPath);