/*
/ BSTMSPRITE.H
/ ************
/ Supports 2D sprite rendering with animation. 
/ This implementation is in its early stages and 
/ contains a lot of missing functionality.
/
/ Will Beddow 2010 - http://343gs.com/brainstem
/
/ This software is currently under development
/ and is subject to change and improvement. Some
/ aspects of the system are incomplete and/or 
/ unstable due to ongoing implementation.
/
*/

#ifndef __BSTMSPRITE_H__
#define __BSTMSPRITE_H__

#include "Compile.h"
#include "Types.h"
#include "Kernel.h"
#include "Sprite.h"
#include "Camera.h"
#include "Texture.h"

#include "BstmDevice.h"

#include <vector>

namespace Brainstem
{
	class Sprite : public ISprite
	{
	public:
		Sprite(IDirect3DDevice9* device);
		~Sprite();

		bool Init();
		void Update();
		void Render(ICamera* camera);
		void Release();

		void ApplyTexture(ITexture* texture);
		ITexture* GetTexture();

		BoundingVolume GetBounds() { return Bounds; }

		AUTO_OBJECT_SIZE;
		virtual const char* GetName() { return "Sprite"; }

		void SetTechnique(const char* technique) { Technique = technique; }
		const char* GetTechnique() { return Technique; };
	private:

		bool IsPaused;
		float PauseTime;

		float FrameCount;
		int CurrentFrame;

		IDirect3DDevice9* Device;
		std::vector<IPtr<ITexture>> Textures;
		const char* Technique;

		LPD3DXSPRITE SpriteBatch;

		BoundingVolume Bounds;
	};
}

#endif