1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * 2D Physic Engine
- * app.h:
- * Based on pikuma.com Learn Game Physics Engine Programming course.
- * Copyright (c) 2022 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 07/06/2022.
- */
- #ifndef PHYSICENGINE_APP_H
- #define PHYSICENGINE_APP_H
- #include <vector>
- #include <SDL.h>
- #include <timeprobe.h>
- #include <physics/particle.h>
- class application
- {
- private:
- uint32_t millisecsPreviousFrame;
- bool running;
- std::vector<particle *>particles;
- timeProbe waitTime, renderTime, updateTime;
- double deltaTime;
- vec2 pushForce = vec2(0, 0);
- vec2 mouseCursor;
- vec2 anchor;
- double k = 100;
- double restLenght = 400;
- const double G = 0.00000000006674;
- bool leftButtonPressed;
- /* debug */
- bool showVelocity = false;
- bool showForceSum = false;
- bool showAllForces = false;
- public:
- application() : running(false), leftButtonPressed(false) {};
- ~application() = default;
- void parseParameters(int argc, char *argv[]);
- bool isRunning() { return this->running; }
- void syncAndDeltatime();
- void setup();
- void input();
- void update();
- void render();
- void destroy();
- };
- #endif /* PHYSICENGINE_APP_H */
|