38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
#ifndef FIGURE_H
|
|
#define FIGURE_H
|
|
|
|
#include "geomerty.h"
|
|
|
|
enum figure_type
|
|
{
|
|
FIGURE_CIRCLE = 0,
|
|
FIGURE_TRIANGLE = 1,
|
|
FIGURE_SQUARE = 2
|
|
};
|
|
|
|
struct figure_animation_info {
|
|
enum figure_type type;
|
|
struct vec2 position;
|
|
/* Direction vector; its components are not in pixels. Anim code converts
|
|
* them to pixel-space and normalizes them so that `speed` is applied as
|
|
* pixels/sec uniformly in both axes (aspect ratio is accounted for). */
|
|
struct vec2 velocity;
|
|
|
|
float angle;
|
|
float angular_velocity;
|
|
|
|
/* Speed in pixels per second. This value is applied uniformly to both
|
|
* axes (X and Y); the animation code converts this pixel speed to
|
|
* normalized increments for position updates taking window aspect ratio
|
|
* into account. */
|
|
float speed;
|
|
/* Radius of the figure in pixels (float)
|
|
* This field is used by animation code to check collisions
|
|
* with the left/right/top/bottom borders. The animation code
|
|
* will convert this pixel radius to normalized coordinates for
|
|
* collision checks against normalized positions. */
|
|
float radius;
|
|
};
|
|
|
|
#endif
|