
#ifndef PAD_HH_
#define PAD_HH_

#include "../factory/chord.h"
#include "../factory/coord.h"
#include "../factory/particle.h"
#include "../factory/surface.h"
#include "../factory/vertex.h"

#define PAD_COUNT_SOUND		3

#define PAD_DELAY_CANCEL	500.0f
#define PAD_DELAY_EFFECT	100.0f
#define PAD_DELAY_LOAD		2500.0f

#define PAD_FACTOR_LENGTH   0.001f
#define PAD_FACTOR_POWER	0.00001f
#define PAD_FACTOR_SOUND	1.0f

#define PAD_QUADRIC_SLICE	16

#define PAD_SIZE_EPSILON	0.1f
#define PAD_SIZE_LENGTH		0.75f
#define PAD_SIZE_RADIUS		0.5f

struct	s_ball_list;

enum	e_pad_sound
{
	PAD_SOUND_BALL,
	PAD_SOUND_LOAD,
	PAD_SOUND_RELEASE
};

enum	e_pad_state
{
	PAD_STATE_CANCEL,
	PAD_STATE_LOAD,
	PAD_STATE_READY,
	PAD_STATE_RELEASE
};

struct	s_pad
{
	struct s_coord		coord;
	char				length_change;
	float				length_effect;
	unsigned int		length_factor;
	float				length;
	struct s_particle*	particle;
	GLUquadricObj*		quadric;
	unsigned int		sound[PAD_COUNT_SOUND];
	float				state_effect;
	float				state_time;
	enum e_pad_state	state;
	GLuint				texture;
	float				x1;
	float				x2;
	float				x;
};

void	pad_define (struct s_pad*, struct s_particle*, struct s_surface*, GLUquadricObj*, float, float, float);
void	pad_draw (struct s_pad*);
void	pad_length (struct s_pad*, char);
void	pad_loop (struct s_pad*, struct s_ball_list*);
void	pad_move (struct s_pad*);
float   pad_release (struct s_pad*);

#endif
