Main.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "client/input/Controller.h"
  2. #include "client/rendering/Engine.h"
  3. #include "client/rendering/Framebuffers.h"
  4. #include "client/rendering/RenderSettings.h"
  5. #include "client/rendering/Shaders.h"
  6. #include "network/Client.h"
  7. #include "network/ENet.h"
  8. #include "rendering/Window.h"
  9. #include "utils/Logger.h"
  10. #include "wrapper/GL.h"
  11. int main() {
  12. ENet enet;
  13. if(enet.init()) {
  14. LOG_ERROR("cannot initialize enet");
  15. return 0;
  16. }
  17. Client client;
  18. if(client.hasError()) {
  19. LOG_ERROR(client.getError());
  20. return 0;
  21. }
  22. WindowOptions options(4, 0, {1024, 620}, false, "test");
  23. TextInput* textInput = nullptr;
  24. Window w(textInput, options);
  25. if(w.getError().has()) {
  26. LOG_ERROR(w.getError().message);
  27. return 0;
  28. }
  29. Shaders shaders;
  30. if(shaders.hasError()) {
  31. return 0;
  32. }
  33. Framebuffers framebuffers;
  34. if(framebuffers.init(w.getSize())) {
  35. return 0;
  36. }
  37. RenderSettings renderSettings;
  38. Controller controller(w.getButtons());
  39. Game game(textInput, controller, w.getFrameClock(), w.getTickClock(),
  40. renderSettings, w.getSize(), client);
  41. Engine engine(shaders, framebuffers, w.getSize(), renderSettings, game);
  42. w.run(engine, 50'000'000);
  43. return 0;
  44. }