app.h 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. public:
  24. application() : running(false) {};
  25. ~application() = default;
  26. void parseParameters(int argc, char *argv[]);
  27. bool isRunning() { return this->running; }
  28. void syncAndDeltatime();
  29. void setup();
  30. void input();
  31. void update();
  32. void render();
  33. void destroy();
  34. };
  35. #endif /* PHYSICENGINE_APP_H */