Working on minor stuff, arts, settings, cutscenes
This commit is contained in:
1 parent
5516d02e2c
commit
f7e63f933b
31 files changed
+237
-1881
No files matched your search
+24
-5
@@ -1,5 +1,6 @@
|
||||
#include "Game.h"
|
||||
#include "Environment.h"
|
||||
#include "utils/Utils.h"
|
||||
#include <iostream>
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
@@ -85,6 +86,8 @@ EM_BOOL onWindowResized(int /*eventType*/, const EmscriptenUiEvent* e, void* /*u
|
||||
}
|
||||
|
||||
EM_BOOL onFullscreenChanged(int /*eventType*/, const EmscriptenFullscreenChangeEvent* e, void* /*userData*/) {
|
||||
ZL::Environment::isFullscreen = e->isFullscreen;
|
||||
|
||||
// Вместо window.innerWidth, попробуйте запросить размер целевого элемента
|
||||
// так как после перехода в FS именно он растягивается на весь экран.
|
||||
double clientW, clientH;
|
||||
@@ -245,11 +248,27 @@ int main(int argc, char *argv[]) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
||||
#ifdef FULLSCREEN
|
||||
const Uint32 windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
#else
|
||||
const Uint32 windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE;
|
||||
#endif
|
||||
// Read the persisted fullscreen preference (if any) before creating the
|
||||
// window, so it opens directly in the right mode instead of flashing
|
||||
// windowed -> fullscreen once settings are loaded later during setupPart2().
|
||||
{
|
||||
const std::string settingsContent = ZL::readTextFile("settings.json");
|
||||
if (!settingsContent.empty()) {
|
||||
try {
|
||||
const nlohmann::json settingsRoot = nlohmann::json::parse(settingsContent);
|
||||
if (settingsRoot.contains("fullscreen")) {
|
||||
ZL::Environment::isFullscreen = settingsRoot["fullscreen"].get<bool>();
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "[settings] Failed to parse settings.json: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE;
|
||||
if (ZL::Environment::isFullscreen) {
|
||||
windowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
}
|
||||
|
||||
ZL::Environment::window = SDL_CreateWindow(
|
||||
"Shadow Over Bishkek",
|
||||
|
||||
Reference in new issue
Block a user