GameClient.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef CLIENT_H
  2. #define CLIENT_H
  3. // these two are not needed here but prevent further errors
  4. #include <GL/glew.h>
  5. #include <GLFW/glfw3.h>
  6. #include "client/engine/KeyManager.h"
  7. #include "client/engine/MouseManager.h"
  8. #include "client/engine/Clock.h"
  9. #include "client/engine/Shader.h"
  10. #include "client/engine/DirectRenderer.h"
  11. #include "client/rendering/gui/GUIs.h"
  12. #include "client/rendering/gui/GUI.h"
  13. #include "common/world/IChunkProvider.h"
  14. using namespace std;
  15. class GameClient : public IClient
  16. {
  17. public:
  18. GameClient();
  19. virtual ~GameClient();
  20. void tick() override;
  21. void render3DTick(float lag) override;
  22. void render2DTick(float lag) override;
  23. void onKeyEvent(int key, int scancode, int action, int mods) override;
  24. void onMouseMove(double x, double y) override;
  25. void onMouseClick(int button, int action, int mods) override;
  26. private:
  27. double transformMouse(double in);
  28. static const int KEY_LEFT = 0;
  29. static const int KEY_RIGHT = 1;
  30. static const int KEY_UP = 2;
  31. static const int KEY_DOWN = 3;
  32. static const int KEY_JUMP = 4;
  33. static const int KEY_SNEAK = 5;
  34. static const int KEY_TEST = 10;
  35. static const int MOUSE_LEFT = 0;
  36. double oldMouseX = 0;
  37. double oldMouseY = 0;
  38. double diffMouseX = 0;
  39. double diffMouseY = 0;
  40. bool mouseTrapped = true;
  41. const double MOUSE_BORDER = 1.0;
  42. Clock tps;
  43. Clock fps;
  44. KeyManager keyManager;
  45. MouseManager mouseManager;
  46. Shader shader;
  47. DirectRenderer directRenderer;
  48. GUI* activeGUI = nullptr;
  49. };
  50. #endif