app.h 923 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * 2D Physic Engine
  3. * app.h:
  4. * Based on pikuma.com Learn Game Physics Engine Programming course.
  5. * Copyright (c) 2022 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 07/06/2022.
  8. */
  9. #ifndef PHYSICENGINE_APP_H
  10. #define PHYSICENGINE_APP_H
  11. #include <vector>
  12. #include <timeprobe.h>
  13. #include <physics/particle.h>
  14. class application
  15. {
  16. private:
  17. uint32_t millisecsPreviousFrame;
  18. bool running;
  19. std::vector<particle *>particles;
  20. timeProbe waitTime, renderTime, updateTime;
  21. double deltaTime;
  22. vec2 pushForce = vec2(0, 0);
  23. SDL_Rect liquid;
  24. public:
  25. application() : running(false) {};
  26. ~application() = default;
  27. void parseParameters(int argc, char *argv[]);
  28. bool isRunning() { return this->running; }
  29. void syncAndDeltatime();
  30. void setup();
  31. void input();
  32. void update();
  33. void render();
  34. void destroy();
  35. };
  36. #endif /* PHYSICENGINE_APP_H */