//	World7.h - One of the worlds.
//  ----------------------------------------------------------------------------
//	This file is part of 'NiallsAVLib', base code for any kind of audiovisual
//	apps.
//	Copyright (C) 2012  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#ifndef World7_H_
#define World7_H_

#include "World.h"
#include "CircleDetector.h"

///	One of the worlds.
class World7 : public World
{
  public:
	///	Constructor.
	World7();
	///	Destructor.
	~World7();

	///	Handles mouse input for this world.
	void mouseMove(const TwoFloats& pos);
	///	Returns true when it's time to move to the next world.
	bool worldDone() {return done;};
  private:
	///	Called for every draw frame.
	void subclassTick();

	///	Helper method. Calculates the colours according to the mouse position.
	void calcColours();

	///	Which ring we're currently acting on.
	int currentRing;

	///	The latest mouse position.
	TwoFloats mousePos;

	///	The position of the correct colours.
	TwoFloats correctPos;
	///	The colours after being corrected.
	ThreeFloats correctedColours[3];

	///	The various outer colours.
	ThreeFloats outerCols[2][3];

	///	Used to move the middle ring.
	TwoFloats desiredMiddlePos;
	///	Used to move the middle ring.
	int middleCount;

	///	Used to determine when the player's drawing a circle.
	CircleDetector detector;
	///	The inner ring's orbit radius around the outer ring.
	float innerOrbit;
	///	The inner ring's position around the outer ring.
	float innerIndex;

	///	Used to scale the world correctly.
	float worldScale;

	///	True when the player's solved the puzzle.
	bool done;
};

#endif
