mirror of
https://github.com/ApfelTeeSaft/ScuffedMinecraft.git
synced 2026-08-26 19:33:33 +00:00
Check desc
Removed my Stupid ass Variable Defined Menu Bool as extern in a new Header Now blocking all input when pressing Escape (even movement)
This commit is contained in:
@@ -177,6 +177,7 @@
|
||||
<ClCompile Include="vendor\imgui\imgui_widgets.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Application.h" />
|
||||
<ClInclude Include="src\Block.h" />
|
||||
<ClInclude Include="src\Blocks.h" />
|
||||
<ClInclude Include="src\Camera.h" />
|
||||
|
||||
@@ -152,6 +152,9 @@
|
||||
<ClInclude Include="src\ChunkData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Application.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="assets\shaders\main_vert.glsl" />
|
||||
|
||||
@@ -32,7 +32,6 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos);
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
|
||||
|
||||
bool inEscMenu = false;
|
||||
float deltaTime = 0.0f;
|
||||
float lastFrame = 0.0f;
|
||||
int fpsCount = 0;
|
||||
@@ -565,7 +564,6 @@ void processInput(GLFWwindow* window)
|
||||
escapeDown = true;
|
||||
menuMode = !menuMode;
|
||||
glfwSetInputMode(window, GLFW_CURSOR, menuMode ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED);
|
||||
inEscMenu = menuMode;
|
||||
firstMouse = true;
|
||||
//glfwSetWindowShouldClose(window, true);
|
||||
}
|
||||
@@ -605,7 +603,7 @@ void processInput(GLFWwindow* window)
|
||||
|
||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
if (inEscMenu) return;
|
||||
if (menuMode) return;
|
||||
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
|
||||
{
|
||||
auto result = Physics::Raycast(camera.Position, camera.Front, 5);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
extern bool menuMode;
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Camera.h"
|
||||
#include "Application.h"
|
||||
|
||||
Camera::Camera(glm::vec3 position, glm::vec3 up, float yaw, float pitch) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), MovementSpeed(SPEED), MouseSensitivity(SENSITIVITY), Zoom(ZOOM)
|
||||
{
|
||||
@@ -28,6 +29,7 @@ glm::mat4 Camera::GetViewMatrix()
|
||||
// processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)
|
||||
void Camera::ProcessKeyboard(Camera_Movement direction, float deltaTime)
|
||||
{
|
||||
if (menuMode) return;
|
||||
float velocity = MovementSpeed * deltaTime;
|
||||
if (direction == FORWARD)
|
||||
Position += Front * velocity;
|
||||
|
||||
Reference in New Issue
Block a user