Main.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 "wrapper/GL.h"
  10. int main() {
  11. ENet enet;
  12. if(enet.init()) {
  13. std::cout << "cannot initialize enet\n";
  14. return 0;
  15. }
  16. Client client;
  17. if(client.hasError()) {
  18. std::cout << client.getError() << '\n';
  19. return 0;
  20. }
  21. WindowOptions options(4, 0, {1024, 620}, false, "test");
  22. TextInput* textInput = nullptr;
  23. Window w(textInput, options);
  24. if(w.getError().has()) {
  25. std::cout << w.getError().message << '\n';
  26. return 0;
  27. }
  28. Shaders shaders;
  29. if(shaders.hasError()) {
  30. return 0;
  31. }
  32. Framebuffers framebuffers;
  33. if(framebuffers.init(w.getSize())) {
  34. return 0;
  35. }
  36. RenderSettings renderSettings;
  37. Controller controller(w.getButtons());
  38. Game game(textInput, controller, w.getFrameClock(), w.getTickClock(),
  39. renderSettings, w.getSize(), client);
  40. Engine engine(shaders, framebuffers, w.getSize(), renderSettings, game);
  41. w.run(engine, 50'000'000);
  42. return 0;
  43. }