#pragma once
#define MLR_GOSIMAGE_HPP

#if !defined(MLR_MLR_HPP)
	#include <MLR\MLR.hpp>
#endif

#if !defined(GAMEOS_HPP)
	#include <GameOS\GameOS.hpp>
#endif

namespace MidLevelRenderer {

	class GOSImage:
		public Stuff::Plug
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructors/Destructors
	//
	public:
		GOSImage(const char* imageName);
		GOSImage(DWORD imageHandle);
		GOSImage(gos_TextureFormat, const char*, int, gos_TextureHints);

		~GOSImage();

		int
			GetWidth();

		int
			GetHeight();

		const char*
			GetName()
				{ Check_Object(this); return imageName; }

		int
			Ref()
				{ Check_Object(this); instance++; return instance; }

		int
			DeRef()
				{ Check_Object(this); instance--; return instance; }

		int
			GetRef()
				{ Check_Object(this); return instance; }

		bool
			IsLoaded()
				{ Check_Object(this); return ( (flags & Loaded) != 0); }

		DWORD
			GetHandle()
				{ Check_Object(this); return imageHandle; }

		enum {
			Loaded = 1,
			Locked = 2
		};

		void
			LockImage();
		void
			UnlockImage();

		BYTE*
			GetImagePtr();
		int
			GetPitch()
				{ return ptr.Pitch; }

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Testing
	//
	public:
		void
			TestInstance() const
				{}

		Stuff::MString imageName;
		int instance;
		int flags;
		DWORD imageHandle;
		TEXTUREPTR ptr;
	};

}
