#pragma once
#include "Image.h"
#include "Figure.h"
#include "Camera.h"
#include "Screen.h"
#include "Input.h"
#include "Font.h"
#include "BmpFrame.h"
#include <memory>

namespace DXFW
{
///	<summary>
///	クラス説明
///	</summary>
///	<example>
///	[サンプルコード:未完成]<BR>
/// サンプル説明<BR>
///	<code>
///	int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow )<BR>
///	{<BR>
///		if( !Dx::Initialise() ) return -1;<BR>
///		Dx::End();<BR>
///		return 0;<BR>
/// }<BR>
/// </code>	
/// </example>
class Sprite
{
friend class Model;

protected:
	double	zoomX;
	double	zoomY;

	double	gapX;//中心モデルとの位置差
	double	gapY;

	double	axisX;//回転軸
	double	axisY;

	int		alpha;
	double	angle;
public:
	bool	isTurn;
	bool	isVisible;
	bool    isActive;
	bool	isAllway;

	Sprite():
		zoomX(1),
		zoomY(1),
		gapX(0),
		gapY(0),
		axisX(0),
		axisY(0),
		alpha(255),
		angle(0),
		isTurn(false),
		isActive(false),
		isVisible(true),
		isAllway(true)
	{}
				
	Sprite(const Sprite* prototype):
		zoomX(prototype->zoomX),
		zoomY(prototype->zoomY),
		gapX(prototype->gapX),
		gapY(prototype->gapY),
		axisX(prototype->axisX),
		axisY(prototype->axisY),
		alpha(prototype->alpha),
		angle(prototype->angle),
		isTurn(prototype->isTurn),
		isActive(prototype->isTurn),
		isVisible(prototype->isTurn),
		isAllway(prototype->isTurn)
	{}

	virtual ~Sprite(){};

	virtual void Draw( double x , double y , bool isCamera) = 0;

	/// <summary>説明</summary>
	void MoveGap(double x , double y)
	{
		gapX += x;
		gapY += y;
	}

	/// <summary>説明</summary>
	void SetGap(double x , double y )
	{
		gapX = x;
		gapY = y;
	}	

	/// <summary>説明</summary>
	void SetZoom(double rateX , double rateY)
	{
		zoomX = rateX;
		zoomY = rateY;
	}

	/// <summary>説明</summary>
	void MultiZoom(double rate )
	{
		zoomX *= rate;
		zoomY *= rate;
	}

	/// <summary>説明</summary>
	void MultiZoom(double rateX , double rateY)
	{
		zoomX *= rateX;
		zoomY *= rateY;
	}

	/// <summary>説明</summary>
	double GetZoomX()
	{
		return this->zoomX;
	}

	/// <summary>説明</summary>
	double GetZoomY()
	{
		return this->zoomY;
	}
	
	/// <summary>説明</summary>		
	void SetTurn( bool isTurn )
	{
		this->isTurn = isTurn;
	}

	/// <summary>説明</summary>
	bool GetTurn()
	{
		return this->isTurn;
	}
	
	/// <summary>説明</summary>
	double GetAngle()
	{
		return this->angle;
	}
	
	/// <summary>説明</summary>
	void SetAngle( double angle )
	{
		this->angle = angle;
	}
	
	/// <summary>説明</summary>
	void Rotate( double angle )
	{
		this->angle += angle;
	}

	/// <summary>説明</summary>
	int GetAlpha()
	{
		return this->alpha;
	}
	
	/// <summary>説明</summary>
	void SetAlpha( int alpha)
	{
		this->alpha = alpha;
	}
	
	/// <summary>説明</summary>
	double GetX( double x , Camera *camera = nullptr )
	{
		if( camera ) return camera->TranX( x );
		return x;
	}
	
	/// <summary>説明</summary>
	double GetY( double y , Camera *camera = nullptr )
	{
		if( camera ) return camera->TranY( y );
		return y;
	}
	
	/// <summary>説明</summary>
	virtual void AnimeUpdate(){};
};

}