#ifndef __Wumbo_Texture_h__
#define __Wumbo_Texture_h__
#include "Wumbo-Header.h"
#include "Wumbo-Resource.h"

#include <string>
#if PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <UIKit/UIKit.h>
#else
#if PLATFORM_WINDOWS
#include <GL/glew.h>
#include <GL/wglew.h>
#endif
#include <SFML/OpenGL.hpp>
#include <SFML/Graphics.hpp>
#endif

#if PLATFORM_APPLE
#import <Foundation/Foundation.h>
#endif

namespace Wumbo
{
	class Texture : public Resource
	{
	private:
		GLuint texture;
		GLuint width;
		GLuint height;
		int loadType;
		bool textureLoaded;
#if PLATFORM_OSX || PLATFORM_IOS
		NSString *filepath;
#else
		std::string filepath;
		sf::Uint8* filepointer;
		unsigned int filesize;
#endif	
#if !PLATFORM_IOS
		sf::Image img;
#endif
	public:
		Texture();
#if PLATFORM_OSX || PLATFORM_IOS
		Texture(NSString *fname);
		bool load(NSString *fname);
#else
		Texture(std::string fname);
		bool load(std::string fname);
#endif
#if PLATFORM_WINDOWS
		Texture(const sf::Uint8* pointer, unsigned int size);
		bool load(const sf::Uint8* pointer, unsigned int size);
#endif
		Texture(GLuint texID, unsigned int width, unsigned int height);

		void reload();
		void unload();
		GLuint getTexture();
		GLuint getWidth();
		GLuint getHeight();
		
		void bind();
	};
};
#endif