#ifndef H_SDL_PROJECTILE
#define H_SDL_PROJECTILE

#include "init_sdl.h"
#include "../constantes.h"

/* Defines for window's size */
#define WIN_PROJECTILE_HEIGHT 712
#define WIN_PROJECTILE_WIDTH 1024

#define SCALE 10

/* Structure used for thread args */
struct thread_projectile_args{
  struct window window;
  struct projectile *projectile;
  const struct object *planet;
  SDL_Rect rectObject;
  SDL_Rect *rectInfos;
  SDL_Surface **sInfos;
  int debug;
};

struct projectile{
	SDL_Texture *t;
	SDL_Surface *s;
	SDL_Rect rect;
	int x;				   /* Position in x */
	int y;				   /* Position in y */
	double v0x;      /* Vitesse initiale x */
	double v0y;      /* Vitesse initiale y */
  int masse;		   /* Projectile's masse */
	int height;
	int width;
  int alpha;       /* Angle in degree */
  double deltat;   /* Delta t */
  double distance; /* Distance */
  double hmax;     /* Max height */
};

enum stateProjectile{
	LAUNCH = 0,
	STOP = 1,
	LANDING = 2
};

static void initProjectile(struct window *, struct projectile *);
static void initInfos(TTF_Font *, SDL_Rect *, const SDL_Surface *, int, int);
static void drawCelestialObject(const struct window, const SDL_Rect);
static void drawText(const struct window, const SDL_Rect, SDL_Surface *);
static void drawGrid(const struct window);
static void drawObjects(const struct window, const struct projectile *, const SDL_Rect, const SDL_Rect*, SDL_Surface**);
static int run(void *);
void handleProjectile(struct projectile*, const struct object *, int);
static void cleanProjectile(struct window *, struct projectile *);

#endif