#pragma once

#include "../Base.h"
#include "../Generic/Image.h"
#include <Resource/BitmapFont.h>

namespace gorgon {

	class BitmapFont;

	BitmapFont *LoadBitmapFont(Base *parent, File &file, std::istream &in, int Size);

	class BitmapFont : public gge::resource::BitmapFont, public Base {
	public:

		void Add(char target, gorgon::Image &image) {
			gorgon::Base::Subitems.Remove(image);
			gorgon::Base::Subitems.Add(image);
			Remove(target);
			Characters[(int)target]=&image;
			Seperator=0;
			Baseline=0;
		}

		void Remove(char target) {
			gorgon::Base::Subitems.Remove(dynamic_cast<gorgon::Base*>(Characters[(int)target]));
			Characters[(int)target]=NULL;
		}

		void Clear() {
			gorgon::Base::Subitems.Clear();
			std::memset(Characters, 0, 256*4);
		}

		void ImportDirectory(const std::string &directory, bool trim=true, int zero=0x20);

		void Save(std::ostream &out);

		GID::Type GetGID() const {
			return gge::resource::BitmapFont::GetGID();
		}

		using gorgon::Base::Subitems;
		using gorgon::Base::Prepare;

	protected:

	};

}
