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