2021-12-01 20:18:19 +01:00
|
|
|
#ifndef BALLS_H_INCLUDED
|
|
|
|
#define BALLS_H_INCLUDED
|
|
|
|
|
2021-12-11 21:32:48 +01:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2022-06-01 11:09:35 +02:00
|
|
|
#include "vec2d.h"
|
|
|
|
|
2022-05-30 18:05:53 +02:00
|
|
|
class ball_face;
|
2021-12-01 20:18:19 +01:00
|
|
|
|
2022-05-30 18:05:53 +02:00
|
|
|
class ball {
|
|
|
|
public:
|
2021-12-01 20:18:19 +01:00
|
|
|
unsigned int radius;
|
2022-06-01 11:09:35 +02:00
|
|
|
vec2d position;
|
|
|
|
vec2d velocity;
|
2021-12-01 20:18:19 +01:00
|
|
|
|
|
|
|
double angle;
|
|
|
|
double v_angle;
|
|
|
|
|
2022-05-30 18:05:53 +02:00
|
|
|
ball_face * face;
|
|
|
|
|
|
|
|
void draw (cairo_t * cr) const;
|
2021-12-01 20:18:19 +01:00
|
|
|
};
|
|
|
|
|
2022-05-30 18:05:53 +02:00
|
|
|
extern ball * balls;
|
2021-12-01 20:18:19 +01:00
|
|
|
extern unsigned int n_balls;
|
|
|
|
|
2021-12-11 21:32:48 +01:00
|
|
|
extern unsigned int radius_min;
|
|
|
|
extern unsigned int radius_max;
|
|
|
|
|
|
|
|
extern unsigned int v_max;
|
|
|
|
extern unsigned int v_min;
|
|
|
|
|
|
|
|
extern unsigned int v_angle_min;
|
|
|
|
extern unsigned int v_angle_max;
|
|
|
|
|
|
|
|
extern const char * face_filename;
|
|
|
|
extern int face_rotation;
|
|
|
|
|
|
|
|
extern void balls_init ();
|
|
|
|
extern void balls_destroy ();
|
2022-05-30 18:05:53 +02:00
|
|
|
extern void ball_update_state (ball * p);
|
2022-12-27 17:54:40 +01:00
|
|
|
extern void ball_ball_collision (ball * p, ball * q);
|
2022-05-30 18:05:53 +02:00
|
|
|
extern void ball_reposition (ball * b);
|
2021-12-11 21:32:48 +01:00
|
|
|
extern void balls_draw (cairo_t * cr);
|
2021-12-01 20:18:19 +01:00
|
|
|
|
2022-12-27 17:54:40 +01:00
|
|
|
extern void restitution_coefficient_draw (cairo_t * cr);
|
|
|
|
extern void restitution_coefficient_set (double c);
|
|
|
|
extern double restitution_coefficient_get ();
|
|
|
|
extern void restitution_coefficient_change (double d);
|
|
|
|
|
2021-12-01 20:18:19 +01:00
|
|
|
#endif
|