diff --git a/assets/textures/concrete_tile.png b/assets/textures/concrete_tile.png new file mode 100644 index 0000000..8283c18 --- /dev/null +++ b/assets/textures/concrete_tile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a7490fa430a16abbd27972442a3bb000f07d5d7a9be57ace9d07be91b3d3c4b +size 3396975 diff --git a/src/game/Instance.h b/src/game/Instance.h index afbcb07..f1deecb 100644 --- a/src/game/Instance.h +++ b/src/game/Instance.h @@ -17,6 +17,12 @@ namespace Game Game, }; + enum class InteractionMode + { + Walk, + ReadTablet, + }; + struct Time { double Now = 0.0; @@ -44,6 +50,7 @@ namespace Game float WalkYRot = 0.0f; CameraMode CameraM = CameraMode::Freefly; InputMode InputM = InputMode::Game; + InteractionMode InteractionM = InteractionMode::Walk; float MouseSensitivity = 1.0f; float MovementSpeed = 10.0f; SavedPlayerConfig Config; diff --git a/src/game/Level.cpp b/src/game/Level.cpp index a8e9c51..e6628d2 100644 --- a/src/game/Level.cpp +++ b/src/game/Level.cpp @@ -91,7 +91,8 @@ namespace Game void UpdatePlayerInputMode() { bool IsGaming = GetInstance().Player.InputM == InputMode::Game; - SDL_SetWindowRelativeMouseMode(GetShared().Window.SDLWindow, IsGaming); + bool captureMouse = IsGaming && GetInstance().Player.InteractionM == InteractionMode::Walk; + SDL_SetWindowRelativeMouseMode(GetShared().Window.SDLWindow, captureMouse); auto& IO = ImGui::GetIO(); IO.ConfigFlags = FlagBool(IO.ConfigFlags, ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard, IsGaming); GameRendering::Get().UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug; @@ -179,6 +180,13 @@ namespace Game } TabletHandle = UIQuads.New(); UpdatePlayerInputMode(); + + { + Deserializer d; + d.Init("game/data/static/uiconfig.dat", "UICO"); + d.ReadT(GetInstance().Player.Config.TabletRenderData); + d.Finish(); + } } void Level::Update() @@ -241,6 +249,13 @@ namespace Game bx::mtxRotateXYZ(player.PlayerCamTransform.Rotation.M, player.WalkXRot, player.WalkYRot, 0.0f); } + if (GetKeyPressedNow(ScanCode::SPACE)) + { + player.InteractionM = player.InteractionM == InteractionMode::ReadTablet ? InteractionMode::Walk + : InteractionMode::ReadTablet; + UpdatePlayerInputMode(); + } + // UI Tablet if (IsValid(TabletHandle)) { @@ -300,7 +315,10 @@ namespace Game Cubes.Render(models, materials, textures); Tests.Render(models, materials, textures); PuzzleTiles.Render(models, materials, textures); - UIQuads.Render(models, materials, textures); + if (player.InteractionM == InteractionMode::ReadTablet) + { + UIQuads.Render(models, materials, textures); + } } void Cube::Setup() diff --git a/src/game/Tools.cpp b/src/game/Tools.cpp index 3c34698..f4a8f5b 100644 --- a/src/game/Tools.cpp +++ b/src/game/Tools.cpp @@ -1,3 +1,4 @@ +#include "../gen/Def.h" #include "Gen.h" #include "Global.h" #include "Instance.h" @@ -6,7 +7,6 @@ #include "Tools.h" #include "bx/filepath.h" -#include "bx/math.h" #include "bx/timer.h" #include #include @@ -233,7 +233,13 @@ namespace Tools ImGui::Separator(); ImGui::Text("Game Tablet"); - Tools::EntityDataSettings(player.Config.TabletRenderData); + if (Tools::EntityDataSettings(player.Config.TabletRenderData)) + { + Serializer s; + s.Init("game/data/static/uiconfig.dat", "UICO"); + s.WriteT(player.Config.TabletRenderData); + s.Finish(); + } ImGui::Separator(); diff --git a/src/game/data/puzzles/0.pzl b/src/game/data/puzzles/0.pzl index ac2cf50..c830284 100644 --- a/src/game/data/puzzles/0.pzl +++ b/src/game/data/puzzles/0.pzl @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdfe3c22160d79809d814dabf3e4ce06e2d217ca7c1075d9f502bf6c55a348ce +oid sha256:88cd38410c6f79e39d6df42c48b599a5b1ce93aef1d27112d3daf9881dad0df4 size 5820 diff --git a/src/game/data/static/puzzle.dat b/src/game/data/static/puzzle.dat index 7255bf7..c497ace 100644 Binary files a/src/game/data/static/puzzle.dat and b/src/game/data/static/puzzle.dat differ diff --git a/src/game/data/static/uiconfig.dat b/src/game/data/static/uiconfig.dat new file mode 100644 index 0000000..0c714de Binary files /dev/null and b/src/game/data/static/uiconfig.dat differ diff --git a/src/textures/concrete_tile.ktx b/src/textures/concrete_tile.ktx new file mode 100644 index 0000000..0133de3 --- /dev/null +++ b/src/textures/concrete_tile.ktx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d77fb232f3d7b9d2570e1cefd6c7c2bb81b91eaefd528b5fb550c54fae3ad1b1 +size 16777284