feat: add trail
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
#define GFX_UTILS_HPP
|
||||
#include <SDL3/SDL_render.h>
|
||||
|
||||
namespace gfx {
|
||||
void draw_circle(SDL_Renderer *renderer, int center_x, int center_y, int radius, bool fill);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
#ifndef SIMS_HPP
|
||||
#define SIMS_HPP
|
||||
#include <SDL3/SDL_render.h>
|
||||
#define SIMS_HPP
|
||||
|
||||
namespace sims {
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
int r;
|
||||
} body;
|
||||
void two_bodies(SDL_Renderer *r);
|
||||
}
|
||||
#include <SDL3/SDL_render.h>
|
||||
#include <utility>
|
||||
|
||||
class Body {
|
||||
private:
|
||||
float x;
|
||||
float y;
|
||||
float vx = 1;
|
||||
float vy = 1;
|
||||
std::pair<float, float> old_positions[100];
|
||||
|
||||
public:
|
||||
SDL_Renderer* renderer;
|
||||
|
||||
Body(int x_pos, int y_pos);
|
||||
|
||||
void draw_tail();
|
||||
void live();
|
||||
};
|
||||
|
||||
void two_bodies(SDL_Renderer* r, Body &a, Body &b);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user