Small fix

This commit is contained in:
itqop 2024-05-15 13:35:20 +03:00
parent 9019f9c299
commit 07cc872b05
1 changed files with 23 additions and 7 deletions

View File

@ -2,7 +2,12 @@
#include "gl2d/gl2d.h" #include "gl2d/gl2d.h"
#include <glad/glad.h> #include <glad/glad.h>
#include "shader.h"
#include "camera.h"
#include "glm/vec2.hpp" #include "glm/vec2.hpp"
#include <texture.h>
#include "renderer.h"
#include "skyBox.h"
class GameInput class GameInput
@ -46,9 +51,9 @@ public:
} }
}; };
enum keys enum keys
{ {
FRONT, FRONT,
BACK, BACK,
LEFT, LEFT,
RIGHT, RIGHT,
@ -63,7 +68,7 @@ public:
Button getKey(int k) const Button getKey(int k) const
{ {
if (k < 0 || k >= BUTTONS_COUNT) if(k < 0 || k >= BUTTONS_COUNT)
{ {
return Button{}; return Button{};
} }
@ -71,7 +76,7 @@ public:
return buttons[k]; return buttons[k];
} }
void setKeyPress(int k) void setKeyPress(int k)
{ {
if (k < 0 || k >= BUTTONS_COUNT) if (k < 0 || k >= BUTTONS_COUNT)
{ {
@ -94,7 +99,7 @@ public:
void resetInputsThisFrame() void resetInputsThisFrame()
{ {
for (int i = 0; i < BUTTONS_COUNT; i++) for(int i=0; i< BUTTONS_COUNT; i++)
{ {
buttons[i].resetInput(); buttons[i].resetInput();
} }
@ -138,14 +143,15 @@ private:
}; };
class Game class Game
{ {
public: public:
Game(int screenW, int screenH) { onCreate(screenW, screenH); } Game(int screenW, int screenH) { onCreate(screenW, screenH); }
~Game() { onDestroy(); } ~Game() { onDestroy(); }
void onUpdate(float deltaTime, const GameInput& input); void onUpdate(float deltaTime, const GameInput &input);
void updateWindowMetrics(int screenW, int screenH); void updateWindowMetrics(int screenW, int screenH);
@ -160,5 +166,15 @@ private:
gl2d::Font font; gl2d::Font font;
int screenW, screenH; int screenW, screenH;
Camera *camera = 0;
bool isCreativeCamera = 0;
ChunksRenderer renderer;
ChunkManager chunkManager;
gl2d::Texture arrowTexture;
SkyBox skyBox;
}; };