This commit is contained in:
@@ -45,6 +45,7 @@ namespace game
|
||||
|
||||
Loader::Loader(int argc, const char** argv)
|
||||
{
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
util::web_filesystem::init_and_wait();
|
||||
#endif
|
||||
@@ -83,6 +84,7 @@ namespace game
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
static constexpr glm::vec2 SIZE = {1600, 900};
|
||||
window = SDL_CreateWindow("Snivy", SIZE.x, SIZE.y, SDL_WINDOW_OPENGL);
|
||||
#else
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ namespace game
|
||||
class Loader
|
||||
{
|
||||
public:
|
||||
static constexpr glm::vec2 SIZE = {1280, 720};
|
||||
|
||||
SDL_Window* window{};
|
||||
SDL_GLContext context{};
|
||||
bool isError{};
|
||||
|
||||
@@ -20,10 +20,10 @@ namespace game::resource::xml
|
||||
};
|
||||
|
||||
util::measurement::System measurementSystem{util::measurement::METRIC};
|
||||
int volume{VOLUME_MAX};
|
||||
int volume{50};
|
||||
|
||||
glm::vec3 color{0.120f, 0.515f, 0.115f};
|
||||
glm::ivec2 windowSize{1280, 720};
|
||||
glm::ivec2 windowSize{1600, 900};
|
||||
glm::vec2 windowPosition{};
|
||||
|
||||
bool isValid{};
|
||||
|
||||
@@ -41,7 +41,9 @@ namespace game
|
||||
|
||||
void State::update()
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SDL_GetWindowSize(window, &resources.settings.windowSize.x, &resources.settings.windowSize.y);
|
||||
#endif
|
||||
|
||||
SDL_Event event;
|
||||
|
||||
@@ -92,8 +94,10 @@ namespace game
|
||||
|
||||
void State::render()
|
||||
{
|
||||
ivec2 windowSize{};
|
||||
auto windowSize = resources.settings.windowSize;
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SDL_GetWindowSize(window, &windowSize.x, &windowSize.y);
|
||||
#endif
|
||||
|
||||
canvas.bind();
|
||||
canvas.size_set(windowSize);
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace game::state
|
||||
{
|
||||
World::Focus Main::focus_get()
|
||||
{
|
||||
if (!isWindows) return World::CENTER;
|
||||
|
||||
return menu.isOpen && tools.isOpen ? World::MENU_TOOLS
|
||||
: menu.isOpen ? World::MENU
|
||||
: tools.isOpen ? World::TOOLS
|
||||
@@ -84,26 +86,28 @@ namespace game::state
|
||||
text.entry = nullptr;
|
||||
text.isEnabled = false;
|
||||
|
||||
if (auto font = character.data.menuSchema.font.get()) ImGui::GetIO().FontDefault = font;
|
||||
|
||||
if (game == NEW_GAME && dialogue.start.is_valid())
|
||||
{
|
||||
character.queue_play({.animation = dialogue.start.animation, .isInterruptible = false});
|
||||
character.tick();
|
||||
isWindows = false;
|
||||
isStart = true;
|
||||
}
|
||||
|
||||
isPostgame = saveData.isPostgame;
|
||||
|
||||
if (isPostgame)
|
||||
menu.isCheats = true;
|
||||
else
|
||||
menu.isCheats = true; //false;
|
||||
menu.isCheats = false;
|
||||
|
||||
if (game == NEW_GAME) isWindows = false;
|
||||
|
||||
if (auto font = character.data.menuSchema.font.get()) ImGui::GetIO().FontDefault = font;
|
||||
|
||||
character.play_default_animation();
|
||||
character.tick();
|
||||
worldCanvas.size_set(imgui::to_vec2(ImGui::GetMainViewport()->Size));
|
||||
|
||||
world.set(character, worldCanvas, focus_get());
|
||||
|
||||
if (game == NEW_GAME && dialogue.start.is_valid())
|
||||
{
|
||||
character.queue_play({.animation = dialogue.start.animation, .isInterruptible = false});
|
||||
character.tick();
|
||||
isStart = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Main::exit(Resources& resources)
|
||||
|
||||
@@ -91,11 +91,13 @@ namespace game::state::main
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (isDebug && WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||
#if defined(DEBUG) && DEBUG
|
||||
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||
{
|
||||
debug.update(character, cursor, itemManager, canvas);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace game::state::main
|
||||
state::Configuration configuration;
|
||||
|
||||
bool isCheats{true};
|
||||
bool isDebug{true};
|
||||
bool isOpen{true};
|
||||
bool isChat{true};
|
||||
util::imgui::WindowSlide slide{};
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace game::state::main
|
||||
void World::set(entity::Character& character, Canvas& canvas, Focus focus)
|
||||
{
|
||||
character.stage = character.stage_get();
|
||||
character.queue_idle_animation();
|
||||
character_focus(character, canvas, focus);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user