Small fix
This commit is contained in:
parent
587ce37b75
commit
9339e572a0
|
@ -10,8 +10,6 @@ void Game::onCreate(int screenW, int screenH)
|
|||
isCreativeCamera = true;
|
||||
|
||||
updateWindowMetrics(screenW, screenH);
|
||||
|
||||
//create 2D renderer
|
||||
renderer2d.create();
|
||||
|
||||
font.createFromFile(RESOURCES_PATH "roboto_black.ttf");
|
||||
|
@ -21,9 +19,6 @@ void Game::onCreate(int screenW, int screenH)
|
|||
|
||||
chunkManager.setGridSize(10, glm::vec2{camera->getPosition().x, camera->getPosition().z});
|
||||
|
||||
//std::cout << chunkManager.bottomCorner.x << " " << chunkManager.bottomCorner.y << "\n";
|
||||
//std::cout << chunkManager.topCorner.x << " " << chunkManager.topCorner.y << "\n";
|
||||
|
||||
arrowTexture.loadFromFile(RESOURCES_PATH "arrow.png");
|
||||
|
||||
skyBox.create();
|
||||
|
@ -134,10 +129,6 @@ void Game::onUpdate(float deltaTime, const GameInput &input)
|
|||
camera->getViewDirection()))
|
||||
{
|
||||
auto b = chunkManager.getBlockRaw(rayEnd);
|
||||
if(b)
|
||||
{
|
||||
//std::cout << *b << "\n";
|
||||
}
|
||||
|
||||
if(input.getKey(GameInput::RIGHT_CLICK).isReleased())
|
||||
{
|
||||
|
|
50
src/main.cpp
50
src/main.cpp
|
@ -18,7 +18,7 @@
|
|||
|
||||
GameInput input;
|
||||
|
||||
void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
|
||||
auto setKey = [&action](GameInput::keys k)
|
||||
|
@ -28,10 +28,10 @@ void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods
|
|||
input.setKeyPress(k);
|
||||
}
|
||||
else
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(k);
|
||||
}
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(k);
|
||||
}
|
||||
};
|
||||
|
||||
if (key == GLFW_KEY_W || key == GLFW_KEY_UP)
|
||||
|
@ -80,7 +80,7 @@ void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods
|
|||
}
|
||||
};
|
||||
|
||||
void mouseCallback(GLFWwindow* window, int key, int action, int mods)
|
||||
void mouseCallback(GLFWwindow *window, int key, int action, int mods)
|
||||
{
|
||||
|
||||
if (key == GLFW_MOUSE_BUTTON_LEFT)
|
||||
|
@ -90,10 +90,10 @@ void mouseCallback(GLFWwindow* window, int key, int action, int mods)
|
|||
input.setKeyPress(GameInput::LEFT_CLICK);
|
||||
}
|
||||
else
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(GameInput::LEFT_CLICK);
|
||||
}
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(GameInput::LEFT_CLICK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -104,15 +104,15 @@ void mouseCallback(GLFWwindow* window, int key, int action, int mods)
|
|||
input.setKeyPress(GameInput::RIGHT_CLICK);
|
||||
}
|
||||
else
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(GameInput::RIGHT_CLICK);
|
||||
}
|
||||
if (action == GLFW_RELEASE)
|
||||
{
|
||||
input.setKeyRelease(GameInput::RIGHT_CLICK);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void windowFocusCallback(GLFWwindow* window, int focused)
|
||||
void windowFocusCallback(GLFWwindow *window, int focused)
|
||||
{
|
||||
if (!focused)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ void windowFocusCallback(GLFWwindow* window, int focused)
|
|||
}
|
||||
}
|
||||
|
||||
void windowSizeCallback(GLFWwindow* window, int x, int y)
|
||||
void windowSizeCallback(GLFWwindow *window, int x, int y)
|
||||
{
|
||||
|
||||
input.resetInputsToZero();
|
||||
|
@ -132,13 +132,13 @@ int main()
|
|||
#ifdef PLATFORM_WIN32
|
||||
#ifdef _MSC_VER
|
||||
#if INTERNAL_BUILD
|
||||
{
|
||||
AllocConsole();
|
||||
auto f1 = freopen("conin$", "r", stdin);
|
||||
auto f2 = freopen("conout$", "w", stdout);
|
||||
auto f3 = freopen("conout$", "w", stderr);
|
||||
std::cout.sync_with_stdio();
|
||||
}
|
||||
{
|
||||
AllocConsole();
|
||||
auto f1 = freopen("conin$", "r", stdin);
|
||||
auto f2 = freopen("conout$", "w", stdout);
|
||||
auto f3 = freopen("conout$", "w", stderr);
|
||||
std::cout.sync_with_stdio();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -177,11 +177,11 @@ int main()
|
|||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
#pragma region movement
|
||||
#pragma region movement
|
||||
long newTime = clock();
|
||||
float deltaTime = (float)(newTime - lastTime) / CLOCKS_PER_SEC;
|
||||
lastTime = clock();
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
double xMouse, yMouse;
|
||||
glfwGetCursorPos(wind, &xMouse, &yMouse);
|
||||
|
|
Loading…
Reference in New Issue