Compare commits
2 Commits
5a3739db0a
...
12c546b6dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12c546b6dc | ||
|
|
ae069c4949 |
BIN
assets/textures/concrete_tile.png
LFS
Normal file
BIN
assets/textures/concrete_tile.png
LFS
Normal file
Binary file not shown.
@@ -17,6 +17,12 @@ namespace Game
|
|||||||
Game,
|
Game,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class InteractionMode
|
||||||
|
{
|
||||||
|
Walk,
|
||||||
|
ReadTablet,
|
||||||
|
};
|
||||||
|
|
||||||
struct Time
|
struct Time
|
||||||
{
|
{
|
||||||
double Now = 0.0;
|
double Now = 0.0;
|
||||||
@@ -44,6 +50,7 @@ namespace Game
|
|||||||
float WalkYRot = 0.0f;
|
float WalkYRot = 0.0f;
|
||||||
CameraMode CameraM = CameraMode::Freefly;
|
CameraMode CameraM = CameraMode::Freefly;
|
||||||
InputMode InputM = InputMode::Game;
|
InputMode InputM = InputMode::Game;
|
||||||
|
InteractionMode InteractionM = InteractionMode::Walk;
|
||||||
float MouseSensitivity = 1.0f;
|
float MouseSensitivity = 1.0f;
|
||||||
float MovementSpeed = 10.0f;
|
float MovementSpeed = 10.0f;
|
||||||
SavedPlayerConfig Config;
|
SavedPlayerConfig Config;
|
||||||
|
|||||||
@@ -91,7 +91,8 @@ namespace Game
|
|||||||
void UpdatePlayerInputMode()
|
void UpdatePlayerInputMode()
|
||||||
{
|
{
|
||||||
bool IsGaming = GetInstance().Player.InputM == InputMode::Game;
|
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();
|
auto& IO = ImGui::GetIO();
|
||||||
IO.ConfigFlags = FlagBool(IO.ConfigFlags, ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard, IsGaming);
|
IO.ConfigFlags = FlagBool(IO.ConfigFlags, ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard, IsGaming);
|
||||||
GameRendering::Get().UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug;
|
GameRendering::Get().UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug;
|
||||||
@@ -179,6 +180,13 @@ namespace Game
|
|||||||
}
|
}
|
||||||
TabletHandle = UIQuads.New();
|
TabletHandle = UIQuads.New();
|
||||||
UpdatePlayerInputMode();
|
UpdatePlayerInputMode();
|
||||||
|
|
||||||
|
{
|
||||||
|
Deserializer d;
|
||||||
|
d.Init("game/data/static/uiconfig.dat", "UICO");
|
||||||
|
d.ReadT(GetInstance().Player.Config.TabletRenderData);
|
||||||
|
d.Finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::Update()
|
void Level::Update()
|
||||||
@@ -241,6 +249,13 @@ namespace Game
|
|||||||
bx::mtxRotateXYZ(player.PlayerCamTransform.Rotation.M, player.WalkXRot, player.WalkYRot, 0.0f);
|
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
|
// UI Tablet
|
||||||
if (IsValid(TabletHandle))
|
if (IsValid(TabletHandle))
|
||||||
{
|
{
|
||||||
@@ -300,8 +315,11 @@ namespace Game
|
|||||||
Cubes.Render(models, materials, textures);
|
Cubes.Render(models, materials, textures);
|
||||||
Tests.Render(models, materials, textures);
|
Tests.Render(models, materials, textures);
|
||||||
PuzzleTiles.Render(models, materials, textures);
|
PuzzleTiles.Render(models, materials, textures);
|
||||||
|
if (player.InteractionM == InteractionMode::ReadTablet)
|
||||||
|
{
|
||||||
UIQuads.Render(models, materials, textures);
|
UIQuads.Render(models, materials, textures);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Cube::Setup()
|
void Cube::Setup()
|
||||||
{
|
{
|
||||||
@@ -353,9 +371,14 @@ namespace Game
|
|||||||
UpdateMatrix(camTransform);
|
UpdateMatrix(camTransform);
|
||||||
Vec3 cameraPos = camTransform.Position;
|
Vec3 cameraPos = camTransform.Position;
|
||||||
|
|
||||||
|
Vec2 uiOffset = Vec2{static_cast<float>(Data.WidthTiles / Puzzle::Config::CardSize - 1),
|
||||||
|
static_cast<float>(Data.HeightTiles / Puzzle::Config::CardSize) - 1};
|
||||||
|
uiOffset *= -UICardOffset * 0.5f;
|
||||||
|
|
||||||
Transform& boardTransform = level.UIQuads.Get(level.TabletHandle).EData.Transform;
|
Transform& boardTransform = level.UIQuads.Get(level.TabletHandle).EData.Transform;
|
||||||
Transform tileOriginTransform = boardTransform;
|
Transform tileOriginTransform = boardTransform;
|
||||||
tileOriginTransform.Position += AxisForward(camTransform.M) * -0.01f;
|
tileOriginTransform.Position += AxisForward(camTransform.M) * -0.01f;
|
||||||
|
TranslateLocal(tileOriginTransform, Vec3{uiOffset.x, 0.0f, uiOffset.y} * 1.0f);
|
||||||
UpdateMatrix(tileOriginTransform);
|
UpdateMatrix(tileOriginTransform);
|
||||||
|
|
||||||
Vec2 mousePos = GetMousePos();
|
Vec2 mousePos = GetMousePos();
|
||||||
@@ -384,7 +407,7 @@ namespace Game
|
|||||||
|
|
||||||
bool isValid = Puzzle::IsValid(card.RefCard);
|
bool isValid = Puzzle::IsValid(card.RefCard);
|
||||||
|
|
||||||
// Tile
|
// World Tile
|
||||||
tile.EData.Visible = true;
|
tile.EData.Visible = true;
|
||||||
tile.EData.ModelH = isValid ? staticCards[card.RefCard.Idx].ModelHandle : staticCards[0].ModelHandle;
|
tile.EData.ModelH = isValid ? staticCards[card.RefCard.Idx].ModelHandle : staticCards[0].ModelHandle;
|
||||||
tile.EData.DotColor = visuals.TileDotColor;
|
tile.EData.DotColor = visuals.TileDotColor;
|
||||||
@@ -402,7 +425,7 @@ namespace Game
|
|||||||
tile.EData.Transform.Position = cardPos;
|
tile.EData.Transform.Position = cardPos;
|
||||||
bx::mtxRotateY(tile.EData.Transform.Rotation.M, card.Rotation * bx::kPi * 0.5f);
|
bx::mtxRotateY(tile.EData.Transform.Rotation.M, card.Rotation * bx::kPi * 0.5f);
|
||||||
|
|
||||||
// Quad
|
// UI Quad
|
||||||
quad.EData.Visible = isValid;
|
quad.EData.Visible = isValid;
|
||||||
quad.EData.TextureHandle =
|
quad.EData.TextureHandle =
|
||||||
isValid ? staticCards[card.RefCard.Idx].BoardTextureHandle : Gen::TextureHandle{};
|
isValid ? staticCards[card.RefCard.Idx].BoardTextureHandle : Gen::TextureHandle{};
|
||||||
@@ -412,8 +435,7 @@ namespace Game
|
|||||||
quad.EData.Transform.Position = tileOriginTransform.Position;
|
quad.EData.Transform.Position = tileOriginTransform.Position;
|
||||||
quad.EData.Transform.Rotation = camTransform.Rotation;
|
quad.EData.Transform.Rotation = camTransform.Rotation;
|
||||||
TranslateLocal(quad.EData.Transform,
|
TranslateLocal(quad.EData.Transform,
|
||||||
Vec3{(float)card.Position.X, (float)card.Position.Y, 0.0f} * UICardOffset *
|
Vec3{(float)card.Position.X, (float)card.Position.Y, 0.0f} * UICardOffset * UICardScale);
|
||||||
0.1f); // no clue where the 0.1 comes from
|
|
||||||
Rotate(quad.EData.Transform, Vec3{bx::kPi * 0.5f, 0.0f, (1.0f - card.Rotation * 0.5f) * bx::kPi});
|
Rotate(quad.EData.Transform, Vec3{bx::kPi * 0.5f, 0.0f, (1.0f - card.Rotation * 0.5f) * bx::kPi});
|
||||||
quad.EData.Transform.Scale = {UICardScale, UICardScale, UICardScale};
|
quad.EData.Transform.Scale = {UICardScale, UICardScale, UICardScale};
|
||||||
|
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ namespace Game
|
|||||||
struct WorldPuzzle
|
struct WorldPuzzle
|
||||||
{
|
{
|
||||||
static constexpr Gen::Vec2 WorldCardSize{10.0f, 10.0f};
|
static constexpr Gen::Vec2 WorldCardSize{10.0f, 10.0f};
|
||||||
static constexpr float UICardOffset = 0.21f;
|
static constexpr float UICardScale = 0.05f;
|
||||||
static constexpr float UICardScale = 0.1f;
|
static constexpr float UICardOffset = 2.1f * UICardScale;
|
||||||
Gen::PuzzleData Data;
|
Gen::PuzzleData Data;
|
||||||
Gen::Vec3 WorldPosition;
|
Gen::Vec3 WorldPosition;
|
||||||
PuzzleTileEntityHandle TileHandles[Puzzle::Config::MaxCardsInPuzzle];
|
PuzzleTileEntityHandle TileHandles[Puzzle::Config::MaxCardsInPuzzle];
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "../gen/Def.h"
|
||||||
#include "Gen.h"
|
#include "Gen.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
@@ -6,7 +7,6 @@
|
|||||||
#include "Tools.h"
|
#include "Tools.h"
|
||||||
|
|
||||||
#include "bx/filepath.h"
|
#include "bx/filepath.h"
|
||||||
#include "bx/math.h"
|
|
||||||
#include "bx/timer.h"
|
#include "bx/timer.h"
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <tracy/Tracy.hpp>
|
#include <tracy/Tracy.hpp>
|
||||||
@@ -233,7 +233,13 @@ namespace Tools
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Text("Game Tablet");
|
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();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|||||||
BIN
src/game/data/puzzles/0.pzl
LFS
BIN
src/game/data/puzzles/0.pzl
LFS
Binary file not shown.
Binary file not shown.
BIN
src/game/data/static/uiconfig.dat
Normal file
BIN
src/game/data/static/uiconfig.dat
Normal file
Binary file not shown.
BIN
src/textures/concrete_tile.ktx
LFS
Normal file
BIN
src/textures/concrete_tile.ktx
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user