Client.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef CLIENT_H
  2. #define CLIENT_H
  3. #include "../engine/Wrapper.h"
  4. #include "../engine/KeyManager.h"
  5. #include "../engine/MouseManager.h"
  6. #include "../engine/Clock.h"
  7. #include "../engine/Shader.h"
  8. #include "../engine/DirectRenderer.h"
  9. #include "../math/Camera3D.h"
  10. #include "../world/World.h"
  11. #include "../world/IChunkProvider.h"
  12. #include "rendering/ClientChunkProvider.h"
  13. #include "rendering/ChunkRenderer.h"
  14. using namespace std;
  15. class Client : public IClient
  16. {
  17. public:
  18. Client();
  19. virtual ~Client();
  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 onMouseClick(int button, int action, int mods) override;
  25. private:
  26. static const int KEY_LEFT = 0;
  27. static const int KEY_RIGHT = 1;
  28. static const int KEY_UP = 2;
  29. static const int KEY_DOWN = 3;
  30. static const int KEY_JUMP = 4;
  31. static const int KEY_SNEAK = 5;
  32. static const int KEY_CAM_LEFT = 6;
  33. static const int KEY_CAM_RIGHT = 7;
  34. static const int KEY_CAM_UP = 8;
  35. static const int KEY_CAM_DOWN = 9;
  36. static const int KEY_CAM_TEST = 10;
  37. static const int MOUSE_LEFT = 0;
  38. Clock tps;
  39. Clock fps;
  40. KeyManager keyManager;
  41. MouseManager mouseManager;
  42. ChunkRenderer chunkRenderer;
  43. ClientChunkProvider chunkProvider;
  44. World world;
  45. Camera3D camera;
  46. Shader shader;
  47. DirectRenderer directRenderer;
  48. Vector3D position;
  49. float lengthAngle = 0;
  50. float widthAngle = 0;
  51. };
  52. #endif