#ifndef JAM_HPP
#define JAM_HPP

#include "Hit.hpp"

#include "Image.hpp"

#include <Basis/Screen.hpp>
#include <Vector/Box.hpp>

#include <vector>

using std::vector;

class Time {
public:
	Box2f box;
	unsigned int beats;
	vector< Hit > hits;
};

class Jam : public Screen {
public:
	Jam();
	virtual ~Jam();
	virtual void update(float elapsed_time);
	virtual void handle_event(SDL_Event const &event);
	virtual void draw();

	Box2f get_image_box(unsigned int i);

	vector< Image * > images;

	unsigned int samples_per_beat;

	//parameters (floating-point versions of those in live_plate):
	float K_amt;
	float D_amt;
	float gain_amt;

	//interface-y stuff:
	float image_scroll;
	unsigned int image_scroll_target;

	Hit *close_hit;
	bool close_hit_dirty;

	bool hits_dirty; //i.e. we need to sync with LivePlate thread.

	Box2f *drag_box; //for dragging sliders & such.

	//mouse:
	Vector2f mouse;

	//layout:
	Box2f main_box;
	Box2f plate_box;
	vector< Time > times;
	Box2f params_box;
	Box2f gain_box;
	Box2f reset_box;
	Box2f images_box;

	//for auto-reset, demo mode:
	float loud_acc;
	float bored_acc;
	bool demo_mode;
	float demo_mode_image_switch;
	float demo_mode_hits;
	float demo_mode_setting_swap;
	unsigned int demo_mode_setting;

	void reset();
};

#endif //JAM_HPP
