Skip to content

Commit 0e63d6d

Browse files
committed
Only display editor shite if we want it
1 parent e77c046 commit 0e63d6d

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

Source/Mocha.Common/Input/Input.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public static partial class Input
2727
public static bool Crouch => IsKeyDown( InputButton.KeyControl );
2828
public static bool Sprint => IsKeyDown( InputButton.KeyShift );
2929

30+
public static bool IsMouseCaptured => NativeInput.IsMouseCaptured();
31+
3032
public static void Update()
3133
{
3234
//
@@ -71,5 +73,7 @@ public static void Update()
7173
// Combine, store in Direction
7274
//
7375
Direction = new Vector3( forward, right, up );
76+
Log.Info( Direction );
77+
Log.Info( Rotation );
7478
}
7579
}

Source/Mocha.Host/Misc/inputmanager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ Vector2 InputManager::GetMouseDelta()
6262
return { 0, 0 };
6363

6464
return m_inputState.mouseDelta;
65+
}
66+
67+
bool InputManager::IsMouseCaptured()
68+
{
69+
return m_inputState.isMouseCaptured;
6570
}

Source/Mocha.Host/Misc/inputmanager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ struct InputState
1414
Vector2 mousePosition;
1515
Vector2 lastMousePosition;
1616
Vector2 mouseDelta;
17+
18+
bool isMouseCaptured;
1719
};
1820

1921
class InputManager : ISubSystem
@@ -32,4 +34,5 @@ class InputManager : ISubSystem
3234
GENERATE_BINDINGS bool IsKeyDown( int key );
3335
GENERATE_BINDINGS Vector2 GetMousePosition();
3436
GENERATE_BINDINGS Vector2 GetMouseDelta();
37+
GENERATE_BINDINGS bool IsMouseCaptured();
3538
};

Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ void VulkanRenderContext::CreateImGui()
926926

927927
io.Fonts->Build();
928928

929-
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_ViewportsEnable;
929+
// io.ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_ViewportsEnable;
930930
io.ConfigViewportsNoDecoration = false;
931931
io.ConfigViewportsNoAutoMerge = true;
932932
io.ConfigDockingWithShift = true;
@@ -1048,7 +1048,7 @@ RenderStatus VulkanRenderContext::BeginImGui()
10481048
ImGui_ImplSDL2_NewFrame( m_window->GetSDLWindow() );
10491049

10501050
ImGui::NewFrame();
1051-
ImGui::DockSpaceOverViewport( nullptr, ImGuiDockNodeFlags_PassthruCentralNode );
1051+
// ImGui::DockSpaceOverViewport( nullptr, ImGuiDockNodeFlags_PassthruCentralNode );
10521052

10531053
return RENDER_STATUS_OK;
10541054
}

Source/Mocha.Host/Rendering/window.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void Window::Update()
6868

6969
// Clear mouse delta every frame
7070
inputState.mouseDelta = { 0, 0 };
71+
inputState.isMouseCaptured = m_captureMouse;
7172

7273
SDL_SetRelativeMouseMode( m_captureMouse ? SDL_TRUE : SDL_FALSE );
7374

@@ -155,7 +156,10 @@ void Window::Update()
155156
inputState.keys[scanCode] = isDown;
156157

157158
if ( kbe.keysym.scancode == SDL_SCANCODE_GRAVE && isDown )
159+
{
158160
m_captureMouse = !m_captureMouse;
161+
inputState.isMouseCaptured = m_captureMouse;
162+
}
159163
}
160164
else if ( e.type == SDL_MOUSEMOTION )
161165
{

0 commit comments

Comments
 (0)