* Massive refactoring

Tue, 28 Feb 2012 09:58:13 +0000

author
cemkalyoncu
date
Tue, 28 Feb 2012 09:58:13 +0000
changeset 95
706ebab3b092
parent 94
241e4ab98cdc
child 96
acda49a06e2e

* Massive refactoring
* New functions in gge::os
- user::GetUsername
- user::GetDocumentsPath
- GetAppDataPath

Effects/CountingText.cpp file | annotate | diff | comparison | revisions
Effects/CountingText.h file | annotate | diff | comparison | revisions
Effects/Flip.h file | annotate | diff | comparison | revisions
Effects/LayerMover.cpp file | annotate | diff | comparison | revisions
Effects/LayerMover.h file | annotate | diff | comparison | revisions
Effects/LayerResizer.h file | annotate | diff | comparison | revisions
Effects/Tinting.cpp file | annotate | diff | comparison | revisions
Effects/Tinting.h file | annotate | diff | comparison | revisions
Engine/Animation.cpp file | annotate | diff | comparison | revisions
Engine/Animation.h file | annotate | diff | comparison | revisions
Engine/Font.h file | annotate | diff | comparison | revisions
Engine/FontRenderer.h file | annotate | diff | comparison | revisions
Engine/GGE.h file | annotate | diff | comparison | revisions
Engine/GGEMain.cpp file | annotate | diff | comparison | revisions
Engine/GraphicLayers.cpp file | annotate | diff | comparison | revisions
Engine/GraphicLayers.h file | annotate | diff | comparison | revisions
Engine/Input.cpp file | annotate | diff | comparison | revisions
Engine/Input.h file | annotate | diff | comparison | revisions
Engine/Layer.cpp file | annotate | diff | comparison | revisions
Engine/OS.Win32.cpp file | annotate | diff | comparison | revisions
Engine/OS.h file | annotate | diff | comparison | revisions
Engine/Pointer.cpp file | annotate | diff | comparison | revisions
Engine/Pointer.h file | annotate | diff | comparison | revisions
Engine/Wave.cpp file | annotate | diff | comparison | revisions
GGE.vcxproj file | annotate | diff | comparison | revisions
GGE.vcxproj.filters file | annotate | diff | comparison | revisions
Resource/Animation.cpp file | annotate | diff | comparison | revisions
Resource/Animation.h file | annotate | diff | comparison | revisions
Resource/AnimationResource.cpp file | annotate | diff | comparison | revisions
Resource/AnimationResource.h file | annotate | diff | comparison | revisions
Resource/Base.cpp file | annotate | diff | comparison | revisions
Resource/Base.h file | annotate | diff | comparison | revisions
Resource/BitmapFont.cpp file | annotate | diff | comparison | revisions
Resource/BitmapFont.h file | annotate | diff | comparison | revisions
Resource/BitmapFontResource.cpp file | annotate | diff | comparison | revisions
Resource/BitmapFontResource.h file | annotate | diff | comparison | revisions
Resource/DataArray.cpp file | annotate | diff | comparison | revisions
Resource/DataArray.h file | annotate | diff | comparison | revisions
Resource/DataResource.cpp file | annotate | diff | comparison | revisions
Resource/DataResource.h file | annotate | diff | comparison | revisions
Resource/File.cpp file | annotate | diff | comparison | revisions
Resource/File.h file | annotate | diff | comparison | revisions
Resource/Folder.cpp file | annotate | diff | comparison | revisions
Resource/Folder.h file | annotate | diff | comparison | revisions
Resource/FolderResource.cpp file | annotate | diff | comparison | revisions
Resource/FolderResource.h file | annotate | diff | comparison | revisions
Resource/FontTheme.cpp file | annotate | diff | comparison | revisions
Resource/FontTheme.h file | annotate | diff | comparison | revisions
Resource/GRE.h file | annotate | diff | comparison | revisions
Resource/Image & Animation.cd file | annotate | diff | comparison | revisions
Resource/Image.cpp file | annotate | diff | comparison | revisions
Resource/Image.h file | annotate | diff | comparison | revisions
Resource/ImageResource.cpp file | annotate | diff | comparison | revisions
Resource/ImageResource.h file | annotate | diff | comparison | revisions
Resource/LinkNode.cpp file | annotate | diff | comparison | revisions
Resource/LinkNode.h file | annotate | diff | comparison | revisions
Resource/NullImage.h file | annotate | diff | comparison | revisions
Resource/Pointer.cpp file | annotate | diff | comparison | revisions
Resource/Pointer.h file | annotate | diff | comparison | revisions
Resource/PointerResource.cpp file | annotate | diff | comparison | revisions
Resource/PointerResource.h file | annotate | diff | comparison | revisions
Resource/ResizableObject.h file | annotate | diff | comparison | revisions
Resource/ResourceBase.cpp file | annotate | diff | comparison | revisions
Resource/ResourceBase.h file | annotate | diff | comparison | revisions
Resource/ResourceFile.cpp file | annotate | diff | comparison | revisions
Resource/ResourceFile.h file | annotate | diff | comparison | revisions
Resource/Sound.cpp file | annotate | diff | comparison | revisions
Resource/Sound.h file | annotate | diff | comparison | revisions
Resource/SoundResource.cpp file | annotate | diff | comparison | revisions
Resource/SoundResource.h file | annotate | diff | comparison | revisions
Resource/Text.cpp file | annotate | diff | comparison | revisions
Resource/Text.h file | annotate | diff | comparison | revisions
Resource/TextResource.cpp file | annotate | diff | comparison | revisions
Resource/TextResource.h file | annotate | diff | comparison | revisions
Utils/ConsumableEvent.h file | annotate | diff | comparison | revisions
Utils/EventChain.h file | annotate | diff | comparison | revisions
Utils/Iterator.h file | annotate | diff | comparison | revisions
Widgets/Base/Blueprint.h file | annotate | diff | comparison | revisions
Widgets/Base/Container.h file | annotate | diff | comparison | revisions
Widgets/Base/Widget.cpp file | annotate | diff | comparison | revisions
Widgets/Base/Widget.h file | annotate | diff | comparison | revisions
Widgets/Basic/BorderData.cpp file | annotate | diff | comparison | revisions
Widgets/Basic/BorderData.h file | annotate | diff | comparison | revisions
Widgets/Basic/Line.cpp file | annotate | diff | comparison | revisions
Widgets/Basic/Line.h file | annotate | diff | comparison | revisions
Widgets/Basic/PetContainer.h file | annotate | diff | comparison | revisions
Widgets/Basic/Placeholder.cpp file | annotate | diff | comparison | revisions
Widgets/Basic/Placeholder.h file | annotate | diff | comparison | revisions
Widgets/Basic/Rectangle.cpp file | annotate | diff | comparison | revisions
Widgets/Basic/Rectangle.h file | annotate | diff | comparison | revisions
Widgets/Basic/ResizableObjectResource.cpp file | annotate | diff | comparison | revisions
Widgets/Basic/ResizableObjectResource.h file | annotate | diff | comparison | revisions
Widgets/Checkbox/CheckboxBase.cpp file | annotate | diff | comparison | revisions
Widgets/Checkbox/CheckboxBase.h file | annotate | diff | comparison | revisions
Widgets/Checkbox/CheckboxBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Checkbox/CheckboxBlueprint.h file | annotate | diff | comparison | revisions
Widgets/ClassDiagram.cd file | annotate | diff | comparison | revisions
Widgets/Combobox.h file | annotate | diff | comparison | revisions
Widgets/Combobox/ComboboxBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Combobox/ComboboxBlueprint.h file | annotate | diff | comparison | revisions
Widgets/DialogWindow.h file | annotate | diff | comparison | revisions
Widgets/Interfaces/IOption.h file | annotate | diff | comparison | revisions
Widgets/Label.h file | annotate | diff | comparison | revisions
Widgets/LayerWidget.h file | annotate | diff | comparison | revisions
Widgets/Listbox.h file | annotate | diff | comparison | revisions
Widgets/Listbox/ListboxBase.h file | annotate | diff | comparison | revisions
Widgets/Listbox/ListboxBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Listbox/ListboxBlueprint.h file | annotate | diff | comparison | revisions
Widgets/Main.cpp file | annotate | diff | comparison | revisions
Widgets/Main.h file | annotate | diff | comparison | revisions
Widgets/Organizers/LinearOrganizer.cpp file | annotate | diff | comparison | revisions
Widgets/Organizers/LinearOrganizer.h file | annotate | diff | comparison | revisions
Widgets/Organizers/ListOrganizer.h file | annotate | diff | comparison | revisions
Widgets/Panel/PanelBase.cpp file | annotate | diff | comparison | revisions
Widgets/Panel/PanelBase.h file | annotate | diff | comparison | revisions
Widgets/Panel/PanelBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Panel/PanelBlueprint.h file | annotate | diff | comparison | revisions
Widgets/RadioButton.h file | annotate | diff | comparison | revisions
Widgets/Slider/SliderBase.h file | annotate | diff | comparison | revisions
Widgets/Slider/SliderBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Slider/SliderBlueprint.h file | annotate | diff | comparison | revisions
Widgets/Tabpanel.cpp file | annotate | diff | comparison | revisions
Widgets/Tabpanel.h file | annotate | diff | comparison | revisions
Widgets/TabpanelBlueprint.h file | annotate | diff | comparison | revisions
Widgets/Textbox/TextboxBase.cpp file | annotate | diff | comparison | revisions
Widgets/Textbox/TextboxBase.h file | annotate | diff | comparison | revisions
Widgets/Textbox/TextboxBlueprint.cpp file | annotate | diff | comparison | revisions
Widgets/Textbox/TextboxBlueprint.h file | annotate | diff | comparison | revisions
Widgets/WidgetRegistry.cpp file | annotate | diff | comparison | revisions
Widgets/WidgetRegistry.h file | annotate | diff | comparison | revisions
Widgets/Window.h file | annotate | diff | comparison | revisions
--- a/Effects/CountingText.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/CountingText.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -7,8 +7,8 @@
 
 namespace gge { namespace effects {
 
-	CountingText::CountingText( animation::AnimationTimer &controller, bool owner/*=false*/ ) : 
-		AnimationBase(controller, owner),
+	CountingText::CountingText( animation::Timer &controller, bool owner/*=false*/ ) : 
+		Base(controller, owner),
 		Color(0xff000000),
 		Font(NULL),
 		Shadow(),
@@ -21,7 +21,7 @@
 	}
 
 	CountingText::CountingText( bool create/*=false*/ ) : 
-		AnimationBase(create),
+		Base(create),
 		Color(0xff000000),
 		Font(NULL),
 		Shadow(),
--- a/Effects/CountingText.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/CountingText.h	Tue Feb 28 09:58:13 2012 +0000
@@ -3,13 +3,13 @@
 #include "../Resource/GRE.h"
 #include "../Engine/Animation.h"
 #include "../Engine/Graphics.h"
-#include "../Resource/BitmapFontResource.h"
+#include "../Resource/BitmapFont.h"
 
 
 namespace gge { namespace effects {
 
 	////This effect displays a counting number going from a given value to another one.
-	class CountingText : public animation::AnimationBase {
+	class CountingText : public animation::Base {
 	public:
 		////Color of the text, default is black
 		graphics::RGBint Color;
@@ -24,16 +24,16 @@
 		////Customized printing format, printf style that can feature a %f as the current value
 		string Format;
 		////The font to be used
-		resource::BitmapFontResource *Font;
+		resource::BitmapFont *Font;
 
 
 		////Initializes the effect
-		CountingText(animation::AnimationTimer &controller, bool owner=false);
+		CountingText(animation::Timer &controller, bool owner=false);
 
 		////Initializes the effect
 		explicit CountingText(bool create=false);
 
-		void Adjust(resource::BitmapFontResource *Font=NULL, 
+		void Adjust(resource::BitmapFont *Font=NULL, 
 			graphics::RGBint color=graphics::RGBint(0xff000000), 
 			int Width=0, TextAlignment::Type Align=TextAlignment::Left, 
 			ShadowParams Shadow=ShadowParams(), int Decimals=0) {
--- a/Effects/Flip.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/Flip.h	Tue Feb 28 09:58:13 2012 +0000
@@ -8,7 +8,7 @@
 
 namespace gge { namespace effects {
 
-	class FlipEffect : public animation::AnimationBase, public graphics::Graphic2D {
+	class FlipEffect : public animation::Base, public graphics::Graphic2D {
 	public:
 		enum FlipSide {
 			Top=1,
@@ -17,11 +17,11 @@
 			Right,
 		};
 
-		FlipEffect(animation::AnimationTimer &controller, bool owner=false) : AnimationBase(controller,owner) { 
+		FlipEffect(animation::Timer &controller, bool owner=false) : Base(controller,owner) { 
 			Initialize(); 
 		}
 
-		explicit FlipEffect(bool create=false) : AnimationBase(create) { 
+		explicit FlipEffect(bool create=false) : Base(create) { 
 			Initialize(); 
 		}
 
--- a/Effects/LayerMover.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/LayerMover.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -77,16 +77,16 @@
 			return animation::ProgressResult::None;
 	}
 
-	LayerMover::LayerMover( LayerBase *Target, animation::AnimationTimer &controller, bool owner ) :
-		AnimationBase(controller, owner),
+	LayerMover::LayerMover( LayerBase *Target, animation::Timer &controller, bool owner ) :
+		Base(controller, owner),
 		speed(0,0),
 		current(Target->BoundingBox.TopLeft()),
 		Target(Target)
 	{
 	}
 
-	LayerMover::LayerMover( LayerBase &Target, animation::AnimationTimer &controller, bool owner ) :
-		AnimationBase(controller, owner),
+	LayerMover::LayerMover( LayerBase &Target, animation::Timer &controller, bool owner ) :
+		Base(controller, owner),
 		speed(0,0),
 		current(Target.BoundingBox.TopLeft()),
 		Target(&Target) 
--- a/Effects/LayerMover.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/LayerMover.h	Tue Feb 28 09:58:13 2012 +0000
@@ -9,16 +9,16 @@
 
 	////This effect moves a given layer. Moving operation is animated from a given
 	/// value to another one
-	class LayerMover : public animation::AnimationBase {
+	class LayerMover : public animation::Base {
 	public:
 
 		////Target of this effect
 		LayerBase *Target;
 
 		////Initializes the effect
-		LayerMover(LayerBase *Target, animation::AnimationTimer &controller, bool owner=false);
+		LayerMover(LayerBase *Target, animation::Timer &controller, bool owner=false);
 		////Initializes the effect
-		LayerMover(LayerBase &Target, animation::AnimationTimer &controller, bool owner=false);
+		LayerMover(LayerBase &Target, animation::Timer &controller, bool owner=false);
 
 		////Initializes the effect
 		LayerMover(LayerBase *Target, bool create=false);
--- a/Effects/LayerResizer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/LayerResizer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -10,15 +10,15 @@
 
 	////This effect resizes a given layer. Resize operation is animated from a given
 	/// value to another one
-	class LayerResizer : public animation::AnimationBase {
+	class LayerResizer : public animation::Base {
 	public:
 
 		////Target of this effect
 		LayerBase *Target;
 
 		////Initializes the effect
-		LayerResizer(LayerBase *Target, animation::AnimationTimer &controller, bool owner=false) :
-			AnimationBase(controller,owner),
+		LayerResizer(LayerBase *Target, animation::Timer &controller, bool owner=false) :
+			Base(controller,owner),
 			speed(0,0 , 0,0),
 			current((utils::Bounds2D)Target->BoundingBox),
 			Target(Target)
@@ -26,8 +26,8 @@
 		}
 
 		////Initializes the effect
-		LayerResizer(LayerBase &Target, animation::AnimationTimer &controller, bool owner=false) :
-			AnimationBase(controller,owner),
+		LayerResizer(LayerBase &Target, animation::Timer &controller, bool owner=false) :
+			Base(controller,owner),
 			speed(0,0 , 0,0),
 			current((utils::Bounds2D)Target.BoundingBox),
 			Target(&Target)
@@ -36,7 +36,7 @@
 
 			////Initializes the effect
 		LayerResizer(LayerBase *Target, bool create=false) :
-			AnimationBase(create),
+			Base(create),
 			speed(0,0 , 0,0),
 			current((utils::Bounds2D)Target->BoundingBox),
 			Target(Target)
@@ -45,7 +45,7 @@
 
 		////Initializes the effect
 		LayerResizer(LayerBase &Target, bool create=false) :
-			AnimationBase(create),
+			Base(create),
 			speed(0,0 , 0,0),
 			current((utils::Bounds2D)Target.BoundingBox),
 			Target(&Target)
--- a/Effects/Tinting.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/Tinting.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -97,7 +97,7 @@
 	}
 
 	Tinting::Tinting( graphics::Colorizable2DLayer &Target, bool create/*=false*/ ) : 
-		AnimationBase(create),
+		Base(create),
 		from(0), to(0), current(0), 
 		speed(0, 0,0,0),
 		Target(&Target)
@@ -106,7 +106,7 @@
 
 
 	Tinting::Tinting( graphics::Colorizable2DLayer *Target, bool create/*=false*/ ) : 
-		AnimationBase(create),
+		Base(create),
 		from(0), to(0), current(0), 
 		speed(0, 0,0,0),
 		Target(Target)
--- a/Effects/Tinting.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Effects/Tinting.h	Tue Feb 28 09:58:13 2012 +0000
@@ -9,20 +9,20 @@
 
 	////This effect tints a given colorizable target. Tinting is animated from a given
 	/// value to another one
-	class Tinting : public animation::AnimationBase {
+	class Tinting : public animation::Base {
 	public:
 
 		////Initializes the effect
-		Tinting(graphics::Colorizable2DLayer *Target, animation::AnimationTimer &Controller, bool owner=false) : 
-			AnimationBase(Controller, owner),
+		Tinting(graphics::Colorizable2DLayer *Target, animation::Timer &Controller, bool owner=false) : 
+			Base(Controller, owner),
 			from(0), to(0), current(0), 
 			speed(0, 0,0,0),
 			Target(Target)
 		{ } 
 
 		////Initializes the effect
-		Tinting(graphics::Colorizable2DLayer &Target, animation::AnimationTimer &Controller, bool owner=false) : 
-			AnimationBase(Controller, owner),
+		Tinting(graphics::Colorizable2DLayer &Target, animation::Timer &Controller, bool owner=false) : 
+			Base(Controller, owner),
 			from(0), to(0), current(0), 
 			speed(0, 0,0,0),
 			Target(&Target)
--- a/Engine/Animation.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Animation.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -8,8 +8,8 @@
 
 namespace gge { namespace animation {
 
-	Collection<AnimationTimer> Timers;
-	Collection<AnimationBase> Animations;
+	Collection<Timer> Timers;
+	Collection<Base> Animations;
 
 	unsigned LastTick;
 
@@ -17,10 +17,10 @@
 		unsigned progressed=Main.CurrentTime-LastTick;
 		if(progressed==0) return;
 
-		for(Collection<AnimationTimer>::Iterator i=Timers.First();i.isValid();i.Next())
+		for(Collection<Timer>::Iterator i=Timers.First();i.IsValid();i.Next())
 			i->Progress(progressed);
 
-		for(Collection<AnimationBase>::Iterator i=Animations.First();i.isValid();i.Next()) {
+		for(Collection<Base>::Iterator i=Animations.First();i.IsValid();i.Next()) {
 			if(i->HasController()) {
 				ProgressResult::Type r=i->Progress();
 
@@ -38,20 +38,20 @@
 	}
 
 
-	AnimationTimer::AnimationTimer() : progress(0) {
+	Timer::Timer() : progress(0) {
 		Timers.Add(this);
 	}
 
-	AnimationTimer::~AnimationTimer() {
+	Timer::~Timer() {
 		Timers.Remove(this);
 	}
 
-	void AnimationTimer::Progress( unsigned timepassed ) {
+	void Timer::Progress( unsigned timepassed ) {
 		progress += timepassed;
 	}
 
 
-	AnimationController::AnimationController() : AnimationTimer(), 
+	Controller::Controller() : Timer(), 
 		ispaused(false), isfinished(false), speed(1.f),
 		Finished("Finished", this),
 		Paused("Paused", this), pauseat(-1)
@@ -59,7 +59,7 @@
 
 	}
 
-	void AnimationController::Progress( unsigned timepassed ) {
+	void Controller::Progress( unsigned timepassed ) {
 		if(!ispaused && !isfinished) {
 			if(Round(mprogress)!=progress)
 				mprogress=progress;
@@ -80,14 +80,14 @@
 		}
 	}
 
-	void AnimationController::Play() {
+	void Controller::Play() {
 		ispaused=false; 
 		isfinished=false;
 		mprogress=0;
 		progress=0;
 	}
 
-	void AnimationController::Obtained( ProgressResult::Type r, AnimationBase &source ) {
+	void Controller::Obtained( ProgressResult::Type r, Base &source ) {
 		if(r==ProgressResult::Finished) {
 			if(!isfinished) {
 				isfinished=true;
@@ -104,11 +104,11 @@
 			mprogress=progress;
 	}
 
-	void AnimationController::Pause() {
+	void Controller::Pause() {
 		ispaused=true;
 	}
 
-	void AnimationController::ResetProgress() {
+	void Controller::ResetProgress() {
 		isfinished=false;
 		if(speed<0) {
 			mprogress=-1;
@@ -121,20 +121,20 @@
 	}
 
 
-	AnimationBase::AnimationBase(AnimationTimer &Controller, bool owner) : Controller(&Controller), owner(owner) {
+	Base::Base(Timer &Controller, bool owner) : Controller(&Controller), owner(owner) {
 		Animations.Add(this);
 	}
 
-	AnimationBase::AnimationBase(bool create) : Controller(NULL) {
+	Base::Base(bool create) : Controller(NULL) {
 		Animations.Add(this);
 
 		if(create) {
-			Controller=new AnimationTimer();
+			Controller=new Timer();
 			owner=true;
 		}
 	}
 
-	void AnimationBase::SetController( AnimationTimer &controller, bool owner ) {
+	void Base::SetController( Timer &controller, bool owner ) {
 		if(this->owner && Controller)
 			delete Controller;
 
@@ -147,7 +147,7 @@
 			controller.Obtained(r, *this);
 	}
 
-	AnimationBase::~AnimationBase() {
+	Base::~Base() {
 		Animations.Remove(this);
 		if(owner && Controller)
 			delete Controller;
@@ -156,7 +156,7 @@
 
 
 	void DiscreteController::Progress(unsigned timepassed) {
-		AnimationController::Progress(timepassed);
+		Controller::Progress(timepassed);
 
 		int t=GetProgress();
 		int tl=info.GetDuration();
--- a/Engine/Animation.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Animation.h	Tue Feb 28 09:58:13 2012 +0000
@@ -21,21 +21,21 @@
 		};
 	};
 
-	class AnimationBase;
+	class Base;
 
-	class AnimationTimer {
+	class Timer {
 	public:
 		enum Type {
 			Continous,
 			Discrete
 		};
 
-		AnimationTimer();
+		Timer();
 
-		virtual ~AnimationTimer();
+		virtual ~Timer();
 
 		virtual void Progress(unsigned timepassed);
-		virtual void Obtained(ProgressResult::Type r, AnimationBase &source) 
+		virtual void Obtained(ProgressResult::Type r, Base &source) 
 		{}
 
 		virtual void ResetProgress() { progress=0; }
@@ -51,19 +51,19 @@
 	class source_param {
 	public:
 
-		source_param(AnimationBase *source) : source(source)
+		source_param(Base *source) : source(source)
 		{ }
 
-		AnimationBase *source;
+		Base *source;
 	};
 
-	class AnimationController : public AnimationTimer {
+	class Controller : public Timer {
 	public:
 
-		AnimationController();
+		Controller();
 
 		virtual void Progress(unsigned timepassed);
-		virtual void Obtained(ProgressResult::Type r, AnimationBase &source);
+		virtual void Obtained(ProgressResult::Type r, Base &source);
 
 		virtual void Pause();
 		virtual void Resume() { ispaused=false; }
@@ -92,8 +92,8 @@
 		}
 		virtual void SetProgress(int progress) { mprogress=this->progress=progress; }
 
-		utils::EventChain<AnimationController, source_param> Finished;
-		utils::EventChain<AnimationController, source_param> Paused;
+		utils::EventChain<Controller, source_param> Finished;
+		utils::EventChain<Controller, source_param> Paused;
 
 	protected:
 		bool ispaused;
@@ -103,13 +103,13 @@
 		double mprogress;
 	};
 
-	class AnimationProvider {
+	class Provider {
 	public:
-		virtual AnimationBase &CreateAnimation(AnimationTimer &controller, bool owner=false) = 0;
-		virtual AnimationBase &CreateAnimation(bool create=false) = 0;
+		virtual Base &CreateAnimation(Timer &controller, bool owner=false) = 0;
+		virtual Base &CreateAnimation(bool create=false) = 0;
 	};
 
-	class DiscreteAnimationProvider : virtual public AnimationProvider {
+	class DiscreteProvider : virtual public Provider {
 	public:
 		//if there is a single frame, duration should be 0
 		virtual int GetDuration() const					= 0;
@@ -123,9 +123,9 @@
 		virtual	int		 EndOf(unsigned Frame) const { return StartOf(Frame)+GetDuration(Frame); }
 	};
 
-	class DiscreteController : public AnimationController {
+	class DiscreteController : public Controller {
 	public:
-		DiscreteController(DiscreteAnimationProvider &info) : AnimationController(), 
+		DiscreteController(DiscreteProvider &info) : Controller(), 
 			islooping(true), info(info), pauseatframe(-1), currentframe(-1)
 		{ }
 
@@ -162,32 +162,32 @@
 		virtual int GetDuration() const { return info.GetDuration(); }
 		virtual int GetNumberofFrames() const { return info.GetNumberofFrames(); }
 
-		virtual Type GetType() const { return AnimationTimer::Discrete; }
+		virtual Type GetType() const { return Timer::Discrete; }
 		virtual void Progress(unsigned timepassed);
 
 		virtual void Play();
 		virtual void ResetProgress();
 
 		//finished and paused events are created using info
-		virtual void Obtained(ProgressResult::Type r, AnimationBase &source) { }
+		virtual void Obtained(ProgressResult::Type r, Base &source) { }
 
 	protected:
 		bool islooping;
 		int pauseatframe;
 		int currentframe;
-		DiscreteAnimationProvider &info;
+		DiscreteProvider &info;
 	};
 
-	class AnimationBase {
+	class Base {
 	public:
-		AnimationBase(AnimationTimer &Controller, bool owner=false);
-		explicit AnimationBase(bool create=false);
+		Base(Timer &Controller, bool owner=false);
+		explicit Base(bool create=false);
 		
-		virtual ~AnimationBase();
+		virtual ~Base();
 
-		virtual void SetController(AnimationTimer &controller, bool owner=false);
+		virtual void SetController(Timer &controller, bool owner=false);
 		bool HasController() { return Controller!=NULL; }
-		AnimationTimer &GetController() { return *Controller; }
+		Timer &GetController() { return *Controller; }
 		void RemoveController() { Controller=NULL; }
 
 
@@ -198,12 +198,12 @@
 
 
 	protected:
-		AnimationTimer *Controller;
+		Timer *Controller;
 		bool owner;
 	};
 #pragma warning(push)
 #pragma warning(disable:4250)
-	class Basic2DAnimation : virtual public graphics::Graphic2D, virtual public AnimationBase {
+	class Basic2DAnimation : virtual public graphics::Graphic2D, virtual public Base {
 
 	};
 
@@ -226,24 +226,24 @@
 	//	virtual Graphic2DAnimation &CreateAnimation(bool create=false) = 0;
 	//};
 
-	class Basic2DAnimationProvider : virtual public AnimationProvider {
+	class Basic2DAnimationProvider : virtual public Provider {
 	public:
-		virtual Basic2DAnimation &CreateAnimation(AnimationTimer &controller, bool owner=false) = 0;
+		virtual Basic2DAnimation &CreateAnimation(Timer &controller, bool owner=false) = 0;
 		virtual Basic2DAnimation &CreateAnimation(bool create=false) = 0;
 	};
 
 	class RectangularGraphic2DAnimationProvider : virtual public Basic2DAnimationProvider {
 	public:
-		virtual RectangularGraphic2DAnimation &CreateAnimation(AnimationTimer &controller, bool owner=false) = 0;
+		virtual RectangularGraphic2DAnimation &CreateAnimation(Timer &controller, bool owner=false) = 0;
 		virtual RectangularGraphic2DAnimation &CreateAnimation(bool create=false) = 0;
 	};
 
- 	class RectangularGraphic2DSequenceProvider : virtual public RectangularGraphic2DAnimationProvider, virtual public DiscreteAnimationProvider {
+ 	class RectangularGraphic2DSequenceProvider : virtual public RectangularGraphic2DAnimationProvider, virtual public DiscreteProvider {
 	public:
-		virtual RectangularGraphic2DAnimation &CreateAnimation(AnimationTimer &controller, bool owner=false) = 0;
+		virtual RectangularGraphic2DAnimation &CreateAnimation(Timer &controller, bool owner=false) = 0;
 		virtual RectangularGraphic2DAnimation &CreateAnimation(bool create=false) = 0;
 		virtual graphics::RectangularGraphic2D &ImageAt(int time)=0;
 	};
 
-	extern utils::Collection<AnimationBase> Animations;
+	extern utils::Collection<Base> Animations;
 } }
--- a/Engine/Font.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Font.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,7 +1,7 @@
 #pragma once
 
 #include "FontRenderer.h"
-#include "../Resource/ResourceFile.h"
+#include "../Resource/File.h"
 
 namespace gge { namespace resource {
 	class FontTheme; 
--- a/Engine/FontRenderer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/FontRenderer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,7 +1,7 @@
 #pragma once
 
 #include "../Engine/Graphics.h"
-#include "../Resource/ResourceFile.h"
+#include "../Resource/File.h"
 #include "GraphicTargets2D.h"
 
 namespace gge { namespace resource {
--- a/Engine/GGE.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/GGE.h	Tue Feb 28 09:58:13 2012 +0000
@@ -138,7 +138,7 @@
 			return (t&Mask_Vertical) == Middle;
 		}
 
-		inline bool isValid(Type t) {
+		inline bool IsValid(Type t) {
 			if(t&Mask_Invalid)
 				return false;
 
--- a/Engine/GGEMain.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/GGEMain.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -71,7 +71,7 @@
 		BeforeRenderEvent();
 
 		///*Processing interval objects
-		for(utils::Collection<IntervalObject>::Iterator interval=IntervalObjects.First();interval.isValid();interval.Next()) {
+		for(utils::Collection<IntervalObject>::Iterator interval=IntervalObjects.First();interval.IsValid();interval.Next()) {
 			if(interval->Enabled)
 				if(CurrentTime-interval->LastSignal>interval->Timeout) {
 					interval->Signal(*interval, interval->Data);
--- a/Engine/GraphicLayers.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/GraphicLayers.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -536,7 +536,7 @@
 		glTranslatef(BoundingBox.Left, BoundingBox.Top, 0);
 		translate+=BoundingBox.TopLeft();
 
-		if(EnableClipping) {
+		if(ClippingEnabled) {
 			psc=scissors;
 
 			glEnable(GL_SCISSOR_TEST);
@@ -625,7 +625,7 @@
 		}
 
 		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
-		for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.isValid(); i.Previous()) {
+		for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.IsValid(); i.Previous()) {
 			i->Render();
 		}
 
@@ -633,7 +633,7 @@
 		glPopMatrix();
 		translate-=BoundingBox.TopLeft();
 
-		if(EnableClipping) {
+		if(ClippingEnabled) {
 			scissors=psc;
 			glScissor(scissors.Left, (ScreenSize.Height-scissors.Top)-scissors.Height(), scissors.Width(), scissors.Height());
 		}
@@ -1287,7 +1287,7 @@
 
 		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 		glColor4fv(CurrentLayerColor.vect);
-		for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.isValid(); i.Previous()) {
+		for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.IsValid(); i.Previous()) {
 			i->Render();
 		}
 
--- a/Engine/GraphicLayers.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/GraphicLayers.h	Tue Feb 28 09:58:13 2012 +0000
@@ -26,7 +26,7 @@
 		////This list contains surfaces to be drawn
 		PAClassList<BasicSurface> Surfaces;
 		////Whether or not enable clipping
-		bool EnableClipping;
+		bool ClippingEnabled;
 		BasicSurface::DrawMode DrawMode;
 
 
@@ -42,7 +42,7 @@
 
 		void init() {
 			isVisible=true;
-			EnableClipping=false;
+			ClippingEnabled=false;
 			DrawMode=BasicSurface::Normal;
 		}
 
--- a/Engine/Input.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Input.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -24,7 +24,7 @@
 
 		bool EventProvider::PropagateMouseEvent(Event::Type event, utils::Point location, int amount) {
 			if(Event::isClick(event)) {
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.isValid();i.Next()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.IsValid();i.Next()) {
 					if((!PressedObject || &(*i)==PressedObject) && i->Bounds.isInside(location)) {
 						if(i->Fire(event, location-i->Bounds.TopLeft(), amount))
 							return true;
@@ -34,7 +34,7 @@
 				return false;
 			}
 			else if(Event::isDown(event)) {
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.isValid();i.Next()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.IsValid();i.Next()) {
 					if(i->Bounds.isInside(location)) {
 						if(i->Fire(event, location-i->Bounds.TopLeft(), amount)) {
 							mouse::PressedObject=&(*i);
@@ -46,7 +46,7 @@
 				return false;
 			}
 			else if(event==Event::Over) {
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.Last();i.isValid();i.Previous()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.Last();i.IsValid();i.Previous()) {
 					bool isover=false;
 					if(i->Bounds.isInside(location)) {
 						if(i->EventMask & Event::OverCheck) {
@@ -72,7 +72,7 @@
 			else if(event==Event::Out) {
 				bool ret=false;
 
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.isValid();i.Next()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.IsValid();i.Next()) {
 					bool isover=false;
 					if(i->Bounds.isInside(location)) {
 						if(i->EventMask & Event::OverCheck) {
@@ -98,7 +98,7 @@
 				return false;
 			}
 			else if(event==Event::Move && PressedObject) {
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.isValid();i.Next()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.IsValid();i.Next()) {
 					if(PressedObject==&(*i)) {
 						if(i->Fire(event, location-i->Bounds.TopLeft(), amount))
 							return true;
@@ -108,7 +108,7 @@
 				return false;
 			}
 			else { //Scrolls, double click
-				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.isValid();i.Next()) {
+				for(utils::SortedCollection<EventChain::Object>::Iterator i = this->MouseEvents.Events.First();i.IsValid();i.Next()) {
 					if(i->Bounds.isInside(location)) {
 						if(i->Fire(event, location-i->Bounds.TopLeft(), amount))
 							return true;
@@ -120,7 +120,7 @@
 		}
 
 		EventProvider::~EventProvider() {
-			for(utils::SortedCollection<EventChain::Object>::Iterator it=MouseEvents.Events.First();it.isValid();it.Next())
+			for(utils::SortedCollection<EventChain::Object>::Iterator it=MouseEvents.Events.First();it.IsValid();it.Next())
 				if(&(*it)==PressedObject)
 					PressedObject=NULL;
 
--- a/Engine/Input.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Input.h	Tue Feb 28 09:58:13 2012 +0000
@@ -379,7 +379,7 @@
 			};
 
 			bool Fire(Event::Type event, utils::Point location, int amount) {
-				for(utils::SortedCollection<Object>::Iterator i=Events.Last();i.isValid();i.Previous()) {
+				for(utils::SortedCollection<Object>::Iterator i=Events.Last();i.IsValid();i.Previous()) {
 					i->Fire(event, location, amount);
 				}
 			}
--- a/Engine/Layer.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Layer.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -61,7 +61,7 @@
 			if(!(isVisible && BoundingBox.isInside(location)))
 				return false;
 			
-			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.isValid(); i.Next()) {
+			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.IsValid(); i.Next()) {
 				if(i->PropagateMouseEvent(event, location-BoundingBox.TopLeft(), amount))
 					return true;
 			}
@@ -71,7 +71,7 @@
 			bool ret=false;
 			int isin=(isVisible && BoundingBox.isInside(location)) ? 1 : 0;
 
-			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.isValid(); i.Next()) {
+			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.IsValid(); i.Next()) {
 				if(i->PropagateMouseEvent(event, location-BoundingBox.TopLeft(), isin & amount)) {
 					ret=true;
 					isin=false;
@@ -85,7 +85,7 @@
 				(isVisible && BoundingBox.isInside(location)) || 
 				(input::mouse::PressedObject && (event&input::mouse::Event::Move))  )
 			{
-				for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.isValid(); i.Next()) {
+				for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.First(); i.IsValid(); i.Next()) {
 					if(i->PropagateMouseEvent(event, location-BoundingBox.TopLeft(), amount))
 						return true;
 				}
@@ -101,7 +101,7 @@
 		glTranslatef((float)BoundingBox.Left, (float)BoundingBox.Top, 0);
 
 		if(isVisible) {
-			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.isValid(); i.Previous()) {
+			for(utils::SortedCollection<LayerBase>::Iterator i=SubLayers.Last(); i.IsValid(); i.Previous()) {
 				i->Render();
 			}
 		}
--- a/Engine/OS.Win32.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/OS.Win32.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,17 +1,19 @@
-#include "OS.h"
-#include "input.h"
-#include "Multimedia.h"
-#include "..\Utils\Point2D.h"
+#ifdef WIN32
 
-using namespace gge::utils;
-using namespace gge::input;
-using namespace gge::input::system;
+#	include "OS.h"
+#	include "input.h"
+#	include "Multimedia.h"
+#	include "..\Utils\Point2D.h"
 
-#ifdef WIN32
+
+	using namespace gge::utils;
+	using namespace gge::input;
+	using namespace gge::input::system;
 
 //#	define WINVER 0x0500
 //#	define _WIN32_WINNT 0x0500
 #	include <windows.h>
+#	include <shlobj.h>
 #	undef CreateWindow
 #	undef Rectangle
 
@@ -34,9 +36,11 @@
 #		define WM_MOUSEHWHEEL					0x020E
 #	endif
 
-extern "C" {
-	__declspec(dllimport) unsigned long __stdcall timeGetTime(void);
-}
+#	undef CreateDirectory
+
+	//extern "C" {
+	//	__declspec(dllimport) unsigned long __stdcall timeGetTime(void);
+	//}
 
 	HINSTANCE Instance;
 
@@ -505,7 +509,41 @@
 			}
 		}
 
+		namespace user {
+			std::string GetDocumentsPath() {
+				CHAR my_documents[MAX_PATH];
+				my_documents[0]=0;
 
+				HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
+
+				return my_documents;
+			}
+
+			std::string GetUsername() {
+				CHAR username[256];
+				username[0]=0;
+
+				DWORD s=256;
+				GetUserName(username, &s);
+
+				return username;
+			}
+		}
+
+		namespace filesystem {
+			bool CreateDirectory(const std::string &name) {
+				return CreateDirectoryA(name.c_str(), NULL)!=0;
+			}
+		}
+
+		std::string GetAppDataPath() {
+			CHAR my_documents[MAX_PATH];
+			my_documents[0]=0;
+
+			HRESULT result = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
+
+			return my_documents;
+		}
 	} 
 
 	namespace input {
--- a/Engine/OS.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/OS.h	Tue Feb 28 09:58:13 2012 +0000
@@ -37,6 +37,60 @@
 		extern bool pointerdisplayed;
 	}
 
+	namespace user {
+		std::string GetUsername();
+		std::string GetDocumentsPath();
+	}
+
+	std::string GetAppDataPath();
+
+	namespace filesystem {
+		bool CreateDirectory(const std::string &name);
+
+		class osdirenum;
+
+		class EndOfDirectory {};
+
+
+		//!to be completed
+		class DirectoryIterator {
+		public:
+			typedef std::forward_iterator_tag iterator_category;
+			typedef std::string value_type;
+			typedef std::string *pointer_type;
+			typedef std::string &reference_type;
+
+			typedef std::string Type;
+
+			DirectoryIterator(const std::string &dir);
+			DirectoryIterator(const DirectoryIterator &dir);
+
+			std::string Get() const {
+				return current;
+			}
+
+			operator std::string() const {
+				return Get();
+			}
+
+			std::string operator *() const {
+				return Get();
+			}
+
+			DirectoryIterator &operator ++();
+
+			bool operator ==(const EndOfDirectory &);
+
+			bool operator ==(const DirectoryIterator &it) {
+				return it.current==current;
+			}
+
+		protected:
+			std::string current;
+			osdirenum *dirinfo;
+		};
+	}
+
 	namespace input {
 		////Gets the position of the cursor
 		utils::Point getMousePosition(os::WindowHandle Window);
--- a/Engine/Pointer.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Pointer.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -3,11 +3,11 @@
 #include "../Utils/SortedCollection.h"
 #include "GraphicLayers.h"
 #include "GGEMain.h"
-#include "../Resource/FolderResource.h"
-#include "../Resource/AnimationResource.h"
-#include "../Resource/DataResource.h"
+#include "../Resource/Folder.h"
+#include "../Resource/Animation.h"
+#include "../Resource/DataArray.h"
 #include "../Resource/GRE.h"
-#include "../Resource/PointerResource.h"
+#include "../Resource/Pointer.h"
 #include "OS.h"
 #include "Animation.h"
 
@@ -67,14 +67,14 @@
 		PointerLayer->isVisible=false;
 	}
 
-	void PointerCollection::Fetch(FolderResource *Folder) {
+	void PointerCollection::Fetch(Folder *Folder) {
 		if(Folder->getCount()==0) return;
 
 		if(Folder->getItem(0)->getGID()==GID::Data) {
-			DataResource *data=Folder->asData(0);
+			DataArray *data=Folder->asData(0);
 
 			int i=0;
-			for(SortedCollection<ResourceBase>::Iterator resource=Folder->Subitems.First()+1;resource.isValid();resource.Next()) {
+			for(SortedCollection<resource::Base>::Iterator resource=Folder->Subitems.First()+1;resource.IsValid();resource.Next()) {
 				RectangularGraphic2DSequenceProvider *anim=dynamic_cast<RectangularGraphic2DSequenceProvider *>(resource.CurrentPtr());
 				utils::Collection<Pointer, 10>::Add( new Pointer(&anim->CreateAnimation(), data->getPoint(i+1).x, data->getPoint(i+1).y, (Pointer::PointerType)data->getInt(i)) );
 
@@ -85,8 +85,8 @@
 				BasePointer=&(*this)[0];
 		}
 		else {
-			for(SortedCollection<ResourceBase>::Iterator resource=Folder->Subitems.First();resource.isValid();resource.Next()) {
-				resource::PointerResource *ptr=dynamic_cast<resource::PointerResource *>(resource.CurrentPtr());
+			for(SortedCollection<resource::Base>::Iterator resource=Folder->Subitems.First();resource.IsValid();resource.Next()) {
+				resource::Pointer *ptr=dynamic_cast<resource::Pointer *>(resource.CurrentPtr());
 				utils::Collection<Pointer, 10>::Add( new Pointer(ptr->CreateAnimation(true), ptr->Hotspot, ptr->Type) );
 			}
 
@@ -111,7 +111,7 @@
 	PointerCollection::Token PointerCollection::Set(Pointer::PointerType Type) {
 		if(Type==Pointer::None)
 			return Set(BasePointer);
-		for(Collection<Pointer,10>::Iterator pointer=this->First();pointer.isValid();pointer.Next()) {
+		for(Collection<Pointer,10>::Iterator pointer=this->First();pointer.IsValid();pointer.Next()) {
 			if(pointer->Type==Type)
 				return Set(pointer.CurrentPtr());
 		}
--- a/Engine/Pointer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Pointer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -8,7 +8,7 @@
 namespace gge {
 	class GGEMain;
 	namespace graphics { class Basic2DLayer; }
-	namespace resource { class FolderResource; }
+	namespace resource { class Folder; }
 
 
 	class Pointer {
@@ -84,8 +84,8 @@
 		/// a data file as the first item containing two entries per pointer. First entry must be
 		/// the Type(integer) ranging 0-6, second is Hotspot(point). Every pointer should be either
 		/// animation or image resource
-		void Fetch(resource::FolderResource *Folder);
-		void Fetch(resource::FolderResource &Folder) { Fetch(&Folder); }
+		void Fetch(resource::Folder *Folder);
+		void Fetch(resource::Folder &Folder) { Fetch(&Folder); }
 		////Adds a pointer to the list of pointers
 		Pointer *Add(graphics::RectangularGraphic2D *Pointer, utils::Point Hotspot=utils::Point(2,2), Pointer::PointerType Type=Pointer::None);
 		////Adds a pointer to the list of pointers
--- a/Engine/Wave.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Engine/Wave.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -12,7 +12,7 @@
 		}
 
 		void CollectWaveGarbage() {
-			for(Collection<Wave>::Iterator wave=Waves.First();wave.isValid();wave.Next()) {
+			for(Collection<Wave>::Iterator wave=Waves.First();wave.IsValid();wave.Next()) {
 				if(!wave->isPlaying()) {
 					if(wave->AutoDestruct) {
 						wave.Delete();
--- a/GGE.vcxproj	Sun Feb 26 21:17:47 2012 +0000
+++ b/GGE.vcxproj	Tue Feb 28 09:58:13 2012 +0000
@@ -57,7 +57,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
     <Lib>
-      <AdditionalDependencies>OpenGL32.lib;External/OpenAL/OpenAL32.lib;winmm.lib;gdi32.lib</AdditionalDependencies>
+      <AdditionalDependencies>OpenGL32.lib;External/OpenAL/OpenAL32.lib;winmm.lib;gdi32.lib;shell32.lib;advapi32.lib</AdditionalDependencies>
     </Lib>
     <Lib>
       <AdditionalLibraryDirectories>
@@ -85,7 +85,7 @@
     <Lib>
       <AdditionalLibraryDirectories>
       </AdditionalLibraryDirectories>
-      <AdditionalDependencies>OpenGL32.lib;Externals/OpenAL/OpenAL32.lib;winmm.lib;gdi32.lib</AdditionalDependencies>
+      <AdditionalDependencies>OpenGL32.lib;External/OpenAL/OpenAL32.lib;winmm.lib;gdi32.lib;shell32.lib</AdditionalDependencies>
     </Lib>
   </ItemDefinitionGroup>
   <ItemGroup>
@@ -242,23 +242,23 @@
     <ClInclude Include="External\zlib\zconf.h" />
     <ClInclude Include="External\zlib\zlib.h" />
     <ClInclude Include="External\zlib\zutil.h" />
-    <ClInclude Include="Resource\AnimationResource.h" />
-    <ClInclude Include="Resource\BitmapFontResource.h" />
-    <ClInclude Include="Resource\DataResource.h" />
+    <ClInclude Include="Resource\Animation.h" />
+    <ClInclude Include="Resource\BitmapFont.h" />
+    <ClInclude Include="Resource\DataArray.h" />
     <ClInclude Include="Resource\Definitions.h" />
-    <ClInclude Include="Resource\FolderResource.h" />
+    <ClInclude Include="Resource\Folder.h" />
     <ClInclude Include="Resource\FontTheme.h" />
     <ClInclude Include="Resource\GRE.h" />
-    <ClInclude Include="Resource\ImageResource.h" />
+    <ClInclude Include="Resource\Image.h" />
     <ClInclude Include="Resource\LinkNode.h" />
     <ClInclude Include="Resource\Main.h" />
     <ClInclude Include="Resource\NullImage.h" />
-    <ClInclude Include="Resource\PointerResource.h" />
+    <ClInclude Include="Resource\Pointer.h" />
     <ClInclude Include="Resource\ResizableObject.h" />
-    <ClInclude Include="Resource\ResourceBase.h" />
-    <ClInclude Include="Resource\ResourceFile.h" />
-    <ClInclude Include="Resource\SoundResource.h" />
-    <ClInclude Include="Resource\TextResource.h" />
+    <ClInclude Include="Resource\Base.h" />
+    <ClInclude Include="Resource\File.h" />
+    <ClInclude Include="Resource\Sound.h" />
+    <ClInclude Include="Resource\Text.h" />
     <ClInclude Include="Utils\Any.h" />
     <ClInclude Include="Utils\BasicGraphics.h" />
     <ClInclude Include="Utils\BasicMath.h" />
@@ -796,21 +796,46 @@
       <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
       <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
     </ClCompile>
-    <ClCompile Include="Resource\AnimationResource.cpp" />
-    <ClCompile Include="Resource\BitmapFontResource.cpp" />
-    <ClCompile Include="Resource\DataResource.cpp" />
-    <ClCompile Include="Resource\FolderResource.cpp" />
+    <ClCompile Include="Resource\Animation.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/AnimationResource.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/AnimationResource.obj</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="Resource\BitmapFont.cpp" />
+    <ClCompile Include="Resource\DataArray.cpp" />
+    <ClCompile Include="Resource\Folder.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/FolderResource.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/FolderResource.obj</ObjectFileName>
+    </ClCompile>
     <ClCompile Include="Resource\FontTheme.cpp" />
-    <ClCompile Include="Resource\ImageResource.cpp" />
+    <ClCompile Include="Resource\Image.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/ImageResource.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/ImageResource.obj</ObjectFileName>
+    </ClCompile>
     <ClCompile Include="Resource\LinkNode.cpp" />
     <ClCompile Include="Resource\Main.cpp">
       <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)\ResourceMain.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\ResourceMain.obj</ObjectFileName>
     </ClCompile>
-    <ClCompile Include="Resource\PointerResource.cpp" />
-    <ClCompile Include="Resource\ResourceBase.cpp" />
-    <ClCompile Include="Resource\ResourceFile.cpp" />
-    <ClCompile Include="Resource\SoundResource.cpp" />
-    <ClCompile Include="Resource\TextResource.cpp" />
+    <ClCompile Include="Resource\Pointer.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/PointerResource.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/PointerResource.obj</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="Resource\Base.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/ResourceBase.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/ResourceBase.obj</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="Resource\File.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/ResourceFile.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/ResourceFile.obj</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="Resource\Sound.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/SoundResource.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/SoundResource.obj</ObjectFileName>
+    </ClCompile>
+    <ClCompile Include="Resource\Text.cpp">
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)/TextResouce.obj</ObjectFileName>
+      <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)/TextResouce.obj</ObjectFileName>
+    </ClCompile>
     <ClCompile Include="Utils\Random.cpp" />
     <ClCompile Include="Utils\SGuid.cpp" />
     <ClCompile Include="Widgets\Base\Organizer.cpp" />
--- a/GGE.vcxproj.filters	Sun Feb 26 21:17:47 2012 +0000
+++ b/GGE.vcxproj.filters	Tue Feb 28 09:58:13 2012 +0000
@@ -507,36 +507,9 @@
     <ClInclude Include="External\OpenAL\alc.h">
       <Filter>External\OpenAL</Filter>
     </ClInclude>
-    <ClInclude Include="Resource\AnimationResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\BitmapFontResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\DataResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\FolderResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
     <ClInclude Include="Resource\FontTheme.h">
       <Filter>Resource</Filter>
     </ClInclude>
-    <ClInclude Include="Resource\ImageResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\PointerResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\ResourceFile.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\SoundResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
-    <ClInclude Include="Resource\TextResource.h">
-      <Filter>Resource</Filter>
-    </ClInclude>
     <ClInclude Include="Resource\Main.h">
       <Filter>Resource\Headers</Filter>
     </ClInclude>
@@ -555,9 +528,6 @@
     <ClInclude Include="Resource\LinkNode.h">
       <Filter>Resource\Headers</Filter>
     </ClInclude>
-    <ClInclude Include="Resource\ResourceBase.h">
-      <Filter>Resource\Headers</Filter>
-    </ClInclude>
     <ClInclude Include="Utils\Any.h">
       <Filter>Utils</Filter>
     </ClInclude>
@@ -954,6 +924,36 @@
     <ClInclude Include="Widgets\Organizers\LinearOrganizer.h">
       <Filter>Widgets\Organizers</Filter>
     </ClInclude>
+    <ClInclude Include="Resource\Animation.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\BitmapFont.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\DataArray.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Folder.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Image.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Pointer.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\File.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Sound.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Text.h">
+      <Filter>Resource</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource\Base.h">
+      <Filter>Resource\Headers</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Effects\CountingText.cpp">
@@ -1223,45 +1223,15 @@
     <ClCompile Include="External\LZMA\LzmaDecode.cpp">
       <Filter>External\LZMA</Filter>
     </ClCompile>
-    <ClCompile Include="Resource\AnimationResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\BitmapFontResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\DataResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\FolderResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
     <ClCompile Include="Resource\FontTheme.cpp">
       <Filter>Resource\Sources</Filter>
     </ClCompile>
-    <ClCompile Include="Resource\ImageResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
     <ClCompile Include="Resource\LinkNode.cpp">
       <Filter>Resource\Sources</Filter>
     </ClCompile>
     <ClCompile Include="Resource\Main.cpp">
       <Filter>Resource\Sources</Filter>
     </ClCompile>
-    <ClCompile Include="Resource\PointerResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\ResourceBase.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\ResourceFile.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\SoundResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
-    <ClCompile Include="Resource\TextResource.cpp">
-      <Filter>Resource\Sources</Filter>
-    </ClCompile>
     <ClCompile Include="Utils\Random.cpp">
       <Filter>Utils</Filter>
     </ClCompile>
@@ -1580,6 +1550,36 @@
     <ClCompile Include="Widgets\Organizers\LinearOrganizer.cpp">
       <Filter>Widgets\Code\Sources</Filter>
     </ClCompile>
+    <ClCompile Include="Resource\Animation.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\BitmapFont.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\DataArray.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Folder.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Image.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Pointer.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Base.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\File.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Sound.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
+    <ClCompile Include="Resource\Text.cpp">
+      <Filter>Resource\Sources</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="Widgets\ClassDiagram.cd">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Animation.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,153 @@
+#include "Animation.h"
+#include "File.h"
+#include "Image.h"
+#include "..\Utils\BasicMath.h"
+
+using namespace gge::utils;
+using namespace gge::graphics;
+using namespace std;
+
+namespace gge { namespace resource {
+
+	void LoadAnimationResourceEx(Animation *anim, File &File, std::istream &Data, int Size) {
+		int target=Data.tellg()+Size;
+		while(Data.tellg()<target) {
+			int gid,size;
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+
+			if(gid==GID::Animation_Durations) {
+				unsigned t=0;
+
+				for(int i=0;i<size/4;i++) {
+					unsigned d=ReadFrom<int>(Data);
+					anim->Frames.push_back(AnimationResourceFrame(d,t));
+
+					t+=d;
+				}
+
+				anim->TotalLength=t;
+			} 
+			else if(gid==GID::Guid) {
+				anim->guid.LoadLong(Data);
+			} 
+			else if(gid==GID::SGuid) {
+				anim->guid.Load(Data);
+			} 
+			else if(gid==GID::Animation_Image) {
+				anim->Subitems.Add(LoadImageResource(File,Data,size), anim->Subitems.HighestOrder()+1);
+			} 
+			else {
+				anim->LoadExtra(File, Data, gid, size);
+			}
+		}
+
+		int i=0;
+		for(SortedCollection<Base>::Iterator it=anim->Subitems.First();it.IsValid();it.Next(), i++)
+			anim->Frames[i].Image=&dynamic_cast<Image&>(*it);
+
+		anim->FrameCount=anim->Subitems.getCount();
+	}
+
+
+	Animation *LoadAnimationResource(File &File, std::istream &Data, int Size) {
+		Animation *anim=new Animation;
+		LoadAnimationResourceEx(anim, File, Data, Size);
+
+		return anim;
+	}
+
+	animation::ProgressResult::Type ImageAnimation::Progress() {
+		if(Controller && parent.Frames.size()) { 
+			if(Controller->GetType()==animation::Timer::Discrete) {
+				animation::DiscreteController *dc = dynamic_cast<animation::DiscreteController *>(Controller);
+
+				int cf=dc->CurrentFrame();
+				int fc=parent.FrameCount;
+
+				cf=cf % fc;
+
+				if(cf<0) {
+					Texture.ID=0;
+					return animation::ProgressResult::None;
+				}
+
+				Texture=parent[cf].GetTexture();
+
+				return animation::ProgressResult::None;
+			}
+			else {
+				animation::ProgressResult::Type ret=animation::ProgressResult::None;
+
+				int t=Controller->GetProgress();
+				int tl=(int)parent.GetTotalLength();
+
+				//this will cause the animation to loop if its simple timer
+				//and stop if it is controlled.
+				if( t>=parent.StartOf(parent.GetNumberofFrames()-1) ) {
+					ret=animation::ProgressResult::Finished;
+				}
+				if(t<0) {
+					t=0;
+					ret=animation::ProgressResult::Finished;
+				}
+
+				t=PositiveMod(t,tl);
+				GLTexture &tx=parent.ImageAt(t).GetTexture();
+				if(tx.ID!=Texture.ID)
+					Texture=tx;
+
+				return ret;
+			}
+		}
+		else {
+			Texture.ID=0;
+
+			return animation::ProgressResult::None;
+		}
+	}
+
+	ImageAnimation::ImageAnimation( Animation &parent, animation::Timer &controller, bool owner ) : 
+	animation::Base(controller, owner), parent(parent)
+	{
+		Texture=parent.ImageAt(0).GetTexture();
+	}
+
+	ImageAnimation::ImageAnimation( Animation &parent, bool create ) : 
+	animation::Base(create), parent(parent)
+	{
+		Texture=parent.ImageAt(0).GetTexture();
+	}
+
+
+
+	int Animation::FrameAt( unsigned t ) const {
+		if(Subitems.getCount()==0) return -1;
+
+		if(t>=(Frames.end()-1)->Start)
+			return FrameCount-1;
+
+		int Guessed=(int)floor( ((float)t/TotalLength)*FrameCount );
+
+		if(Frames[Guessed].Start>t) {
+			while(Frames[Guessed].Start>t)
+				Guessed--;
+
+			return Guessed;
+		}
+		else if(Frames[Guessed+1].Start<t) {
+			while(Frames[Guessed+1].Start<t)
+				Guessed++;
+
+			return Guessed;
+		} 
+		else
+			return Guessed;
+	}
+
+	void Animation::LoadExtra(File &File, std::istream &Data, GID::Type gid, int size) {
+		EatChunk(Data, size);
+	}
+
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Animation.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,134 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "../Engine/Animation.h"
+#include "Image.h"
+#include "../Resource/ResizableObject.h"
+#include "../Utils/Point2D.h"
+
+#pragma warning(push)
+#pragma warning(disable:4250)
+
+namespace gge { namespace resource {
+	class File;
+
+	class Animation;
+	
+	////This function loads a text resource from the given file
+	Animation *LoadAnimationResource(File &File, std::istream &Data, int Size);
+
+	////This class draws an animated image
+	class ImageAnimation : 
+		virtual public ResizableObject, public graphics::ImageTexture, virtual public animation::RectangularGraphic2DAnimation
+	{
+	public:
+
+		ImageAnimation(Animation &parent, animation::Timer &controller, bool owner=false);
+		ImageAnimation(Animation &parent, bool create=false);
+
+		virtual graphics::GLTexture &GetTexture() { return ImageTexture::GetTexture(); }
+
+		Animation &parent;
+
+	protected:
+		virtual animation::ProgressResult::Type Progress();
+	};
+
+
+	class AnimationResourceFrame {
+	public:
+		AnimationResourceFrame(unsigned d=0, unsigned s=0, Image *im=NULL) : Duration(d), Start(s), Image(im) { }
+
+		unsigned Duration;
+		unsigned Start;
+		Image *Image;
+	};
+
+
+	////
+	class Animation : 
+		public Base, virtual public ResizableObjectProvider, 
+		virtual public animation::RectangularGraphic2DSequenceProvider 
+	{
+
+		friend Animation *LoadAnimationResource(File &File, std::istream &Data, int Size);
+		friend void LoadAnimationResourceEx(Animation *anim, File &File, std::istream &Data, int Size);
+		friend class ImageAnimation;
+		friend class DiscreteImageAnimation;
+	public:
+		////03010000h (Gaming, Animation)
+		virtual GID::Type getGID() const { return GID::Animation; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+		
+		////Default constructor
+		Animation() : Base() { FrameCount=TotalLength=0; }
+
+		////Returns the width of the first image
+		int GetWidth() const { if(Subitems.getCount()>0) return Frames[0].Image->GetWidth(); return 0; }
+		////Returns the height of the first image
+		int GetHeight() const { if(Subitems.getCount()>0) return Frames[0].Image->GetHeight(); return 0; }
+		////Returns number of frames
+		int GetFrameCount() const { return FrameCount; }
+
+		virtual ImageAnimation &CreateAnimation(animation::Timer &controller, bool owner=false) {
+			return *new ImageAnimation(*this, controller, owner);
+		}
+
+		virtual ImageAnimation &CreateAnimation(bool create=false) {
+			return *new ImageAnimation(*this, create);
+		}
+
+		virtual ImageAnimation &CreateResizableObject(animation::Timer &controller, bool owner=false) {
+			return *new ImageAnimation(*this, controller, owner);
+		}
+
+		virtual ImageAnimation &CreateResizableObject(bool create=false) {
+			return *new ImageAnimation(*this, create);
+		}
+
+		virtual Image &ImageAt(int t) { 
+			t=utils::PositiveMod(t, GetDuration());
+
+			return *Frames[FrameAt(t)].Image; 
+		} //Null Image
+
+		//graphics::RectangularGraphic2D &GraphicAt(unsigned t) { return *Frames[FrameAt(t)].Image; } //Null Image
+
+		unsigned GetTotalLength() const { return TotalLength; }
+
+		Image &operator [](int Frame) {
+			return *Frames[Frame].Image;
+		}
+
+		virtual int FrameAt(unsigned t) const;
+
+		virtual int StartOf(unsigned Frame) const {
+			return Frames[Frame].Start;
+		}
+
+		virtual int GetDuration(unsigned Frame) const {
+			return Frames[Frame].Duration;
+		}
+		virtual int GetDuration() const {
+			return TotalLength;
+		} 
+
+		virtual int GetNumberofFrames() const {
+			return Frames.size();
+		}
+
+
+	protected:
+		////Total number of frames that this animation have
+		int FrameCount;
+		////Frame durations
+		std::vector<AnimationResourceFrame> Frames;
+		unsigned TotalLength;
+
+		virtual void LoadExtra(File &File, std::istream &Data, GID::Type gid, int size);
+	};
+} }
+
+#pragma warning(pop)
\ No newline at end of file
--- a/Resource/AnimationResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-#include "AnimationResource.h"
-#include "ResourceFile.h"
-#include "ImageResource.h"
-#include "..\Utils\BasicMath.h"
-
-using namespace gge::utils;
-using namespace gge::graphics;
-using namespace std;
-
-namespace gge { namespace resource {
-
-	void LoadAnimationResourceEx(AnimationResource *anim, File &File, std::istream &Data, int Size) {
-		int target=Data.tellg()+Size;
-		while(Data.tellg()<target) {
-			int gid,size;
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-
-			if(gid==GID::Animation_Durations) {
-				unsigned t=0;
-
-				for(int i=0;i<size/4;i++) {
-					unsigned d=ReadFrom<int>(Data);
-					anim->Frames.push_back(AnimationResourceFrame(d,t));
-
-					t+=d;
-				}
-
-				anim->TotalLength=t;
-			} 
-			else if(gid==GID::Guid) {
-				anim->guid.LoadLong(Data);
-			} 
-			else if(gid==GID::SGuid) {
-				anim->guid.Load(Data);
-			} 
-			else if(gid==GID::Animation_Image) {
-				anim->Subitems.Add(LoadImageResource(File,Data,size), anim->Subitems.HighestOrder()+1);
-			} 
-			else {
-				anim->LoadExtra(File, Data, gid, size);
-			}
-		}
-
-		int i=0;
-		for(SortedCollection<ResourceBase>::Iterator it=anim->Subitems.First();it.isValid();it.Next(), i++)
-			anim->Frames[i].Image=&dynamic_cast<ImageResource&>(*it);
-
-		anim->FrameCount=anim->Subitems.getCount();
-	}
-
-
-	AnimationResource *LoadAnimationResource(File &File, std::istream &Data, int Size) {
-		AnimationResource *anim=new AnimationResource;
-		LoadAnimationResourceEx(anim, File, Data, Size);
-
-		return anim;
-	}
-
-	animation::ProgressResult::Type ImageAnimation::Progress() {
-		if(Controller && parent.Frames.size()) { 
-			if(Controller->GetType()==animation::AnimationTimer::Discrete) {
-				animation::DiscreteController *dc = dynamic_cast<animation::DiscreteController *>(Controller);
-
-				int cf=dc->CurrentFrame();
-				int fc=parent.FrameCount;
-
-				cf=cf % fc;
-
-				if(cf<0) {
-					Texture.ID=0;
-					return animation::ProgressResult::None;
-				}
-
-				Texture=parent[cf].GetTexture();
-
-				return animation::ProgressResult::None;
-			}
-			else {
-				animation::ProgressResult::Type ret=animation::ProgressResult::None;
-
-				int t=Controller->GetProgress();
-				int tl=(int)parent.GetTotalLength();
-
-				//this will cause the animation to loop if its simple timer
-				//and stop if it is controlled.
-				if( t>=parent.StartOf(parent.GetNumberofFrames()-1) ) {
-					ret=animation::ProgressResult::Finished;
-				}
-				if(t<0) {
-					t=0;
-					ret=animation::ProgressResult::Finished;
-				}
-
-				t=PositiveMod(t,tl);
-				GLTexture &tx=parent.ImageAt(t).GetTexture();
-				if(tx.ID!=Texture.ID)
-					Texture=tx;
-
-				return ret;
-			}
-		}
-		else {
-			Texture.ID=0;
-
-			return animation::ProgressResult::None;
-		}
-	}
-
-	ImageAnimation::ImageAnimation( AnimationResource &parent, animation::AnimationTimer &controller, bool owner ) : 
-	animation::AnimationBase(controller, owner), parent(parent)
-	{
-		Texture=parent.ImageAt(0).GetTexture();
-	}
-
-	ImageAnimation::ImageAnimation( AnimationResource &parent, bool create ) : 
-	animation::AnimationBase(create), parent(parent)
-	{
-		Texture=parent.ImageAt(0).GetTexture();
-	}
-
-
-
-	int AnimationResource::FrameAt( unsigned t ) const {
-		if(Subitems.getCount()==0) return -1;
-
-		if(t>=(Frames.end()-1)->Start)
-			return FrameCount-1;
-
-		int Guessed=(int)floor( ((float)t/TotalLength)*FrameCount );
-
-		if(Frames[Guessed].Start>t) {
-			while(Frames[Guessed].Start>t)
-				Guessed--;
-
-			return Guessed;
-		}
-		else if(Frames[Guessed+1].Start<t) {
-			while(Frames[Guessed+1].Start<t)
-				Guessed++;
-
-			return Guessed;
-		} 
-		else
-			return Guessed;
-	}
-
-	void AnimationResource::LoadExtra(File &File, std::istream &Data, GID::Type gid, int size) {
-		EatChunk(Data, size);
-	}
-
-
-} }
--- a/Resource/AnimationResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "../Engine/Animation.h"
-#include "ImageResource.h"
-#include "../Resource/ResizableObject.h"
-#include "../Utils/Point2D.h"
-
-#pragma warning(push)
-#pragma warning(disable:4250)
-
-namespace gge { namespace resource {
-	class File;
-
-	class AnimationResource;
-	
-	////This function loads a text resource from the given file
-	AnimationResource *LoadAnimationResource(File &File, std::istream &Data, int Size);
-
-	////This class draws an animated image
-	class ImageAnimation : 
-		virtual public ResizableObject, public graphics::ImageTexture, virtual public animation::RectangularGraphic2DAnimation
-	{
-	public:
-
-		ImageAnimation(AnimationResource &parent, animation::AnimationTimer &controller, bool owner=false);
-		ImageAnimation(AnimationResource &parent, bool create=false);
-
-		virtual graphics::GLTexture &GetTexture() { return ImageTexture::GetTexture(); }
-
-		AnimationResource &parent;
-
-	protected:
-		virtual animation::ProgressResult::Type Progress();
-	};
-
-
-	class AnimationResourceFrame {
-	public:
-		AnimationResourceFrame(unsigned d=0, unsigned s=0, ImageResource *im=NULL) : Duration(d), Start(s), Image(im) { }
-
-		unsigned Duration;
-		unsigned Start;
-		ImageResource *Image;
-	};
-
-
-	////
-	class AnimationResource : 
-		public ResourceBase, virtual public ResizableObjectProvider, 
-		virtual public animation::RectangularGraphic2DSequenceProvider 
-	{
-
-		friend AnimationResource *LoadAnimationResource(File &File, std::istream &Data, int Size);
-		friend void LoadAnimationResourceEx(AnimationResource *anim, File &File, std::istream &Data, int Size);
-		friend class ImageAnimation;
-		friend class DiscreteImageAnimation;
-	public:
-		////03010000h (Gaming, Animation)
-		virtual GID::Type getGID() const { return GID::Animation; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-		
-		////Default constructor
-		AnimationResource() : ResourceBase() { FrameCount=TotalLength=0; }
-
-		////Returns the width of the first image
-		int GetWidth() const { if(Subitems.getCount()>0) return Frames[0].Image->GetWidth(); return 0; }
-		////Returns the height of the first image
-		int GetHeight() const { if(Subitems.getCount()>0) return Frames[0].Image->GetHeight(); return 0; }
-		////Returns number of frames
-		int GetFrameCount() const { return FrameCount; }
-
-		virtual ImageAnimation &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) {
-			return *new ImageAnimation(*this, controller, owner);
-		}
-
-		virtual ImageAnimation &CreateAnimation(bool create=false) {
-			return *new ImageAnimation(*this, create);
-		}
-
-		virtual ImageAnimation &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) {
-			return *new ImageAnimation(*this, controller, owner);
-		}
-
-		virtual ImageAnimation &CreateResizableObject(bool create=false) {
-			return *new ImageAnimation(*this, create);
-		}
-
-		virtual ImageResource &ImageAt(int t) { 
-			t=utils::PositiveMod(t, GetDuration());
-
-			return *Frames[FrameAt(t)].Image; 
-		} //Null Image
-
-		//graphics::RectangularGraphic2D &GraphicAt(unsigned t) { return *Frames[FrameAt(t)].Image; } //Null Image
-
-		unsigned GetTotalLength() const { return TotalLength; }
-
-		ImageResource &operator [](int Frame) {
-			return *Frames[Frame].Image;
-		}
-
-		virtual int FrameAt(unsigned t) const;
-
-		virtual int StartOf(unsigned Frame) const {
-			return Frames[Frame].Start;
-		}
-
-		virtual int GetDuration(unsigned Frame) const {
-			return Frames[Frame].Duration;
-		}
-		virtual int GetDuration() const {
-			return TotalLength;
-		} 
-
-		virtual int GetNumberofFrames() const {
-			return Frames.size();
-		}
-
-
-	protected:
-		////Total number of frames that this animation have
-		int FrameCount;
-		////Frame durations
-		std::vector<AnimationResourceFrame> Frames;
-		unsigned TotalLength;
-
-		virtual void LoadExtra(File &File, std::istream &Data, GID::Type gid, int size);
-	};
-} }
-
-#pragma warning(pop)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Base.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,61 @@
+#include "Base.h"
+
+using namespace gge::utils;
+
+namespace gge { namespace resource {
+	void Base::Prepare(GGEMain &main, File &file) {
+		for(SortedCollection<Base>::Iterator resource=Subitems.First();
+			resource.IsValid(); resource.Next()) {
+
+			resource->Prepare(main, file);
+		}
+	}
+
+	void Base::Resolve(File &file) {
+		for(SortedCollection<Base>::Iterator resource=Subitems.First();
+			resource.IsValid();) {
+
+			Base &r=resource;
+			resource.Next();
+
+			r.Resolve(file);
+		}
+	}
+
+	Base *Base::FindObject(utils::SGuid guid) {
+		for(SortedCollection<Base>::Iterator resource=Subitems.First();
+			resource.IsValid(); resource.Next()) {
+
+			if(resource->isEqual(guid))
+				return resource.CurrentPtr();
+
+			Base *temp=resource->FindObject(guid);
+			if(temp)
+				return temp;
+		}
+
+		return NULL;
+	}
+
+	Base *Base::FindParent(utils::SGuid guid) {
+		for(SortedCollection<Base>::Iterator resource=Subitems.First();
+			resource.IsValid(); resource.Next()) {
+
+			if(resource->isEqual(guid))
+				return this;
+
+			Base *temp=resource->FindParent(guid);
+			if(temp)
+				return temp;
+		}
+
+		return NULL;
+	}
+
+	Base::Base() : guid(nullptr), name(""), caption("") { }
+
+	Base::~Base() {
+		Subitems.Destroy();
+	}
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Base.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,56 @@
+#pragma once
+
+#include "../Utils/Collection.h"
+#include "../Engine/GGEMain.h"
+#include "../Utils/SGuid.h"
+
+#include "GRE.h"
+#include "Definitions.h"
+
+#include <fstream>
+#include <iosfwd>
+
+using namespace gge;
+
+namespace gge { namespace resource {
+
+
+	////This class is the base for all Gorgon Resources
+	class Base {
+	public:
+		////This function shall return Gorgon ID of this resource
+		virtual GID::Type getGID() const = 0;
+		////This function shall prepare this resource to be used
+		/// after file is loaded, default behavior is to pass
+		/// the request to children
+		virtual void Prepare(GGEMain &main, File &file);
+		////This function shall resolve links or similar constructs
+		virtual void Resolve(File &file);
+
+		Base();
+		virtual ~Base();
+		
+		////This function shall save this resource to the given file
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+
+		////This function tests whether this object has the given utils::SGuid
+		bool isEqual(const utils::SGuid &guid) const { return guid==this->guid; }
+
+		////utils::SGuid to identify this resource object
+		utils::SGuid guid;
+		////Name of this resource object, may not be loaded.
+		string name;
+		////Caption of this resource object, may not be loaded.
+		string caption;
+
+		////Subitems that this resource object have. Some of the sub items
+		/// can be hidden therefore, this is not guaranteed to be complete
+		utils::SortedCollection<Base> Subitems;
+
+		////Searches the public children of this resource object
+		virtual Base *FindObject(utils::SGuid guid);
+
+		////Searches the public children of this resource object
+		virtual Base *FindParent(utils::SGuid guid);
+	};
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/BitmapFont.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,775 @@
+#include "BitmapFont.h"
+#include "File.h"
+#include "..\Engine\Graphics.h"
+
+#ifndef MAX_CHAR_DETECTS
+#define MAX_CHAR_DETECTS	10
+#endif
+
+using namespace gge::graphics;
+using namespace gge::utils;
+using namespace std;
+
+namespace gge { namespace resource {
+	BitmapFont *LoadBitmapFontResource(File &File, std::istream &Data, int Size) {
+		BitmapFont *font=new BitmapFont;
+		int chmap[256];
+		int cpos=0,i;
+
+		font->Seperator=1;
+
+		int target=Data.tellg()+Size;
+		while(Data.tellg()<target) {
+			int gid,size;
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+
+			if(gid==GID::Font_Charmap) {
+				Data.read((char*)chmap, 4*256);
+			}
+			else if(gid==GID::Guid) {
+				font->guid.LoadLong(Data);
+			}
+			else if(gid==GID::SGuid) {
+				font->guid.Load(Data);
+			}
+			else if(gid==GID::Font_Image) {
+				Image *img=LoadImageResource(File,Data,size);
+
+				for(i=0;i<256;i++)
+					if(chmap[i]==cpos)
+						font->Characters[i]=img;
+
+				font->Subitems.Add(img);
+				cpos++;
+			}
+			else if(gid==GID::Font_Props) {
+				ReadFrom(Data,font->Seperator);
+				ReadFrom(Data,font->VerticalSpacing);
+				ReadFrom(Data,font->Baseline);
+			}
+			else {
+				EatChunk(Data,size);
+			}
+		}
+
+		return font;
+	}
+	void BitmapFont::Print(graphics::ColorizableImageTarget2D *target, int X, int Y, const std::string &text, graphics::RGBint color, ShadowParams Shadow) {
+		if(text=="") return;
+
+		RGBint cc=target->GetCurrentColor();
+
+		unsigned int i;
+		if(Shadow.Type==ShadowParams::Flat) {
+			int x=X;
+			target->SetCurrentColor(Shadow.Color);
+			for(i=0;i<text.length();i++) {
+				Image *img=Characters[text[i]];
+				img->Draw(target,x+Shadow.Offset.x,Y+Shadow.Offset.y);
+				x+=img->GetWidth() + Seperator;
+			}
+		}
+		else if(Shadow.Type==ShadowParams::DropShadow) {
+			BitmapFont &shadow=Blur(Shadow.Blur);
+			int sizediff=(shadow.TextWidth(" ")-TextWidth(" "))/2;
+			shadow.Print(target, X+Shadow.Offset.x-sizediff, Y+Shadow.Offset.y-sizediff, text, Shadow.Color);
+		}
+
+		target->SetCurrentColor(color);
+		for(i=0;i<text.length();i++) {
+			Image *img=Characters[text[i]];
+			img->Draw(target,X,Y);
+			X+=img->GetWidth() + Seperator;
+		}
+
+		target->SetCurrentColor(cc);
+	}
+
+	void BitmapFont::Print(graphics::ColorizableImageTarget2D *target, int x, int y, int w, const std::string &text, graphics::RGBint color, TextAlignment::Type align, ShadowParams Shadow) {
+		unsigned i;
+		int l=x;
+		int lstart=0,lword=0;
+		int llen=0;
+		int lww=0;
+		int fh=FontHeight();
+		int j;
+		bool nextline=false;
+		bool wrap=true;
+
+		if(text=="") return;
+
+
+		if(Shadow.Type==ShadowParams::Flat)
+			Print(target,x+Shadow.Offset.x,y+Shadow.Offset.y,w,text,Shadow.Color,align);
+		else if(Shadow.Type==ShadowParams::DropShadow) {
+			BitmapFont &shadow=Blur(Shadow.Blur);
+			int sizediff=(shadow.TextWidth(" ")-TextWidth(" "))/2;
+			shadow.Print(target, x+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff, w, text, Shadow.Color, align);
+		}
+
+		RGBint cc=target->GetCurrentColor();
+		target->SetCurrentColor(color);
+
+		if(w==0) {
+			/*align=TextAlignment::Left;
+			w=10000;*/
+			wrap=false;
+		}
+
+		for(i=0;i<text.length();i++) {
+			if(text[i]=='\n') {
+				lword=i-1;
+				lww=llen;
+				nextline=true;
+			}
+			else {
+				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
+
+				if(text[i]==' ' || text[i]==',' || text[i]==')') {
+					lword=i;
+					lww=llen;
+				}
+
+				if(llen>w && wrap) {
+					if(lword<=lstart) {
+						lword=i;
+						lww=llen;
+					}
+
+					nextline=true;
+				}
+				if(i==text.length()-1) {
+					lword=i;
+					lww=llen;
+
+					nextline=true;
+				}
+			}
+
+			if(nextline) {
+				switch(align) {
+				case TextAlignment::Left:
+					l=x;
+					break;
+				case TextAlignment::Center:
+					l=x+(w-lww)/2;
+					break;
+				case TextAlignment::Right:
+					l=x+(w-lww);
+					break;
+
+				}
+
+				for(j=lstart;j<lword+1;j++) {
+					if(text[j]=='\t') {
+						Image *img=Characters[(unsigned char)' '];
+						int i;
+						for(i=0;i<Tabsize;i++) {
+							img->Draw(target, l, y);
+							l+=img->GetWidth()+Seperator;
+						}
+					}
+					if(text[j]!='\r') {
+						Image *img=Characters[(unsigned char)text[j]];
+						img->Draw(target, l, y);
+						l+=img->GetWidth()+Seperator;
+					}
+				}
+
+				if(text.length()-1==lword)
+					;
+				else if(text[lword+1]=='\n')
+					lword++;
+
+				lstart=lword+1;
+				i=lword;
+				llen=0;
+				y+=VerticalSpacing;
+				nextline=false;
+			}
+		}
+
+		target->SetCurrentColor(cc);
+	}
+	void BitmapFont::Print(graphics::ColorizableImageTarget2D *target, int x, int y, int w, const std::string &text, graphics::RGBint color, EPrintData *Data, int DataLen, TextAlignment::Type Align, ShadowParams Shadow) {
+
+		RGBint cc=target->GetCurrentColor();
+		target->SetCurrentColor(color);
+		
+		int sizediff;
+		BitmapFont *shadow;
+
+		if(Shadow.Type==ShadowParams::DropShadow) {
+			shadow=&Blur(Shadow.Blur);
+			sizediff=(shadow->TextWidth(" ")-TextWidth(" "))/2;
+		}
+
+		if(text=="") {
+			int d;
+			int xpos=0;
+			if(Align==TextAlignment::Center)
+				xpos=w/2;
+			else if(Align==TextAlignment::Right)
+				xpos=w;
+
+			for(d=0;d<DataLen;d++) {
+				switch(Data[d].Type) {
+				case EPrintData::PositionDetect:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				case EPrintData::Spacing:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				}
+			}
+			return;
+		}
+
+		int i,j,d;
+		int sx=x;
+		int sy=y;
+		int datc=0;
+		int l=x;
+		int lstart=0,lword=0;
+		int llen=0;//line length
+		int lww=0;
+		bool nowrap=false;
+
+		if(w<0) { w=-w; nowrap=true; }
+		bool done;
+		int fh=FontHeight();
+		int *data=(int*)Data;
+		bool nextline=false;
+		struct {int x;EPrintData*data;} chardetectxs[MAX_CHAR_DETECTS];
+		int cchardetectxs=0;
+
+		for(d=0;d<DataLen;d++) {
+			switch(Data[d].Type) {
+			case EPrintData::Wrap:
+				nowrap=!Data[d].In.value;
+				break;
+			case EPrintData::CharacterDetect:
+				if(cchardetectxs<MAX_CHAR_DETECTS) {
+					Data[d].Out.value=text.length();
+					chardetectxs[cchardetectxs].x=Data[d].In.position.x;
+					chardetectxs[cchardetectxs].data=Data+d;
+					cchardetectxs++;
+				}
+				break;
+			}
+		}
+
+
+		if(w==0)
+			nowrap=true;
+
+		switch(Align) {
+		case TextAlignment::Left:
+			l=x;
+			break;
+		case TextAlignment::Center:
+			l=x+w/2;
+			break;
+		case TextAlignment::Right:
+			l=x+w;
+			break;
+		}
+		for(i=0;text[i];i++) {
+			for(d=0;d<DataLen;d++) {
+				if(Data[d].CharPosition==i) {
+					switch(Data[d].Type) {
+					case EPrintData::Spacing:
+						llen+=Data[d].In.position.x-Seperator; 
+						y+=Data[d].In.position.y; 
+						break;
+					}
+				}
+			}
+			if(text[i]=='\n') {
+				lword=i-1;
+				lww=llen;
+				nextline=true;
+			}
+			else {
+				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
+
+				if(text[i]==' ' || text[i]==',' || text[i]==')') {
+					lword=i;
+					lww=llen;
+				}
+
+				if(llen>w && !nowrap) {
+					if(lword<=lstart) {
+						lword=i;
+						lww=llen;
+					}
+
+					nextline=true;
+				}
+				if(!text[i+1]) {
+					lword=i;
+					lww=llen;
+
+					nextline=true;
+				}
+			}
+
+			if(nextline) {
+				switch(Align) {
+				case TextAlignment::Left:
+					l=x;
+					break;
+				case TextAlignment::Center:
+					l=x+(w-lww)/2;
+					break;
+				case TextAlignment::Right:
+					l=x+(w-lww);
+					break;
+				}
+
+				for(j=lstart;j<lword+1;j++) {
+					done=0;
+
+					for(d=0;d<DataLen;d++) {
+						if(Data[d].CharPosition==j) {
+							switch(Data[d].Type) {
+							case EPrintData::Spacing:
+								Data[d].Out.position.x=l;
+								Data[d].Out.position.y=y;
+
+								l+=Data[d].In.position.x-Seperator; 
+								y+=Data[d].In.position.y; 
+								break;
+							case EPrintData::PositionDetect:
+								Data[d].Out.position.x=l;
+								Data[d].Out.position.y=y;
+								break;
+							case EPrintData::Color:
+								color=Data[d].In.color;
+
+								break;
+							case EPrintData::ShadowColor:
+								Shadow.Color=Data[d].In.color;
+
+								break;
+							}
+						}
+					}
+					int dist=0;
+					if(text[j]=='\t') {
+						Image *img=Characters[(unsigned char)' '];
+						int i;
+						for(i=0;i<Tabsize;i++) {
+							if(Shadow.Type==ShadowParams::Flat) {
+								target->SetCurrentColor(Shadow.Color);
+								img->Draw(target,l+Shadow.Offset.x,y+Shadow.Offset.y);
+							}
+							else if(Shadow.Type==ShadowParams::DropShadow) {
+								target->SetCurrentColor(Shadow.Color);
+								shadow->Characters[(unsigned char)' ']->Draw(target, l+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff);
+							}
+
+							target->SetCurrentColor(color);
+							img->Draw(target,l,y);
+							dist+=img->GetWidth()+Seperator;
+						}
+					}
+					else if(text[j]!='\r') {
+						Image *img=Characters[(unsigned char)text[j]];
+						if(Shadow.Type==ShadowParams::Flat) {
+							target->SetCurrentColor(Shadow.Color);
+							img->Draw(target,l+Shadow.Offset.x,y+Shadow.Offset.y);
+						}
+						else if(Shadow.Type==ShadowParams::DropShadow) {
+							target->SetCurrentColor(Shadow.Color);
+							shadow->Characters[(unsigned char)text[j]]->Draw(target, l+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff);
+						}
+
+						target->SetCurrentColor(color);
+						img->Draw(target,l,y);
+						dist=img->GetWidth()+Seperator;
+					}
+					for(d=0;d<cchardetectxs;d++) {
+						if(chardetectxs[d].x<l+dist/2) {//TODO y
+							chardetectxs[d].data->Out.value=j;
+						}
+					}
+					l+=dist;
+
+				}
+
+				if(text[lword+1]=='\n')
+					lword++;
+
+				lstart=lword+1;
+				i=lword;
+				llen=0;
+				if(!nowrap)
+					y+=VerticalSpacing;
+				nextline=false;
+			}
+		}
+		for(d=0;d<DataLen;d++) {
+			if(Data[d].CharPosition==i) {
+				switch(Data[d].Type) {
+				case EPrintData::Spacing:
+					Data[d].Out.position.x=l;
+					Data[d].Out.position.y=y;
+
+					l+=Data[d].In.position.x-Seperator; 
+					y+=Data[d].In.position.y; 
+					break;
+				case EPrintData::PositionDetect:
+					Data[d].Out.position.x=l;
+					Data[d].Out.position.y=y;
+					break;
+				}
+			}
+		}	
+
+		target->SetCurrentColor(cc);
+
+	}
+	void BitmapFont::Print_Test(int x, int y, int w, const std::string &text, EPrintData *Data, int DataLen, TextAlignment::Type Align) {
+		if(text=="") {
+			int d;
+			int xpos=0;
+			if(Align==TextAlignment::Center)
+				xpos=w/2;
+			else if(Align==TextAlignment::Right)
+				xpos=w;
+
+			for(d=0;d<DataLen;d++) {
+				switch(Data[d].Type) {
+				case EPrintData::PositionDetect:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				case EPrintData::Spacing:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				}
+			}
+			return;
+		}
+
+		int i,j,d;
+		int sx=x;
+		int sy=y;
+		int datc=0;
+		int l=x;
+		int lstart=0,lword=0;
+		int llen=0;//line length
+		int lww=0;
+		bool nowrap=false;
+
+		if(w<0) { w=-w; nowrap=true; }
+		bool done;
+		int fh=FontHeight();
+		int *data=(int*)Data;
+		bool nextline=false;
+		struct {int x;EPrintData*data;} chardetectxs[MAX_CHAR_DETECTS];
+		int cchardetectxs=0;
+
+		for(d=0;d<DataLen;d++) {
+			switch(Data[d].Type) {
+			case EPrintData::Wrap:
+				nowrap=!Data[d].In.value;
+				break;
+			case EPrintData::CharacterDetect:
+				if(cchardetectxs<MAX_CHAR_DETECTS) {
+					Data[d].Out.value=text.length();
+					chardetectxs[cchardetectxs].x=Data[d].In.position.x;
+					chardetectxs[cchardetectxs].data=Data+d;
+					cchardetectxs++;
+				}
+				break;
+			}
+		}
+
+		if(w==0)
+			nowrap=true;
+
+		switch(Align) {
+		case TextAlignment::Left:
+			l=x;
+			break;
+		case TextAlignment::Center:
+			l=x+w/2;
+			break;
+		case TextAlignment::Right:
+			l=x+w;
+			break;
+		}
+		for(i=0;text[i];i++) {
+			for(d=0;d<DataLen;d++) {
+				if(Data[d].CharPosition==i) {
+					switch(Data[d].Type) {
+					case EPrintData::Spacing:
+						llen+=Data[d].In.position.x-Seperator; 
+						y+=Data[d].In.position.y; 
+						break;
+					}
+				}
+			}
+			if(text[i]=='\n') {
+				lword=i-1;
+				lww=llen;
+				nextline=true;
+			}
+			else {
+				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
+
+				if(text[i]==' ' || text[i]==',' || text[i]==')') {
+					lword=i;
+					lww=llen;
+				}
+
+				if(llen>w && !nowrap) {
+					if(lword<=lstart) {
+						lword=i;
+						lww=llen;
+					}
+
+					nextline=true;
+				}
+				if(!text[i+1]) {
+					lword=i;
+					lww=llen;
+
+					nextline=true;
+				}
+			}
+
+			if(nextline) {
+				switch(Align) {
+				case TextAlignment::Left:
+					l=x;
+					break;
+				case TextAlignment::Center:
+					l=x+(w-lww)/2;
+					break;
+				case TextAlignment::Right:
+					l=x+(w-lww);
+					break;
+				}
+
+				for(j=lstart;j<lword+1;j++) {
+					done=0;
+
+					for(d=0;d<DataLen;d++) {
+						if(Data[d].CharPosition==j) {
+							switch(Data[d].Type) {
+							case EPrintData::Spacing:
+								Data[d].Out.position.x=l/*-sx*/;
+								Data[d].Out.position.y=y/*-sy*/;
+
+								l+=Data[d].In.position.x-Seperator; 
+								y+=Data[d].In.position.y; 
+								break;
+							case EPrintData::PositionDetect:
+								Data[d].Out.position.x=l/*-sx*/;
+								Data[d].Out.position.y=y/*-sy*/;
+								break;
+							case EPrintData::Color:
+
+								break;
+							case EPrintData::ShadowColor:
+
+								break;
+							}
+						}
+					}
+					int dist=0;
+					if(text[j]=='\t') {
+						Image *img=Characters[(unsigned char)' '];
+						int i;
+						for(i=0;i<Tabsize;i++) {
+							dist+=img->GetWidth()+Seperator;
+						}
+					}
+					else if(text[j]!='\r') {
+						Image *img=Characters[(unsigned char)text[j]];
+						dist=img->GetWidth()+Seperator;
+					}
+					for(d=0;d<cchardetectxs;d++) {
+						if(chardetectxs[d].x<l+dist/2 && j<chardetectxs[d].data->Out.value) {//!y??
+							chardetectxs[d].data->Out.value=j;
+						}
+					}
+					l+=dist;
+
+				}
+
+				if(text[lword+1]=='\n')
+					lword++;
+
+				lstart=lword+1;
+				i=lword;
+				llen=0;
+				if(!nowrap)
+					y+=VerticalSpacing;
+				nextline=false;
+			}
+		}
+		for(d=0;d<DataLen;d++) {
+			if(Data[d].CharPosition==i) {
+				switch(Data[d].Type) {
+				case EPrintData::Spacing:
+					Data[d].Out.position.x=l;
+					Data[d].Out.position.y=y;
+
+					l+=Data[d].In.position.x-Seperator; 
+					y+=Data[d].In.position.y; 
+					break;
+				case EPrintData::PositionDetect:
+					Data[d].Out.position.x=l;
+					Data[d].Out.position.y=y;
+					break;
+				}
+			}
+		}	
+	}
+
+	int BitmapFont::TextHeight(const std::string &text, int w) {
+		unsigned i;
+		int l=0;
+		int lstart=0,lword=0;
+		int llen=0;
+		int lww=0;
+		int fh=FontHeight();
+		int j;
+		int y=0;
+		bool nextline=false;
+		bool wrap=true;
+
+		if(text=="") return 0;
+
+
+		if(w==0) {
+			/*align=TextAlignment::Left;
+			w=10000;*/
+			wrap=false;
+		}
+
+		for(i=0;i<text.length();i++) {
+			if(text[i]=='\n') {
+				lword=i-1;
+				lww=llen;
+				nextline=true;
+			}
+			else {
+				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
+
+				if(text[i]==' ' || text[i]==',' || text[i]==')') {
+					lword=i;
+					lww=llen;
+				}
+
+				if(llen>w && wrap) {
+					if(lword<=lstart) {
+						lword=i;
+						lww=llen;
+					}
+
+					nextline=true;
+				}
+				if(i==text.length()-1) {
+					lword=i;
+					lww=llen;
+
+					nextline=true;
+				}
+			}
+
+			if(nextline) {
+				l=0;
+
+				for(j=lstart;j<lword+1;j++) {
+					if(text[j]=='\t') {
+						Image *img=Characters[(unsigned char)' '];
+						int i;
+						for(i=0;i<Tabsize;i++) {
+							l+=img->GetWidth()+Seperator;
+						}
+					}
+					if(text[j]!='\r') {
+						Image *img=Characters[(unsigned char)text[j]];
+						l+=img->GetWidth()+Seperator;
+					}
+				}
+
+				if(text.length()-1==lword)
+					;
+				else if(text[lword+1]=='\n')
+					lword++;
+
+				lstart=lword+1;
+				i=lword;
+				llen=0;
+				y+=VerticalSpacing;
+				nextline=false;
+			}
+		}
+
+		return y;
+	}
+
+	BitmapFont & BitmapFont::Blur(float amount, int windowsize/*=-1*/) {
+		if(Shadows[amount])
+			return *Shadows[amount];
+
+		BitmapFont *font=new BitmapFont;
+
+		if(windowsize==-1)
+			windowsize=max(1,int(amount*1.5));
+
+		font->Seperator=Seperator-windowsize*2;
+		font->VerticalSpacing=VerticalSpacing;
+		font->Baseline=Baseline+windowsize;
+
+		for(SortedCollection<Base>::Iterator it=Subitems.First();it.IsValid();it.Next()) {
+			Image *img=dynamic_cast<Image*>(it.CurrentPtr());
+
+			if(img) {
+				font->Subitems.Add(img->Blur(amount, windowsize), font->Subitems.HighestOrder()+1);
+			}
+			else {
+				font->Subitems.Add(*it, it.GetKey());
+			}
+		}
+
+		for(int i=0;i<256;i++) {
+			int loc=Subitems.FindLocation(Characters[i]);
+			if(loc>=0)
+				font->Characters[i]=dynamic_cast<Image*>(font->Subitems(loc));
+		}
+
+		Shadows[amount]=font;
+		font->noshadows=true;
+		font->Prepare(Main, *file);
+		return *font;
+	}
+
+	void BitmapFont::Prepare(GGEMain &main, File &file) {
+		Base::Prepare(main, file);
+		this->file=&file;
+		
+		if(!noshadows) {
+			Blur(1);
+			Blur(1.6f);
+		}
+	}
+
+	BitmapFont::~BitmapFont() {
+		for(auto it=Shadows.begin();it!=Shadows.end();++it) {
+			delete it->second;
+			it->second=NULL;
+		}
+	}
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/BitmapFont.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,102 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "Image.h"
+#include "../Engine/FontRenderer.h"
+#include <map>
+
+namespace gge { namespace resource {
+	class File;
+
+
+
+	////This function loads a bitmap font from the given file
+	BitmapFont *LoadBitmapFontResource(File &File, std::istream &Data, int Size);
+
+	////This is bitmap font. Bitmap fonts contains every character as images. It has its
+	/// pros and cons. Being bitmap, these fonts do not require extra rendering. They are
+	/// independent of OS and does not require any additional libraries. However, they have
+	/// no scaling, rotation capabilities without losing detail.
+	class BitmapFont : public Base, public FontRenderer {
+ 		friend BitmapFont *LoadBitmapFontResource(File &File, std::istream &Data, int Size);
+		friend class Font;
+	public:
+		////Size of the tabs in spaces, default is 4
+		int Tabsize;
+		////03020000h (Game, Bitmap font)
+		virtual GID::Type getGID() const { return GID::Font; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+
+		////Default constructor
+		BitmapFont() : Base(), noshadows(false) { 
+			Tabsize=4; 
+			memset(Characters, 0, 256*sizeof(Image*)); 
+			VerticalSpacing=22;
+
+			Shadows[0]=this;
+		}
+
+		////Images that represents characters. 8bit ASCII encoding is used. 
+		/// An image might be used in more than one character.
+		Image *Characters[256];
+
+		////Horizontal separation distance between two characters
+		int Seperator;
+		////Vertical spacing of this font (px)
+		int VerticalSpacing;
+		////Baseline from the top
+		int Baseline;
+
+		BitmapFont &Blur(float amount, int windowsize=-1);
+
+
+	//protected:
+		////Prints the given text to the target using given color.
+		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, const std::string &Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams());
+		////Prints the given text to the target using given color. Text is wrapped and aligned as necessary
+		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams());
+		////This method is extended to cover meta functionality for advanced text rendering
+		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams());
+		////This method is extended to cover meta functionality for advanced text rendering. This function does not render the given text
+		/// it only processes meta data
+		virtual void Print_Test(int X, int Y, int W, const std::string &Text, EPrintData *Data, int DataLen, TextAlignment::Type Align);
+		void Print_Test(utils::Point p, int W, const std::string &Text, EPrintData *Data, int DataLen, TextAlignment::Type Align) {
+			Print_Test(p.x, p.y, W, Text, Data, DataLen, Align);
+		}
+
+
+
+		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, const std::string &Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams()) 
+		{ Print(&target, X, Y, Text, Color, Shadow); }
+		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams()) 
+		{ Print(&target, X, Y, W, Text, Color, Align, Shadow); }
+		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams())
+		{ Print(&target, X, Y, W, Text, Color, Data, DataLen, Align, Shadow); }
+
+		////Returns the height of this font, all characters have same height
+		virtual int FontHeight() { return VerticalSpacing; }
+		////Returns the width of the given text
+		virtual int TextWidth(const std::string &Text) { 
+			int i, w=0; 
+			const char *text=Text.c_str(); 
+			for(i=0;text[i];i++) 
+				w+=Characters[(unsigned char)text[i]]->GetWidth(); 
+		
+			return w; 
+		}
+		virtual int TextHeight(const std::string &Text, int W);
+		virtual int FontBaseline() { return Baseline; }
+
+		virtual void Prepare(GGEMain &main, File &file);
+
+		virtual ~BitmapFont();
+
+		std::map<float, BitmapFont*> Shadows;
+
+	protected:
+		bool noshadows;
+		File *file;
+	};
+} }
\ No newline at end of file
--- a/Resource/BitmapFontResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,775 +0,0 @@
-#include "BitmapFontResource.h"
-#include "ResourceFile.h"
-#include "..\Engine\Graphics.h"
-
-#ifndef MAX_CHAR_DETECTS
-#define MAX_CHAR_DETECTS	10
-#endif
-
-using namespace gge::graphics;
-using namespace gge::utils;
-using namespace std;
-
-namespace gge { namespace resource {
-	ResourceBase *LoadBitmapFontResource(File &File, std::istream &Data, int Size) {
-		BitmapFontResource *font=new BitmapFontResource;
-		int chmap[256];
-		int cpos=0,i;
-
-		font->Seperator=1;
-
-		int target=Data.tellg()+Size;
-		while(Data.tellg()<target) {
-			int gid,size;
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-
-			if(gid==GID::Font_Charmap) {
-				Data.read((char*)chmap, 4*256);
-			}
-			else if(gid==GID::Guid) {
-				font->guid.LoadLong(Data);
-			}
-			else if(gid==GID::SGuid) {
-				font->guid.Load(Data);
-			}
-			else if(gid==GID::Font_Image) {
-				ImageResource *img=LoadImageResource(File,Data,size);
-
-				for(i=0;i<256;i++)
-					if(chmap[i]==cpos)
-						font->Characters[i]=img;
-
-				font->Subitems.Add(img);
-				cpos++;
-			}
-			else if(gid==GID::Font_Props) {
-				ReadFrom(Data,font->Seperator);
-				ReadFrom(Data,font->VerticalSpacing);
-				ReadFrom(Data,font->Baseline);
-			}
-			else {
-				EatChunk(Data,size);
-			}
-		}
-
-		return font;
-	}
-	void BitmapFontResource::Print(graphics::ColorizableImageTarget2D *target, int X, int Y, const std::string &text, graphics::RGBint color, ShadowParams Shadow) {
-		if(text=="") return;
-
-		RGBint cc=target->GetCurrentColor();
-
-		unsigned int i;
-		if(Shadow.Type==ShadowParams::Flat) {
-			int x=X;
-			target->SetCurrentColor(Shadow.Color);
-			for(i=0;i<text.length();i++) {
-				ImageResource *img=Characters[text[i]];
-				img->Draw(target,x+Shadow.Offset.x,Y+Shadow.Offset.y);
-				x+=img->GetWidth() + Seperator;
-			}
-		}
-		else if(Shadow.Type==ShadowParams::DropShadow) {
-			BitmapFontResource &shadow=Blur(Shadow.Blur);
-			int sizediff=(shadow.TextWidth(" ")-TextWidth(" "))/2;
-			shadow.Print(target, X+Shadow.Offset.x-sizediff, Y+Shadow.Offset.y-sizediff, text, Shadow.Color);
-		}
-
-		target->SetCurrentColor(color);
-		for(i=0;i<text.length();i++) {
-			ImageResource *img=Characters[text[i]];
-			img->Draw(target,X,Y);
-			X+=img->GetWidth() + Seperator;
-		}
-
-		target->SetCurrentColor(cc);
-	}
-
-	void BitmapFontResource::Print(graphics::ColorizableImageTarget2D *target, int x, int y, int w, const std::string &text, graphics::RGBint color, TextAlignment::Type align, ShadowParams Shadow) {
-		unsigned i;
-		int l=x;
-		int lstart=0,lword=0;
-		int llen=0;
-		int lww=0;
-		int fh=FontHeight();
-		int j;
-		bool nextline=false;
-		bool wrap=true;
-
-		if(text=="") return;
-
-
-		if(Shadow.Type==ShadowParams::Flat)
-			Print(target,x+Shadow.Offset.x,y+Shadow.Offset.y,w,text,Shadow.Color,align);
-		else if(Shadow.Type==ShadowParams::DropShadow) {
-			BitmapFontResource &shadow=Blur(Shadow.Blur);
-			int sizediff=(shadow.TextWidth(" ")-TextWidth(" "))/2;
-			shadow.Print(target, x+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff, w, text, Shadow.Color, align);
-		}
-
-		RGBint cc=target->GetCurrentColor();
-		target->SetCurrentColor(color);
-
-		if(w==0) {
-			/*align=TextAlignment::Left;
-			w=10000;*/
-			wrap=false;
-		}
-
-		for(i=0;i<text.length();i++) {
-			if(text[i]=='\n') {
-				lword=i-1;
-				lww=llen;
-				nextline=true;
-			}
-			else {
-				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
-
-				if(text[i]==' ' || text[i]==',' || text[i]==')') {
-					lword=i;
-					lww=llen;
-				}
-
-				if(llen>w && wrap) {
-					if(lword<=lstart) {
-						lword=i;
-						lww=llen;
-					}
-
-					nextline=true;
-				}
-				if(i==text.length()-1) {
-					lword=i;
-					lww=llen;
-
-					nextline=true;
-				}
-			}
-
-			if(nextline) {
-				switch(align) {
-				case TextAlignment::Left:
-					l=x;
-					break;
-				case TextAlignment::Center:
-					l=x+(w-lww)/2;
-					break;
-				case TextAlignment::Right:
-					l=x+(w-lww);
-					break;
-
-				}
-
-				for(j=lstart;j<lword+1;j++) {
-					if(text[j]=='\t') {
-						ImageResource *img=Characters[(unsigned char)' '];
-						int i;
-						for(i=0;i<Tabsize;i++) {
-							img->Draw(target, l, y);
-							l+=img->GetWidth()+Seperator;
-						}
-					}
-					if(text[j]!='\r') {
-						ImageResource *img=Characters[(unsigned char)text[j]];
-						img->Draw(target, l, y);
-						l+=img->GetWidth()+Seperator;
-					}
-				}
-
-				if(text.length()-1==lword)
-					;
-				else if(text[lword+1]=='\n')
-					lword++;
-
-				lstart=lword+1;
-				i=lword;
-				llen=0;
-				y+=VerticalSpacing;
-				nextline=false;
-			}
-		}
-
-		target->SetCurrentColor(cc);
-	}
-	void BitmapFontResource::Print(graphics::ColorizableImageTarget2D *target, int x, int y, int w, const std::string &text, graphics::RGBint color, EPrintData *Data, int DataLen, TextAlignment::Type Align, ShadowParams Shadow) {
-
-		RGBint cc=target->GetCurrentColor();
-		target->SetCurrentColor(color);
-		
-		int sizediff;
-		BitmapFontResource *shadow;
-
-		if(Shadow.Type==ShadowParams::DropShadow) {
-			shadow=&Blur(Shadow.Blur);
-			sizediff=(shadow->TextWidth(" ")-TextWidth(" "))/2;
-		}
-
-		if(text=="") {
-			int d;
-			int xpos=0;
-			if(Align==TextAlignment::Center)
-				xpos=w/2;
-			else if(Align==TextAlignment::Right)
-				xpos=w;
-
-			for(d=0;d<DataLen;d++) {
-				switch(Data[d].Type) {
-				case EPrintData::PositionDetect:
-					Data[d].Out.position.x=xpos;
-					Data[d].Out.position.y=0;
-					break;
-				case EPrintData::Spacing:
-					Data[d].Out.position.x=xpos;
-					Data[d].Out.position.y=0;
-					break;
-				}
-			}
-			return;
-		}
-
-		int i,j,d;
-		int sx=x;
-		int sy=y;
-		int datc=0;
-		int l=x;
-		int lstart=0,lword=0;
-		int llen=0;//line length
-		int lww=0;
-		bool nowrap=false;
-
-		if(w<0) { w=-w; nowrap=true; }
-		bool done;
-		int fh=FontHeight();
-		int *data=(int*)Data;
-		bool nextline=false;
-		struct {int x;EPrintData*data;} chardetectxs[MAX_CHAR_DETECTS];
-		int cchardetectxs=0;
-
-		for(d=0;d<DataLen;d++) {
-			switch(Data[d].Type) {
-			case EPrintData::Wrap:
-				nowrap=!Data[d].In.value;
-				break;
-			case EPrintData::CharacterDetect:
-				if(cchardetectxs<MAX_CHAR_DETECTS) {
-					Data[d].Out.value=text.length();
-					chardetectxs[cchardetectxs].x=Data[d].In.position.x;
-					chardetectxs[cchardetectxs].data=Data+d;
-					cchardetectxs++;
-				}
-				break;
-			}
-		}
-
-
-		if(w==0)
-			nowrap=true;
-
-		switch(Align) {
-		case TextAlignment::Left:
-			l=x;
-			break;
-		case TextAlignment::Center:
-			l=x+w/2;
-			break;
-		case TextAlignment::Right:
-			l=x+w;
-			break;
-		}
-		for(i=0;text[i];i++) {
-			for(d=0;d<DataLen;d++) {
-				if(Data[d].CharPosition==i) {
-					switch(Data[d].Type) {
-					case EPrintData::Spacing:
-						llen+=Data[d].In.position.x-Seperator; 
-						y+=Data[d].In.position.y; 
-						break;
-					}
-				}
-			}
-			if(text[i]=='\n') {
-				lword=i-1;
-				lww=llen;
-				nextline=true;
-			}
-			else {
-				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
-
-				if(text[i]==' ' || text[i]==',' || text[i]==')') {
-					lword=i;
-					lww=llen;
-				}
-
-				if(llen>w && !nowrap) {
-					if(lword<=lstart) {
-						lword=i;
-						lww=llen;
-					}
-
-					nextline=true;
-				}
-				if(!text[i+1]) {
-					lword=i;
-					lww=llen;
-
-					nextline=true;
-				}
-			}
-
-			if(nextline) {
-				switch(Align) {
-				case TextAlignment::Left:
-					l=x;
-					break;
-				case TextAlignment::Center:
-					l=x+(w-lww)/2;
-					break;
-				case TextAlignment::Right:
-					l=x+(w-lww);
-					break;
-				}
-
-				for(j=lstart;j<lword+1;j++) {
-					done=0;
-
-					for(d=0;d<DataLen;d++) {
-						if(Data[d].CharPosition==j) {
-							switch(Data[d].Type) {
-							case EPrintData::Spacing:
-								Data[d].Out.position.x=l;
-								Data[d].Out.position.y=y;
-
-								l+=Data[d].In.position.x-Seperator; 
-								y+=Data[d].In.position.y; 
-								break;
-							case EPrintData::PositionDetect:
-								Data[d].Out.position.x=l;
-								Data[d].Out.position.y=y;
-								break;
-							case EPrintData::Color:
-								color=Data[d].In.color;
-
-								break;
-							case EPrintData::ShadowColor:
-								Shadow.Color=Data[d].In.color;
-
-								break;
-							}
-						}
-					}
-					int dist=0;
-					if(text[j]=='\t') {
-						ImageResource *img=Characters[(unsigned char)' '];
-						int i;
-						for(i=0;i<Tabsize;i++) {
-							if(Shadow.Type==ShadowParams::Flat) {
-								target->SetCurrentColor(Shadow.Color);
-								img->Draw(target,l+Shadow.Offset.x,y+Shadow.Offset.y);
-							}
-							else if(Shadow.Type==ShadowParams::DropShadow) {
-								target->SetCurrentColor(Shadow.Color);
-								shadow->Characters[(unsigned char)' ']->Draw(target, l+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff);
-							}
-
-							target->SetCurrentColor(color);
-							img->Draw(target,l,y);
-							dist+=img->GetWidth()+Seperator;
-						}
-					}
-					else if(text[j]!='\r') {
-						ImageResource *img=Characters[(unsigned char)text[j]];
-						if(Shadow.Type==ShadowParams::Flat) {
-							target->SetCurrentColor(Shadow.Color);
-							img->Draw(target,l+Shadow.Offset.x,y+Shadow.Offset.y);
-						}
-						else if(Shadow.Type==ShadowParams::DropShadow) {
-							target->SetCurrentColor(Shadow.Color);
-							shadow->Characters[(unsigned char)text[j]]->Draw(target, l+Shadow.Offset.x-sizediff, y+Shadow.Offset.y-sizediff);
-						}
-
-						target->SetCurrentColor(color);
-						img->Draw(target,l,y);
-						dist=img->GetWidth()+Seperator;
-					}
-					for(d=0;d<cchardetectxs;d++) {
-						if(chardetectxs[d].x<l+dist/2) {//TODO y
-							chardetectxs[d].data->Out.value=j;
-						}
-					}
-					l+=dist;
-
-				}
-
-				if(text[lword+1]=='\n')
-					lword++;
-
-				lstart=lword+1;
-				i=lword;
-				llen=0;
-				if(!nowrap)
-					y+=VerticalSpacing;
-				nextline=false;
-			}
-		}
-		for(d=0;d<DataLen;d++) {
-			if(Data[d].CharPosition==i) {
-				switch(Data[d].Type) {
-				case EPrintData::Spacing:
-					Data[d].Out.position.x=l;
-					Data[d].Out.position.y=y;
-
-					l+=Data[d].In.position.x-Seperator; 
-					y+=Data[d].In.position.y; 
-					break;
-				case EPrintData::PositionDetect:
-					Data[d].Out.position.x=l;
-					Data[d].Out.position.y=y;
-					break;
-				}
-			}
-		}	
-
-		target->SetCurrentColor(cc);
-
-	}
-	void BitmapFontResource::Print_Test(int x, int y, int w, const std::string &text, EPrintData *Data, int DataLen, TextAlignment::Type Align) {
-		if(text=="") {
-			int d;
-			int xpos=0;
-			if(Align==TextAlignment::Center)
-				xpos=w/2;
-			else if(Align==TextAlignment::Right)
-				xpos=w;
-
-			for(d=0;d<DataLen;d++) {
-				switch(Data[d].Type) {
-				case EPrintData::PositionDetect:
-					Data[d].Out.position.x=xpos;
-					Data[d].Out.position.y=0;
-					break;
-				case EPrintData::Spacing:
-					Data[d].Out.position.x=xpos;
-					Data[d].Out.position.y=0;
-					break;
-				}
-			}
-			return;
-		}
-
-		int i,j,d;
-		int sx=x;
-		int sy=y;
-		int datc=0;
-		int l=x;
-		int lstart=0,lword=0;
-		int llen=0;//line length
-		int lww=0;
-		bool nowrap=false;
-
-		if(w<0) { w=-w; nowrap=true; }
-		bool done;
-		int fh=FontHeight();
-		int *data=(int*)Data;
-		bool nextline=false;
-		struct {int x;EPrintData*data;} chardetectxs[MAX_CHAR_DETECTS];
-		int cchardetectxs=0;
-
-		for(d=0;d<DataLen;d++) {
-			switch(Data[d].Type) {
-			case EPrintData::Wrap:
-				nowrap=!Data[d].In.value;
-				break;
-			case EPrintData::CharacterDetect:
-				if(cchardetectxs<MAX_CHAR_DETECTS) {
-					Data[d].Out.value=text.length();
-					chardetectxs[cchardetectxs].x=Data[d].In.position.x;
-					chardetectxs[cchardetectxs].data=Data+d;
-					cchardetectxs++;
-				}
-				break;
-			}
-		}
-
-		if(w==0)
-			nowrap=true;
-
-		switch(Align) {
-		case TextAlignment::Left:
-			l=x;
-			break;
-		case TextAlignment::Center:
-			l=x+w/2;
-			break;
-		case TextAlignment::Right:
-			l=x+w;
-			break;
-		}
-		for(i=0;text[i];i++) {
-			for(d=0;d<DataLen;d++) {
-				if(Data[d].CharPosition==i) {
-					switch(Data[d].Type) {
-					case EPrintData::Spacing:
-						llen+=Data[d].In.position.x-Seperator; 
-						y+=Data[d].In.position.y; 
-						break;
-					}
-				}
-			}
-			if(text[i]=='\n') {
-				lword=i-1;
-				lww=llen;
-				nextline=true;
-			}
-			else {
-				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
-
-				if(text[i]==' ' || text[i]==',' || text[i]==')') {
-					lword=i;
-					lww=llen;
-				}
-
-				if(llen>w && !nowrap) {
-					if(lword<=lstart) {
-						lword=i;
-						lww=llen;
-					}
-
-					nextline=true;
-				}
-				if(!text[i+1]) {
-					lword=i;
-					lww=llen;
-
-					nextline=true;
-				}
-			}
-
-			if(nextline) {
-				switch(Align) {
-				case TextAlignment::Left:
-					l=x;
-					break;
-				case TextAlignment::Center:
-					l=x+(w-lww)/2;
-					break;
-				case TextAlignment::Right:
-					l=x+(w-lww);
-					break;
-				}
-
-				for(j=lstart;j<lword+1;j++) {
-					done=0;
-
-					for(d=0;d<DataLen;d++) {
-						if(Data[d].CharPosition==j) {
-							switch(Data[d].Type) {
-							case EPrintData::Spacing:
-								Data[d].Out.position.x=l/*-sx*/;
-								Data[d].Out.position.y=y/*-sy*/;
-
-								l+=Data[d].In.position.x-Seperator; 
-								y+=Data[d].In.position.y; 
-								break;
-							case EPrintData::PositionDetect:
-								Data[d].Out.position.x=l/*-sx*/;
-								Data[d].Out.position.y=y/*-sy*/;
-								break;
-							case EPrintData::Color:
-
-								break;
-							case EPrintData::ShadowColor:
-
-								break;
-							}
-						}
-					}
-					int dist=0;
-					if(text[j]=='\t') {
-						ImageResource *img=Characters[(unsigned char)' '];
-						int i;
-						for(i=0;i<Tabsize;i++) {
-							dist+=img->GetWidth()+Seperator;
-						}
-					}
-					else if(text[j]!='\r') {
-						ImageResource *img=Characters[(unsigned char)text[j]];
-						dist=img->GetWidth()+Seperator;
-					}
-					for(d=0;d<cchardetectxs;d++) {
-						if(chardetectxs[d].x<l+dist/2 && j<chardetectxs[d].data->Out.value) {//!y??
-							chardetectxs[d].data->Out.value=j;
-						}
-					}
-					l+=dist;
-
-				}
-
-				if(text[lword+1]=='\n')
-					lword++;
-
-				lstart=lword+1;
-				i=lword;
-				llen=0;
-				if(!nowrap)
-					y+=VerticalSpacing;
-				nextline=false;
-			}
-		}
-		for(d=0;d<DataLen;d++) {
-			if(Data[d].CharPosition==i) {
-				switch(Data[d].Type) {
-				case EPrintData::Spacing:
-					Data[d].Out.position.x=l;
-					Data[d].Out.position.y=y;
-
-					l+=Data[d].In.position.x-Seperator; 
-					y+=Data[d].In.position.y; 
-					break;
-				case EPrintData::PositionDetect:
-					Data[d].Out.position.x=l;
-					Data[d].Out.position.y=y;
-					break;
-				}
-			}
-		}	
-	}
-
-	int BitmapFontResource::TextHeight(const std::string &text, int w) {
-		unsigned i;
-		int l=0;
-		int lstart=0,lword=0;
-		int llen=0;
-		int lww=0;
-		int fh=FontHeight();
-		int j;
-		int y=0;
-		bool nextline=false;
-		bool wrap=true;
-
-		if(text=="") return 0;
-
-
-		if(w==0) {
-			/*align=TextAlignment::Left;
-			w=10000;*/
-			wrap=false;
-		}
-
-		for(i=0;i<text.length();i++) {
-			if(text[i]=='\n') {
-				lword=i-1;
-				lww=llen;
-				nextline=true;
-			}
-			else {
-				llen+=Characters[(unsigned char)text[i]]->GetWidth()+Seperator;
-
-				if(text[i]==' ' || text[i]==',' || text[i]==')') {
-					lword=i;
-					lww=llen;
-				}
-
-				if(llen>w && wrap) {
-					if(lword<=lstart) {
-						lword=i;
-						lww=llen;
-					}
-
-					nextline=true;
-				}
-				if(i==text.length()-1) {
-					lword=i;
-					lww=llen;
-
-					nextline=true;
-				}
-			}
-
-			if(nextline) {
-				l=0;
-
-				for(j=lstart;j<lword+1;j++) {
-					if(text[j]=='\t') {
-						ImageResource *img=Characters[(unsigned char)' '];
-						int i;
-						for(i=0;i<Tabsize;i++) {
-							l+=img->GetWidth()+Seperator;
-						}
-					}
-					if(text[j]!='\r') {
-						ImageResource *img=Characters[(unsigned char)text[j]];
-						l+=img->GetWidth()+Seperator;
-					}
-				}
-
-				if(text.length()-1==lword)
-					;
-				else if(text[lword+1]=='\n')
-					lword++;
-
-				lstart=lword+1;
-				i=lword;
-				llen=0;
-				y+=VerticalSpacing;
-				nextline=false;
-			}
-		}
-
-		return y;
-	}
-
-	BitmapFontResource & BitmapFontResource::Blur(float amount, int windowsize/*=-1*/) {
-		if(Shadows[amount])
-			return *Shadows[amount];
-
-		BitmapFontResource *font=new BitmapFontResource;
-
-		if(windowsize==-1)
-			windowsize=max(1,int(amount*1.5));
-
-		font->Seperator=Seperator-windowsize*2;
-		font->VerticalSpacing=VerticalSpacing;
-		font->Baseline=Baseline+windowsize;
-
-		for(SortedCollection<ResourceBase>::Iterator it=Subitems.First();it.isValid();it.Next()) {
-			ImageResource *img=dynamic_cast<ImageResource*>(it.CurrentPtr());
-
-			if(img) {
-				font->Subitems.Add(img->Blur(amount, windowsize), font->Subitems.HighestOrder()+1);
-			}
-			else {
-				font->Subitems.Add(*it, it.GetKey());
-			}
-		}
-
-		for(int i=0;i<256;i++) {
-			int loc=Subitems.FindLocation(Characters[i]);
-			if(loc>=0)
-				font->Characters[i]=dynamic_cast<ImageResource*>(font->Subitems(loc));
-		}
-
-		Shadows[amount]=font;
-		font->noshadows=true;
-		font->Prepare(Main, *file);
-		return *font;
-	}
-
-	void BitmapFontResource::Prepare(GGEMain &main, File &file) {
-		ResourceBase::Prepare(main, file);
-		this->file=&file;
-		
-		if(!noshadows) {
-			Blur(1);
-			Blur(1.6f);
-		}
-	}
-
-	BitmapFontResource::~BitmapFontResource() {
-		for(auto it=Shadows.begin();it!=Shadows.end();++it) {
-			delete it->second;
-			it->second=NULL;
-		}
-	}
-
-} }
--- a/Resource/BitmapFontResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "ImageResource.h"
-#include "../Engine/FontRenderer.h"
-#include <map>
-
-namespace gge { namespace resource {
-	class File;
-
-
-
-	////This function loads a bitmap font from the given file
-	ResourceBase *LoadBitmapFontResource(File &File, std::istream &Data, int Size);
-
-	////This is bitmap font. Bitmap fonts contains every character as images. It has its
-	/// pros and cons. Being bitmap, these fonts do not require extra rendering. They are
-	/// independent of OS and does not require any additional libraries. However, they have
-	/// no scaling, rotation capabilities without losing detail.
-	class BitmapFontResource : public ResourceBase, public FontRenderer {
-		friend ResourceBase *LoadBitmapFontResource(File &File, std::istream &Data, int Size);
-		friend class Font;
-	public:
-		////Size of the tabs in spaces, default is 4
-		int Tabsize;
-		////03020000h (Game, Bitmap font)
-		virtual GID::Type getGID() const { return GID::Font; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-
-		////Default constructor
-		BitmapFontResource() : ResourceBase(), noshadows(false) { 
-			Tabsize=4; 
-			memset(Characters, 0, 256*sizeof(ImageResource*)); 
-			VerticalSpacing=22;
-
-			Shadows[0]=this;
-		}
-
-		////Images that represents characters. 8bit ASCII encoding is used. 
-		/// An image might be used in more than one character.
-		ImageResource *Characters[256];
-
-		////Horizontal separation distance between two characters
-		int Seperator;
-		////Vertical spacing of this font (px)
-		int VerticalSpacing;
-		////Baseline from the top
-		int Baseline;
-
-		BitmapFontResource &Blur(float amount, int windowsize=-1);
-
-
-	//protected:
-		////Prints the given text to the target using given color.
-		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, const std::string &Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams());
-		////Prints the given text to the target using given color. Text is wrapped and aligned as necessary
-		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams());
-		////This method is extended to cover meta functionality for advanced text rendering
-		virtual void Print(graphics::ColorizableImageTarget2D *target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams());
-		////This method is extended to cover meta functionality for advanced text rendering. This function does not render the given text
-		/// it only processes meta data
-		virtual void Print_Test(int X, int Y, int W, const std::string &Text, EPrintData *Data, int DataLen, TextAlignment::Type Align);
-		void Print_Test(utils::Point p, int W, const std::string &Text, EPrintData *Data, int DataLen, TextAlignment::Type Align) {
-			Print_Test(p.x, p.y, W, Text, Data, DataLen, Align);
-		}
-
-
-
-		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, const std::string &Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams()) 
-		{ Print(&target, X, Y, Text, Color, Shadow); }
-		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams()) 
-		{ Print(&target, X, Y, W, Text, Color, Align, Shadow); }
-		void Print(graphics::ColorizableImageTarget2D &target, int X, int Y, int W, const std::string &Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment::Type Align=TextAlignment::Left, ShadowParams Shadow=ShadowParams())
-		{ Print(&target, X, Y, W, Text, Color, Data, DataLen, Align, Shadow); }
-
-		////Returns the height of this font, all characters have same height
-		virtual int FontHeight() { return VerticalSpacing; }
-		////Returns the width of the given text
-		virtual int TextWidth(const std::string &Text) { 
-			int i, w=0; 
-			const char *text=Text.c_str(); 
-			for(i=0;text[i];i++) 
-				w+=Characters[(unsigned char)text[i]]->GetWidth(); 
-		
-			return w; 
-		}
-		virtual int TextHeight(const std::string &Text, int W);
-		virtual int FontBaseline() { return Baseline; }
-
-		virtual void Prepare(GGEMain &main, File &file);
-
-		virtual ~BitmapFontResource();
-
-		std::map<float, BitmapFontResource*> Shadows;
-
-	protected:
-		bool noshadows;
-		File *file;
-	};
-} }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/DataArray.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,137 @@
+#include "DataArray.h"
+#include "File.h"
+
+using namespace std;
+using namespace gge::utils;
+
+namespace gge { namespace resource {
+	DataArray *LoadDataResource(File &File, std::istream &Data, int Size) {
+		DataArray *dat=new DataArray;
+		dat->file=&File;
+
+		int target=Data.tellg()+Size;
+		while(Data.tellg()<target) {
+			int gid,size;
+
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+
+			utils::SGuid tmpguid;
+
+			char *tmpstr;
+
+			if(gid==GID::Data_Text) {
+				tmpstr=new char[size];
+				Data.read(tmpstr,size);
+
+				dat->Add(string(tmpstr,size));
+			}
+			else if(gid==GID::SGuid) {
+				dat->guid.Load(Data);
+			}
+			else if(gid==GID::Guid) {
+				dat->guid.LoadLong(Data);
+			}
+			else if(gid==GID::Data_Int) {
+				dat->Add(ReadFrom<int>(Data));
+			}
+			else if(gid==GID::Data_Float) {
+				dat->Add(ReadFrom<float>(Data));
+			}
+			else if(gid==GID::Data_Point) {
+				dat->Add(ReadFrom<Point>(Data));
+			}
+			else if(gid==GID::Data_Rect) {
+				dat->Add(ReadFrom<Rectangle>(Data));
+			}
+			else if(gid==GID::Data_Link) {
+				tmpguid.Load(Data);
+
+				dat->Add(tmpguid);
+			}
+			else if(gid==GID::Data_Color) {
+				dat->Add(ReadFrom<int>(Data));
+			}
+			else if(gid==GID::Data_Font) {
+				FontInitiator f;
+				ReadFrom<int>(Data);//useless gid
+				f=Font::Load(File, Data, ReadFrom<int>(Data));
+				f.file=&File;
+
+				dat->Add(f);
+			}
+			else ///!TODO: should query for pluggable data items
+				EatChunk(Data,size);
+		}
+
+		return dat;
+	}
+
+	
+	void LinkData::Prepare(File &File) { 
+		value=File.Root().FindObject(guid);
+	}
+
+
+	IntegerData		& DataArray::Add( int value ) {
+		IntegerData &o=*new IntegerData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	FloatData		& DataArray::Add( float value ) {
+		FloatData &o=*new FloatData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	StringData		& DataArray::Add( string value ) {
+		StringData &o=*new StringData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	PointData		& DataArray::Add( utils::Point value ) {
+		PointData &o=*new PointData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	RectangleData	& DataArray::Add( utils::Rectangle value ) {
+		RectangleData &o=*new RectangleData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	FontData		& DataArray::Add( Font value ) {
+		FontData &o=*new FontData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	FontData		& DataArray::Add( FontInitiator value ) {
+		FontData &o=*new FontData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	LinkData		& DataArray::Add( utils::SGuid value ) {
+		LinkData &o=*new LinkData(value);
+		Data.Add(o);
+
+		return o;
+	}
+
+	void DataArray::Prepare( GGEMain &main, File &file ) {
+		for(utils::Collection<IData>::Iterator i=Data.First();i.IsValid();i.Next()) 
+			i->Prepare(file);
+	}
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/DataArray.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,201 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "../Utils/Margins.h"
+#include "../Utils/Size2D.h"
+#include "../Engine/Font.h"
+
+#include <stdexcept>
+
+namespace gge { namespace resource {
+	class File;
+
+	class DataArray;
+	
+	////This function loads a text resource from the given file
+	DataArray *LoadDataResource(File &File, std::istream &Data, int Size);
+
+	////This is the data types that a data resource can contain
+	enum DataTypes {
+		////4 byte Integer data
+		DT_Integer,
+		////Floating utils::Point (4 byte)
+		DT_Float,
+		////String data
+		DT_String,
+		////4 byte integer utils::Point data
+		DT_Point,
+		////4 byte integer rectangle data
+		DT_Rectangle,
+		////Resource Link
+		DT_Link,
+	};
+
+	////Data resource interface
+	class IData : public Base {
+	public:
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+		string name;
+
+		virtual void Prepare(File &File) { }
+	};
+
+	////Integer data
+	class IntegerData : public IData {
+	public:
+		////02030C02h (Basic, Data resource, Data types, integer)
+		virtual int getGID() const { return GID::Data_Int; }
+		int value;
+
+		IntegerData(int value) { this->value=value; }
+		operator int() { return value; }
+	};
+
+	////Float data
+	class FloatData : public IData {
+	public:
+		////02030C03h (Basic, Data resource, Data types, float)
+		virtual int getGID() const { return GID::Data_Float; }
+		float value;
+
+		FloatData(float value) { this->value=value; }
+		operator float() { return value; }
+	};
+
+	////String data
+	class StringData : public IData {
+	public:
+		////02030C01h (Basic, Data resource, Data types, text)
+		virtual int getGID() const { return GID::Data_Text; }
+		string value;
+
+		StringData(string value) { this->value=value; }
+		operator string() { return value; }
+		operator const char *() { return value.c_str(); }
+	};
+
+	////utils::Point data
+	class PointData : public IData {
+	public:
+		////02030C04h (Basic, Data resource, Data types, utils::Point)
+		virtual int getGID() const { return GID::Data_Point; }
+		utils::Point value;
+
+		PointData(utils::Point value) { this->value=value; }
+
+		operator utils::Point() { return value; }
+		operator utils::Size() { return value; }
+	};
+
+	////Rectangle data
+	class RectangleData : public IData {
+	public:
+		////02030C05h (Basic, Data resource, Data types, rectangle)
+		virtual int getGID() const { return GID::Data_Rect; }
+		utils::Rectangle value;
+
+		RectangleData(utils::Rectangle value)	{ this->value=value; }
+
+		operator utils::Rectangle() { return value; }
+		operator utils::Margins() { return utils::Margins(value.Left,value.Top,value.Width,value.Height); }
+	};
+
+	////Link data
+	class LinkData : public IData {
+	public:
+		////02030C02h (Basic, Data resource, Data types, integer)
+		virtual int getGID() const { return GID::Data_Link; }
+		int getObjectGID() { if(value) return value->getGID(); return 0; }
+		Base *value;
+		utils::SGuid guid;
+
+		LinkData(utils::SGuid guid) : value(NULL) { this->guid=guid; }
+		operator Base *() { return value; }
+		operator Base &() { if(!value) throw std::runtime_error("Target is not set"); return *value; }
+		Base &Get() { if(!value) throw std::runtime_error("Target is not set"); return *value; }
+
+		virtual void Prepare(File &File);
+	};
+
+	//Font data
+	class FontData : public IData {
+	public:
+		////03300C01h (Gaming, FontTheme, Data types, font)
+		virtual int getGID() const { return 0x03300C01; }
+		Font value;
+		FontInitiator initiator;
+
+		FontData(Font &font) { value=font; }
+		FontData(FontInitiator &font) { initiator=font; }
+		operator Font() { return value; }
+		virtual void Prepare(File &File) {
+			value=(Font)initiator;
+		}
+	};
+
+	////This is data resource which holds an array of basic data types. These types are
+	/// integer, float, string, utils::Point and rectangle.
+	class DataArray : public Base {
+		friend DataArray *LoadDataResource(File &File, std::istream &Data, int Size);
+	public:
+		////Data collection
+		utils::Collection<IData> Data;
+
+		////Adds a new integer value to this resource
+		IntegerData		&Add(int value);
+		////Adds a new float value to this resource
+		FloatData		&Add(float value);
+		////Adds a new string value to this resource
+		StringData		&Add(string value);
+		////Adds a new utils::Point value to this resource
+		PointData		&Add(utils::Point value);
+		////Adds a new rectangle to this resource
+		RectangleData	&Add(utils::Rectangle value);
+		////Adds a new rectangle to this resource
+		FontData		&Add(Font value);
+		////Adds a new rectangle to this resource
+		FontData		&Add(FontInitiator value);
+		////Adds a new integer value to this resource
+		LinkData		&Add(utils::SGuid value);
+
+		////Returns item at index
+		IData *operator [] (int Index) { return &Data[Index]; }
+		////Returns integer at index
+		int getInt(int Index) { return dynamic_cast<IntegerData&>(Data[Index]).value; }
+		////Returns float at index
+		float getFloat(int Index) { return dynamic_cast<FloatData&>(Data[Index]).value; }
+		////Returns string at index
+		string getString(int Index) { return dynamic_cast<StringData&>(Data[Index]).value; }
+		////Returns char array at index
+		const char *getText(int Index) { return dynamic_cast<StringData&>(Data[Index]).value.data(); }
+		////Returns utils::Point at index
+		utils::Point getPoint(int Index) { return dynamic_cast<PointData&>(Data[Index]).value; }
+		////Returns size at index
+		utils::Size getSize(int Index) { return dynamic_cast<PointData&>(Data[Index]).value; }
+		////Returns rectangle at index
+		utils::Rectangle getRectangle(int Index) { return dynamic_cast<RectangleData&>(Data[Index]).value; }
+		////Returns utils::Margins at index
+		utils::Margins getMargins(int Index) { return dynamic_cast<RectangleData&>(Data[Index]); }
+		////Returns utils::Bounds at index
+		utils::Bounds getBounds(int Index) { return dynamic_cast<RectangleData&>(Data[Index]).value; }
+		////Returns resource object from a link
+		Base &getLink(int Index) { return dynamic_cast<LinkData&>(Data[Index]).Get(); }
+		////Returns font object
+		Font getFont(int Index) { return dynamic_cast<FontData&>(Data[Index]).value; }
+		////Returns number of items in the array
+		int getCount() { return Data.getCount(); }
+		
+		////02030000h (Basic, Data resource)
+		virtual GID::Type getGID() const { return GID::Data; }
+		////Currently does nothing
+		virtual bool Save(File &File,std::ostream &Data) { return false; }
+
+		virtual ~DataArray() { Data.Destroy(); Base::~Base(); }
+
+		virtual void Prepare(GGEMain &main, File &file);
+
+	protected:
+		File *file;
+	};
+} }
--- a/Resource/DataResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-#include "DataResource.h"
-#include "ResourceFile.h"
-
-using namespace std;
-using namespace gge::utils;
-
-namespace gge { namespace resource {
-	ResourceBase *LoadDataResource(File &File, std::istream &Data, int Size) {
-		DataResource *dat=new DataResource;
-		dat->file=&File;
-
-		int target=Data.tellg()+Size;
-		while(Data.tellg()<target) {
-			int gid,size;
-
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-
-			utils::SGuid tmpguid;
-
-			char *tmpstr;
-
-			if(gid==GID::Data_Text) {
-				tmpstr=new char[size];
-				Data.read(tmpstr,size);
-
-				dat->Add(string(tmpstr,size));
-			}
-			else if(gid==GID::SGuid) {
-				dat->guid.Load(Data);
-			}
-			else if(gid==GID::Guid) {
-				dat->guid.LoadLong(Data);
-			}
-			else if(gid==GID::Data_Int) {
-				dat->Add(ReadFrom<int>(Data));
-			}
-			else if(gid==GID::Data_Float) {
-				dat->Add(ReadFrom<float>(Data));
-			}
-			else if(gid==GID::Data_Point) {
-				dat->Add(ReadFrom<Point>(Data));
-			}
-			else if(gid==GID::Data_Rect) {
-				dat->Add(ReadFrom<Rectangle>(Data));
-			}
-			else if(gid==GID::Data_Link) {
-				tmpguid.Load(Data);
-
-				dat->Add(tmpguid);
-			}
-			else if(gid==GID::Data_Color) {
-				dat->Add(ReadFrom<int>(Data));
-			}
-			else if(gid==GID::Data_Font) {
-				FontInitiator f;
-				ReadFrom<int>(Data);//useless gid
-				f=Font::Load(File, Data, ReadFrom<int>(Data));
-				f.file=&File;
-
-				dat->Add(f);
-			}
-			else ///!TODO: should query for pluggable data items
-				EatChunk(Data,size);
-		}
-
-		return dat;
-	}
-
-	
-	void LinkData::Prepare(File &File) { 
-		value=File.Root().FindObject(guid);
-	}
-
-
-	IntegerData		& DataResource::Add( int value ) {
-		IntegerData &o=*new IntegerData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	FloatData		& DataResource::Add( float value ) {
-		FloatData &o=*new FloatData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	StringData		& DataResource::Add( string value ) {
-		StringData &o=*new StringData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	PointData		& DataResource::Add( utils::Point value ) {
-		PointData &o=*new PointData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	RectangleData	& DataResource::Add( utils::Rectangle value ) {
-		RectangleData &o=*new RectangleData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	FontData		& DataResource::Add( Font value ) {
-		FontData &o=*new FontData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	FontData		& DataResource::Add( FontInitiator value ) {
-		FontData &o=*new FontData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	LinkData		& DataResource::Add( utils::SGuid value ) {
-		LinkData &o=*new LinkData(value);
-		Data.Add(o);
-
-		return o;
-	}
-
-	void DataResource::Prepare( GGEMain &main, File &file ) {
-		for(utils::Collection<IData>::Iterator i=Data.First();i.isValid();i.Next()) 
-			i->Prepare(file);
-	}
-
-} }
--- a/Resource/DataResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "../Utils/Margins.h"
-#include "../Utils/Size2D.h"
-#include "../Engine/Font.h"
-
-#include <stdexcept>
-
-namespace gge { namespace resource {
-	class File;
-	
-	////This function loads a text resource from the given file
-	ResourceBase *LoadDataResource(File &File, std::istream &Data, int Size);
-
-	////This is the data types that a data resource can contain
-	enum DataTypes {
-		////4 byte Integer data
-		DT_Integer,
-		////Floating utils::Point (4 byte)
-		DT_Float,
-		////String data
-		DT_String,
-		////4 byte integer utils::Point data
-		DT_Point,
-		////4 byte integer rectangle data
-		DT_Rectangle,
-		////Resource Link
-		DT_Link,
-	};
-
-	////Data resource interface
-	class IData : public ResourceBase {
-	public:
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-		string name;
-
-		virtual void Prepare(File &File) { }
-	};
-
-	////Integer data
-	class IntegerData : public IData {
-	public:
-		////02030C02h (Basic, Data resource, Data types, integer)
-		virtual int getGID() const { return GID::Data_Int; }
-		int value;
-
-		IntegerData(int value) { this->value=value; }
-		operator int() { return value; }
-	};
-
-	////Float data
-	class FloatData : public IData {
-	public:
-		////02030C03h (Basic, Data resource, Data types, float)
-		virtual int getGID() const { return GID::Data_Float; }
-		float value;
-
-		FloatData(float value) { this->value=value; }
-		operator float() { return value; }
-	};
-
-	////String data
-	class StringData : public IData {
-	public:
-		////02030C01h (Basic, Data resource, Data types, text)
-		virtual int getGID() const { return GID::Data_Text; }
-		string value;
-
-		StringData(string value) { this->value=value; }
-		operator string() { return value; }
-		operator const char *() { return value.c_str(); }
-	};
-
-	////utils::Point data
-	class PointData : public IData {
-	public:
-		////02030C04h (Basic, Data resource, Data types, utils::Point)
-		virtual int getGID() const { return GID::Data_Point; }
-		utils::Point value;
-
-		PointData(utils::Point value) { this->value=value; }
-
-		operator utils::Point() { return value; }
-		operator utils::Size() { return value; }
-	};
-
-	////Rectangle data
-	class RectangleData : public IData {
-	public:
-		////02030C05h (Basic, Data resource, Data types, rectangle)
-		virtual int getGID() const { return GID::Data_Rect; }
-		utils::Rectangle value;
-
-		RectangleData(utils::Rectangle value)	{ this->value=value; }
-
-		operator utils::Rectangle() { return value; }
-		operator utils::Margins() { return utils::Margins(value.Left,value.Top,value.Width,value.Height); }
-	};
-
-	////Link data
-	class LinkData : public IData {
-	public:
-		////02030C02h (Basic, Data resource, Data types, integer)
-		virtual int getGID() const { return GID::Data_Link; }
-		int getObjectGID() { if(value) return value->getGID(); return 0; }
-		ResourceBase *value;
-		utils::SGuid guid;
-
-		LinkData(utils::SGuid guid) : value(NULL) { this->guid=guid; }
-		operator ResourceBase *() { return value; }
-		operator ResourceBase &() { if(!value) throw std::runtime_error("Target is not set"); return *value; }
-		ResourceBase &Get() { if(!value) throw std::runtime_error("Target is not set"); return *value; }
-
-		virtual void Prepare(File &File);
-	};
-
-	//Font data
-	class FontData : public IData {
-	public:
-		////03300C01h (Gaming, FontTheme, Data types, font)
-		virtual int getGID() const { return 0x03300C01; }
-		Font value;
-		FontInitiator initiator;
-
-		FontData(Font &font) { value=font; }
-		FontData(FontInitiator &font) { initiator=font; }
-		operator Font() { return value; }
-		virtual void Prepare(File &File) {
-			value=(Font)initiator;
-		}
-	};
-
-	////This is data resource which holds an array of basic data types. These types are
-	/// integer, float, string, utils::Point and rectangle.
-	class DataResource : public ResourceBase {
-		friend ResourceBase *LoadDataResource(File &File, std::istream &Data, int Size);
-	public:
-		////Data collection
-		utils::Collection<IData> Data;
-
-		////Adds a new integer value to this resource
-		IntegerData		&Add(int value);
-		////Adds a new float value to this resource
-		FloatData		&Add(float value);
-		////Adds a new string value to this resource
-		StringData		&Add(string value);
-		////Adds a new utils::Point value to this resource
-		PointData		&Add(utils::Point value);
-		////Adds a new rectangle to this resource
-		RectangleData	&Add(utils::Rectangle value);
-		////Adds a new rectangle to this resource
-		FontData		&Add(Font value);
-		////Adds a new rectangle to this resource
-		FontData		&Add(FontInitiator value);
-		////Adds a new integer value to this resource
-		LinkData		&Add(utils::SGuid value);
-
-		////Returns item at index
-		IData *operator [] (int Index) { return &Data[Index]; }
-		////Returns integer at index
-		int getInt(int Index) { return dynamic_cast<IntegerData&>(Data[Index]).value; }
-		////Returns float at index
-		float getFloat(int Index) { return dynamic_cast<FloatData&>(Data[Index]).value; }
-		////Returns string at index
-		string getString(int Index) { return dynamic_cast<StringData&>(Data[Index]).value; }
-		////Returns char array at index
-		const char *getText(int Index) { return dynamic_cast<StringData&>(Data[Index]).value.data(); }
-		////Returns utils::Point at index
-		utils::Point getPoint(int Index) { return dynamic_cast<PointData&>(Data[Index]).value; }
-		////Returns size at index
-		utils::Size getSize(int Index) { return dynamic_cast<PointData&>(Data[Index]).value; }
-		////Returns rectangle at index
-		utils::Rectangle getRectangle(int Index) { return dynamic_cast<RectangleData&>(Data[Index]).value; }
-		////Returns utils::Margins at index
-		utils::Margins getMargins(int Index) { return dynamic_cast<RectangleData&>(Data[Index]); }
-		////Returns utils::Bounds at index
-		utils::Bounds getBounds(int Index) { return dynamic_cast<RectangleData&>(Data[Index]).value; }
-		////Returns resource object from a link
-		ResourceBase &getLink(int Index) { return dynamic_cast<LinkData&>(Data[Index]).Get(); }
-		////Returns font object
-		Font getFont(int Index) { return dynamic_cast<FontData&>(Data[Index]).value; }
-		////Returns number of items in the array
-		int getCount() { return Data.getCount(); }
-		
-		////02030000h (Basic, Data resource)
-		virtual GID::Type getGID() const { return GID::Data; }
-		////Currently does nothing
-		virtual bool Save(File &File,std::ostream &Data) { return false; }
-
-		virtual ~DataResource() { Data.Destroy(); ResourceBase::~ResourceBase(); }
-
-		virtual void Prepare(GGEMain &main, File &file);
-
-	protected:
-		File *file;
-	};
-} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/File.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,119 @@
+#include "File.h"
+#include "Text.h"
+#include "Image.h"
+#include "DataArray.h"
+#include "Animation.h"
+#include "BitmapFont.h"
+#include "Sound.h"
+#include "FontTheme.h"
+#include "LinkNode.h"
+#include "FontTheme.h"
+#include "Pointer.h"
+
+using namespace std;
+using namespace gge::utils;
+
+namespace gge { namespace resource {
+
+	void File::LoadFile(const string &Filename) {
+		CheckAndDelete(root);
+
+		char sgn[7];
+
+		this->Filename=Filename;
+
+		///*Check file existence
+
+		ifstream data;
+		data.open(Filename, ios::in | ios::binary);
+		if(data.fail())
+			throw load_error(load_error::FileNotFound, load_error::strings::FileNotFound);
+
+
+		///*Check file signature
+		data.read(sgn, 6);
+		sgn[6]=0;
+		if(string("GORGON")!=sgn)
+			throw load_error(load_error::Signature, load_error::strings::Signature);
+
+		///*Check file version
+		ReadFrom(data, FileVersion);
+		if(FileVersion>CurrentVersion)
+			throw load_error(load_error::VersionMismatch, load_error::strings::VersionMismatch);
+
+		///*Load file type
+		ReadFrom(data, FileType);
+
+		///*Check first element
+		if(ReadFrom<int>(data)!=GID::Folder)
+			throw load_error(load_error::Containment, load_error::strings::Containment);
+
+		int size;
+		ReadFrom(data, size);
+
+		///*Load first element
+		root=LoadFolderResource(*this, data, size,LoadNames);
+		if(!root)
+			throw load_error(load_error::Containment, load_error::strings::Containment);
+
+		root->Resolve(*this);
+
+		isloaded=true;
+
+		///*Close file
+		data.close();
+	}
+
+	Base *File::LoadObject(istream &Data, int GID, int Size) {
+		for(utils::Collection<Loader>::Iterator loader=Loaders.First();
+			loader.IsValid(); loader.Next()) {
+
+			if(loader->GId==GID) {
+				return loader->Handler(*this, Data, Size);
+			}
+		}
+
+		EatChunk(Data,Size);
+		return NULL;
+	}
+
+	void File::AddBasicLoaders() {
+		Loaders.Add(new Loader(GID::Folder, std::bind(LoadFolderResource, placeholders::_1, placeholders::_2, placeholders::_3, false)));
+		Loaders.Add(new Loader(GID::LinkNode, LoadLinkNodeResource)); 
+		Loaders.Add(new Loader(GID::Text, LoadTextResource)); 
+		Loaders.Add(new Loader(GID::Image, LoadImageResource)); 
+		Loaders.Add(new Loader(GID::Data, LoadDataResource)); 
+	}
+
+	void File::AddExtendedLoaders() {
+		AddBasicLoaders();
+		Loaders.Add(new Loader(GID::Sound, LoadSoundResource)); 
+	}
+
+	void File::AddGameLoaders() {
+		AddExtendedLoaders();
+		Loaders.Add(new Loader(GID::Animation, LoadAnimationResource)); 
+		Loaders.Add(new Loader(GID::Pointer, LoadPointerResource)); 
+		Loaders.Add(new Loader(GID::Font, LoadBitmapFontResource)); 
+		Loaders.Add(new Loader(GID::FontTheme, LoadFontTheme)); 
+		Loaders.Add(new Loader(GID::FontTheme, LoadFontTheme)); 
+	}
+
+	Base * File::FindObject( utils::SGuid guid ) {
+		if(guid.isEmpty()) 
+			return NULL;
+
+		for(utils::Collection<Redirect>::Iterator i=Redirects.First();i.IsValid();i.Next()) {
+			if(i->source==guid)
+				guid=i->target;
+		}
+
+		return root->FindObject(guid);
+	}
+
+	const string load_error::strings::FileNotFound		= "Cannot find the file specified";
+	const string load_error::strings::Signature			= "Signature mismatch";
+	const string load_error::strings::VersionMismatch	= "Version mismatch";
+	const string load_error::strings::Containment		= "The supplied file is does not contain any data or its representation is invalid.";
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/File.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,162 @@
+#pragma once
+
+#include <stdexcept>
+#include <iostream>
+#include <fstream>
+#include <functional>
+
+#include "GRE.h"
+#include "../Utils/Collection.h"
+#include "Definitions.h"
+#include "Folder.h"
+
+namespace gge { namespace resource {
+
+	////This class defines a resource loader
+	class Loader {
+	public:
+		////This is Resource loader function prototype
+		typedef std::function<Base* (File&, std::istream&, int)> LoaderFunction;
+
+		////Gorgon ID of the resource
+		GID::Type GId;
+
+		////Load handler function
+		LoaderFunction Handler;
+
+		////Filling constructor
+		Loader(GID::Type gid, LoaderFunction handler) : GId(gid), Handler(handler) 
+		{ }
+	};
+
+	class Redirect {
+	public:
+		Redirect(utils::SGuid &source, utils::SGuid &target) : 
+		  source(source), target(target) { }
+
+		utils::SGuid source;
+		utils::SGuid target;
+	};
+
+	class load_error : public std::runtime_error {
+	public:
+
+		enum ErrorType {
+			FileNotFound	= 1,
+			Signature		= 2,
+			VersionMismatch	= 3,
+			Containment		= 4
+		};
+
+		class strings {
+		public:
+			static const string FileNotFound	;
+			static const string Signature		;
+			static const string VersionMismatch	;
+			static const string Containment		;
+		};
+
+
+		load_error(ErrorType number, const string &text) : runtime_error(text), number(number) {
+
+		}
+
+		load_error(ErrorType number, const char *text) : runtime_error(text), number(number) {
+
+		}
+
+		ErrorType number;
+	};
+
+	class File {
+	public:
+		File() : root(new Folder), LoadNames(false) {
+
+		}
+
+		////Resource Loaders
+		utils::Collection<Loader> Loaders;
+		utils::Collection<Redirect>		  Redirects;
+
+		////File type
+		GID::Type FileType;
+		////File version
+		int FileVersion;
+		bool LoadNames;
+		Folder &Root() { return *root; }
+		////Returns the filename used for the last load or save operation
+		string getFilename() const { return Filename; }
+
+		////Loads a given file throws load_error
+		///@Filename	: File to be loaded
+		void LoadFile(const string &Filename);
+
+		////Returns if a file is loaded
+		bool isLoaded() const { return isloaded; }
+
+		////Loads a resource object from the given file, GID and size
+		Base *LoadObject(std::istream &Data, int GID, int Size);
+
+		////Searches the given resource object within this file
+		Base *FindObject(utils::SGuid guid);
+
+		template<class T_>
+		void FindObject(utils::SGuid guid, T_ *&object) {
+			object=dynamic_cast<T_*>(FindObject(guid));
+		}
+		
+		////Adds basic resource loaders 
+		void AddBasicLoaders();
+
+		////Adds extended resource loaders
+		void AddExtendedLoaders();
+
+		////Adds game resource loaders
+		void AddGameLoaders();
+
+		void Prepare(GGEMain &main) { root->Prepare(main, *this); }
+		void Prepare(GGEMain *main) { root->Prepare(*main, *this); }
+		void Prepare() { root->Prepare(Main, *this); }
+
+	protected:
+		////The root folder, root changes while loading a file
+		Folder *root;
+
+	private:
+		bool isloaded;
+		string Filename;
+	};
+
+	inline void EatChunk(std::istream &file, std::streamoff Size) { file.seekg(Size, std::ios::cur); }
+
+	template<int B_, class T_>
+	inline void ReadFrom(std::istream &Data, T_ &object) {
+		Data.read(reinterpret_cast<char*>(&object), B_);
+	}
+
+	template<class T_>
+	inline void ReadFrom(std::istream &Data, T_ &object) {
+		Data.read(reinterpret_cast<char*>(&object), sizeof(object));
+	}
+
+	template<>
+	inline void ReadFrom<std::string>(std::istream &Data, std::string &object) {
+		int temp;
+		ReadFrom(Data, temp);
+		char *text=new char[temp];
+		Data.read(text, temp);
+		object.assign(text,temp);
+	}
+
+	template<class T_>
+	inline T_ ReadFrom(std::istream &Data) {
+		T_ object;
+		Data.read(reinterpret_cast<char*>(&object), sizeof(object));
+
+		return object;
+	}
+} }
+
+inline int operator +(const std::streampos &l, int r) {
+	return (int)l + r;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Folder.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,183 @@
+#include "Folder.h"
+#include "File.h"
+#include "../Utils/BufferList.h"
+
+
+#include "Base.h"
+#include "Text.h"
+#include "Image.h"
+#include "DataArray.h"
+#include "Sound.h"
+#include "Animation.h"
+#include "BitmapFont.h"
+
+using namespace std;
+using namespace gge::utils;
+
+namespace gge { namespace resource {
+
+	Folder *LoadFolderResource(File &File, istream &Data, int Size, bool LoadNames) {
+		int targetpos=Data.tellg()+Size;
+		char Namebuffer[256];
+		vector<string> names;
+		vector<string>::iterator namec=names.begin();
+
+		Folder *fold=new Folder();
+		fold->EntryPoint=(int)Data.tellg(); //forced to int because the system uses only 32 bits for size
+
+		while(Data.tellg()<targetpos) {
+			int gid, size;
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+
+			if(gid==GID::Folder_Names) {
+				if(LoadNames && fold->reallyloadnames) {
+					int targetpos=Data.tellg()+size;
+					while(Data.tellg()<targetpos) {
+						GID::Type gid; 
+						int size;
+						ReadFrom(Data, gid);
+						ReadFrom(Data, size);
+						
+						if(size>255) {
+							Data.read(Namebuffer, 255);
+							Namebuffer[255]=0;
+							EatChunk(Data, size-255);
+						}
+						else {
+							Data.read(Namebuffer, size);
+							Namebuffer[size]=0;
+						}
+
+						string s=Namebuffer;
+						int l=s.find('\x01');
+						s=s.substr(0,l);
+						names.push_back(s);
+					}
+
+					namec=names.begin();
+				}
+				else {
+					EatChunk(Data, size);
+				}
+			} 
+			else if(gid==GID::Guid) {
+				fold->guid.LoadLong(Data);
+			} 
+			else if(gid==GID::SGuid) {
+				fold->guid.Load(Data);
+			} 
+			else if(gid==GID::Folder_Props) {
+				fold->reallyloadnames=ReadFrom<int>(Data) ? true : false;
+
+				EatChunk(Data, size-4);
+			}
+			else if(gid==GID::Folder) {
+				Folder *obj=LoadFolderResource(File, Data, size, LoadNames);
+
+				fold->Subitems.Add(obj, fold->Subitems.HighestOrder()+1);
+				if(LoadNames && namec!=names.end()) {
+					obj->name=*namec;
+					++namec;
+				}
+
+			}
+			else {
+				///*Load sub resource
+				Base *obj=File.LoadObject(Data,gid,size);
+
+				if(obj!=NULL) {
+					fold->Subitems.Add(obj, fold->Subitems.HighestOrder()+1);
+					if(LoadNames && fold->reallyloadnames && namec!=names.end()) {
+						obj->name=*namec;
+						++namec;
+					}
+
+				} else {
+#ifdef _DEBUG
+					os::DisplayMessage("Folder Resource","Unknown Node!!");
+#endif
+				}
+			}
+
+		}
+
+		return fold;
+	}
+
+	
+		////Returns the given subitem with folder resource type. Used to avoid type casting
+	Folder	*Folder::asFolder	(int Index) { 
+#ifdef _DEBUG
+			if(Subitems[Index].getGID()!=GID::Folder) {
+				os::DisplayMessage("Folder Resource","Non folder item requested as folder!");
+				assert(0);
+			}
+#endif
+			return dynamic_cast<Folder*>(&Subitems[Index]); 
+		}
+	Text	*Folder::asText		(int Index) { 
+#ifdef _DEBUG
+		if(Subitems[Index].getGID()!=GID::Text) {
+			os::DisplayMessage("Folder Resource","Non text item requested as text!");
+			assert(0);
+		}
+#endif
+		return dynamic_cast<Text*>(&Subitems[Index]); 
+	}
+	Image	*Folder::asImage	(int Index) { 
+#ifdef _DEBUG
+		if(Subitems[Index].getGID()!=GID::Image) {
+			os::DisplayMessage("Folder Resource","Non image item requested as image!");
+			assert(0);
+		}
+#endif
+		return dynamic_cast<Image*>(&Subitems[Index]); 
+	}
+	DataArray	*Folder::asData		(int Index) { 
+#ifdef _DEBUG
+		if(Subitems[Index].getGID()!=GID::Data) {
+			os::DisplayMessage("Folder Resource","Non data item requested as data!");
+			assert(0);
+		}
+#endif
+		return dynamic_cast<DataArray*>(&Subitems[Index]); 
+	}
+	Sound	*Folder::asSound	(int Index) { 
+#ifdef _DEBUG
+		if(Subitems[Index].getGID()!=GID::Sound) {
+			os::DisplayMessage("Folder Resource","Non sound item requested as sound!");
+			assert(0);
+		}
+#endif
+		return dynamic_cast<Sound*>(&Subitems[Index]); 
+	}
+	Animation	*Folder::asAnimation	(int Index) { 
+#ifdef _DEBUG
+		if(Subitems[Index].getGID()!=GID::Animation) {
+			os::DisplayMessage("Folder Resource","Non animation item requested as animation!");
+			assert(0);
+		}
+#endif
+		return dynamic_cast<Animation*>(&Subitems[Index]); 
+	}
+	BitmapFont	*Folder::asBitmapFont	(int Index) { 
+#ifdef _DEBUG
+			if(Subitems[Index].getGID()!=GID::Font) {
+				os::DisplayMessage("Folder Resource","Non bitmap font item requested as bitmap font!");
+				assert(0);
+			}
+#endif
+			return dynamic_cast<BitmapFont*>(&Subitems[Index]); 
+		}
+
+	void Folder::Prepare(GGEMain &main, File &file) {
+		Base::Prepare(main, file);
+		
+		for(auto it=Subitems.First();it.IsValid();it.Next()) {
+			if(it->name!="")
+				namedlist.insert(std::pair<std::string, Base*>(it->name,it.CurrentPtr()));
+		}
+	}
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Folder.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,126 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include <map>
+
+namespace gge { namespace resource {
+	class File;
+	class Folder;
+	class Text;
+	class Image;
+	class DataArray;
+	class Sound;
+	class Animation;
+	class BitmapFont;
+	
+	////This function loads a folder resource from the given file
+	Folder *LoadFolderResource(File &File, std::istream &Data, int Size, bool LoadNames=false);
+
+	////This is basic folder resource, it holds other resources.
+	class Folder : public Base {
+		friend Folder *LoadFolderResource(File &File, std::istream &Data, int Size, bool LoadNames);
+	public:
+		Folder() : Base(), reallyloadnames(false), EntryPoint(-1) 
+		{ }
+
+		////Entry point of this resource within the physical file. If
+		/// no file is associated with this resource this value is -1.
+		int EntryPoint;
+
+		////01010000h, (System, Folder)
+		virtual GID::Type getGID() const { return GID::Folder; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+
+		////Returns the number of items contained
+		int			 getCount() const { return Subitems.getCount(); }
+		////Returns an item with the given index
+		Base	*getItem (int Index) { return &Subitems[Index]; }
+		////Returns an item with the given index
+		Base	&operator [] (int Index) { return (Subitems[Index]); }
+		////Adds a new resource to this folder
+		void	Add(Base *resource) { Subitems.Add(resource, Subitems.HighestOrder()+1); }
+		////Adds a new resource to this folder
+		Folder	&operator << (Base &resource) { Subitems.Add(resource); return *this; }
+
+		////Returns the given subitem with folder resource type. Used to avoid type casting
+		Folder	*asFolder	(int Index);
+		Text	*asText		(int Index);
+		Image	*asImage	(int Index);
+		DataArray	*asData		(int Index);
+		Sound	*asSound	(int Index);
+		Animation	*asAnimation(int Index);
+		BitmapFont	*asBitmapFont		(int Index);
+
+		//if you run into problems with dynamic_cast use CGet instead
+		template <typename T_>
+		T_ &Get(int Index) {
+			return dynamic_cast<T_&>(Subitems[Index]);
+		}
+
+		//if you run into problems with dynamic_cast use CGetPtr instead
+		template <typename T_>
+		T_ *GetPtr(int Index) {
+			return dynamic_cast<T_*>(&Subitems[Index]);
+		}
+
+		//try to use Get instead of this
+		template <typename T_>
+		T_ &CGet(int Index) {
+			return (T_&)(Subitems[Index]);
+		}
+
+		//try to use GetPtr instead of this
+		template <typename T_>
+		T_ *CGetPtr(int Index) {
+			return (T_*)(&Subitems[Index]);
+		}
+
+		bool Exists(int Index) const {
+			return Index>=0 && Index<Subitems.getCount();
+		}
+
+		bool Exists(const std::string &Index) const {
+			return namedlist.count(Index)>0;
+		}
+
+		//if you run into problems with dynamic_cast use CGet instead
+		template <typename T_>
+		T_ &Get(const std::string &Index) {
+			if(namedlist.count(Index)>0 && dynamic_cast<T_*>(namedlist[Index]))
+				return *dynamic_cast<T_*>(namedlist[Index]);
+			else
+				throw std::runtime_error("Requested item cannot be found");
+		}
+
+		//if you run into problems with dynamic_cast use CGetPtr instead
+		template <typename T_>
+		T_ *GetPtr(const std::string & Index) {
+			return dynamic_cast<T_*>(namedlist[Index]);
+		}
+
+		//try to use Get instead of this
+		template <typename T_>
+		T_ &CGet(const std::string & Index) {
+			if(namedlist.count(Index)>0)
+				return *(T_*)(namedlist[Index]);
+			else
+				throw std::runtime_error("Requested item cannot be found");
+		}
+
+		//try to use GetPtr instead of this
+		template <typename T_>
+		T_ *CGetPtr(const std::string & Index) {
+			return (T_*)(namedlist[Index]);
+		}
+
+		virtual void Prepare(GGEMain &main, File &file);
+
+
+
+	protected:
+		bool reallyloadnames;
+		std::map<std::string, Base*> namedlist;
+	};
+} }
--- a/Resource/FolderResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-#include "FolderResource.h"
-#include "ResourceFile.h"
-#include "../Utils/BufferList.h"
-
-
-#include "ResourceBase.h"
-#include "TextResource.h"
-#include "ImageResource.h"
-#include "DataResource.h"
-#include "SoundResource.h"
-#include "AnimationResource.h"
-#include "BitmapFontResource.h"
-
-using namespace std;
-using namespace gge::utils;
-
-namespace gge { namespace resource {
-
-	FolderResource *LoadFolderResource(File &File, istream &Data, int Size, bool LoadNames) {
-		int targetpos=Data.tellg()+Size;
-		char Namebuffer[256];
-		vector<string> names;
-		vector<string>::iterator namec=names.begin();
-
-		FolderResource *fold=new FolderResource();
-		fold->EntryPoint=(int)Data.tellg(); //forced to int because the system uses only 32 bits for size
-
-		while(Data.tellg()<targetpos) {
-			int gid, size;
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-
-			if(gid==GID::Folder_Names) {
-				if(LoadNames && fold->reallyloadnames) {
-					int targetpos=Data.tellg()+size;
-					while(Data.tellg()<targetpos) {
-						GID::Type gid; 
-						int size;
-						ReadFrom(Data, gid);
-						ReadFrom(Data, size);
-						
-						if(size>255) {
-							Data.read(Namebuffer, 255);
-							Namebuffer[255]=0;
-							EatChunk(Data, size-255);
-						}
-						else {
-							Data.read(Namebuffer, size);
-							Namebuffer[size]=0;
-						}
-
-						string s=Namebuffer;
-						int l=s.find('\x01');
-						s=s.substr(0,l);
-						names.push_back(s);
-					}
-
-					namec=names.begin();
-				}
-				else {
-					EatChunk(Data, size);
-				}
-			} 
-			else if(gid==GID::Guid) {
-				fold->guid.LoadLong(Data);
-			} 
-			else if(gid==GID::SGuid) {
-				fold->guid.Load(Data);
-			} 
-			else if(gid==GID::Folder_Props) {
-				fold->reallyloadnames=ReadFrom<int>(Data) ? true : false;
-
-				EatChunk(Data, size-4);
-			}
-			else if(gid==GID::Folder) {
-				FolderResource *obj=LoadFolderResource(File, Data, size, LoadNames);
-
-				fold->Subitems.Add(obj, fold->Subitems.HighestOrder()+1);
-				if(LoadNames && namec!=names.end()) {
-					obj->name=*namec;
-					++namec;
-				}
-
-			}
-			else {
-				///*Load sub resource
-				ResourceBase *obj=File.LoadObject(Data,gid,size);
-
-				if(obj!=NULL) {
-					fold->Subitems.Add(obj, fold->Subitems.HighestOrder()+1);
-					if(LoadNames && fold->reallyloadnames && namec!=names.end()) {
-						obj->name=*namec;
-						++namec;
-					}
-
-				} else {
-#ifdef _DEBUG
-					os::DisplayMessage("Folder Resource","Unknown Node!!");
-#endif
-				}
-			}
-
-		}
-
-		return fold;
-	}
-
-	
-		////Returns the given subitem with folder resource type. Used to avoid type casting
-	FolderResource	*FolderResource::asFolder	(int Index) { 
-#ifdef _DEBUG
-			if(Subitems[Index].getGID()!=GID::Folder) {
-				os::DisplayMessage("Folder Resource","Non folder item requested as folder!");
-				assert(0);
-			}
-#endif
-			return dynamic_cast<FolderResource*>(&Subitems[Index]); 
-		}
-	TextResource	*FolderResource::asText		(int Index) { 
-#ifdef _DEBUG
-		if(Subitems[Index].getGID()!=GID::Text) {
-			os::DisplayMessage("Folder Resource","Non text item requested as text!");
-			assert(0);
-		}
-#endif
-		return dynamic_cast<TextResource*>(&Subitems[Index]); 
-	}
-	ImageResource	*FolderResource::asImage	(int Index) { 
-#ifdef _DEBUG
-		if(Subitems[Index].getGID()!=GID::Image) {
-			os::DisplayMessage("Folder Resource","Non image item requested as image!");
-			assert(0);
-		}
-#endif
-		return dynamic_cast<ImageResource*>(&Subitems[Index]); 
-	}
-	DataResource	*FolderResource::asData		(int Index) { 
-#ifdef _DEBUG
-		if(Subitems[Index].getGID()!=GID::Data) {
-			os::DisplayMessage("Folder Resource","Non data item requested as data!");
-			assert(0);
-		}
-#endif
-		return dynamic_cast<DataResource*>(&Subitems[Index]); 
-	}
-	SoundResource	*FolderResource::asSound	(int Index) { 
-#ifdef _DEBUG
-		if(Subitems[Index].getGID()!=GID::Sound) {
-			os::DisplayMessage("Folder Resource","Non sound item requested as sound!");
-			assert(0);
-		}
-#endif
-		return dynamic_cast<SoundResource*>(&Subitems[Index]); 
-	}
-	AnimationResource	*FolderResource::asAnimation	(int Index) { 
-#ifdef _DEBUG
-		if(Subitems[Index].getGID()!=GID::Animation) {
-			os::DisplayMessage("Folder Resource","Non animation item requested as animation!");
-			assert(0);
-		}
-#endif
-		return dynamic_cast<AnimationResource*>(&Subitems[Index]); 
-	}
-	BitmapFontResource	*FolderResource::asBitmapFont	(int Index) { 
-#ifdef _DEBUG
-			if(Subitems[Index].getGID()!=GID::Font) {
-				os::DisplayMessage("Folder Resource","Non bitmap font item requested as bitmap font!");
-				assert(0);
-			}
-#endif
-			return dynamic_cast<BitmapFontResource*>(&Subitems[Index]); 
-		}
-
-	void FolderResource::Prepare(GGEMain &main, File &file) {
-		ResourceBase::Prepare(main, file);
-		
-		for(auto it=Subitems.First();it.isValid();it.Next()) {
-			if(it->name!="")
-				namedlist.insert(std::pair<std::string, ResourceBase*>(it->name,it.CurrentPtr()));
-		}
-	}
-
-} }
--- a/Resource/FolderResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include <map>
-
-namespace gge { namespace resource {
-	class File;
-	class FolderResource;
-	class TextResource;
-	class ImageResource;
-	class DataResource;
-	class SoundResource;
-	class AnimationResource;
-	class BitmapFontResource;
-	
-	////This function loads a folder resource from the given file
-	FolderResource *LoadFolderResource(File &File, std::istream &Data, int Size, bool LoadNames=false);
-
-	////This is basic folder resource, it holds other resources.
-	class FolderResource : public ResourceBase {
-		friend FolderResource *LoadFolderResource(File &File, std::istream &Data, int Size, bool LoadNames);
-	public:
-		FolderResource() : ResourceBase(), reallyloadnames(false), EntryPoint(-1) 
-		{ }
-
-		////Entry point of this resource within the physical file. If
-		/// no file is associated with this resource this value is -1.
-		int EntryPoint;
-
-		////01010000h, (System, Folder)
-		virtual GID::Type getGID() const { return GID::Folder; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-
-		////Returns the number of items contained
-		int			 getCount() const { return Subitems.getCount(); }
-		////Returns an item with the given index
-		ResourceBase	*getItem (int Index) { return &Subitems[Index]; }
-		////Returns an item with the given index
-		ResourceBase	&operator [] (int Index) { return (Subitems[Index]); }
-		////Adds a new resource to this folder
-		void	Add(ResourceBase *resource) { Subitems.Add(resource, Subitems.HighestOrder()+1); }
-		////Adds a new resource to this folder
-		FolderResource	&operator << (ResourceBase &resource) { Subitems.Add(resource); return *this; }
-
-		////Returns the given subitem with folder resource type. Used to avoid type casting
-		FolderResource	*asFolder	(int Index);
-		TextResource	*asText		(int Index);
-		ImageResource	*asImage	(int Index);
-		DataResource	*asData		(int Index);
-		SoundResource	*asSound	(int Index);
-		AnimationResource	*asAnimation(int Index);
-		BitmapFontResource	*asBitmapFont		(int Index);
-
-		//if you run into problems with dynamic_cast use CGet instead
-		template <typename T_>
-		T_ &Get(int Index) {
-			return dynamic_cast<T_&>(Subitems[Index]);
-		}
-
-		//if you run into problems with dynamic_cast use CGetPtr instead
-		template <typename T_>
-		T_ *GetPtr(int Index) {
-			return dynamic_cast<T_*>(&Subitems[Index]);
-		}
-
-		//try to use Get instead of this
-		template <typename T_>
-		T_ &CGet(int Index) {
-			return (T_&)(Subitems[Index]);
-		}
-
-		//try to use GetPtr instead of this
-		template <typename T_>
-		T_ *CGetPtr(int Index) {
-			return (T_*)(&Subitems[Index]);
-		}
-
-		bool Exists(int Index) const {
-			return Index>=0 && Index<Subitems.getCount();
-		}
-
-		bool Exists(const std::string &Index) const {
-			return namedlist.count(Index)>0;
-		}
-
-		//if you run into problems with dynamic_cast use CGet instead
-		template <typename T_>
-		T_ &Get(const std::string &Index) {
-			if(namedlist.count(Index)>0 && dynamic_cast<T_*>(namedlist[Index]))
-				return *dynamic_cast<T_*>(namedlist[Index]);
-			else
-				throw std::runtime_error("Requested item cannot be found");
-		}
-
-		//if you run into problems with dynamic_cast use CGetPtr instead
-		template <typename T_>
-		T_ *GetPtr(const std::string & Index) {
-			return dynamic_cast<T_*>(namedlist[Index]);
-		}
-
-		//try to use Get instead of this
-		template <typename T_>
-		T_ &CGet(const std::string & Index) {
-			if(namedlist.count(Index)>0)
-				return *(T_*)(namedlist[Index]);
-			else
-				throw std::runtime_error("Requested item cannot be found");
-		}
-
-		//try to use GetPtr instead of this
-		template <typename T_>
-		T_ *CGetPtr(const std::string & Index) {
-			return (T_*)(namedlist[Index]);
-		}
-
-		virtual void Prepare(GGEMain &main, File &file);
-
-
-
-	protected:
-		bool reallyloadnames;
-		std::map<std::string, ResourceBase*> namedlist;
-	};
-} }
--- a/Resource/FontTheme.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/FontTheme.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,11 +1,11 @@
 #include "FontTheme.h"
-#include "ResourceFile.h"
+#include "File.h"
 
 using namespace gge::utils;
 using namespace std;
 
 namespace gge { namespace resource {
-	ResourceBase *LoadFontTheme(File &File, std::istream &Data, int Size) {
+	Base *LoadFontTheme(File &File, std::istream &Data, int Size) {
 		FontTheme *ft=new FontTheme;
 		
 		int target=Data.tellg()+Size;
@@ -52,7 +52,7 @@
 	}
 
 	void FontTheme::Prepare(gge::GGEMain &main, File &file) {
-		ResourceBase::Prepare(main,file);
+		Base::Prepare(main,file);
 
 		NormalFont	= dynamic_cast<FontRenderer*>(file.FindObject(guid_normal));
 		BoldFont	= dynamic_cast<FontRenderer*>(file.FindObject(guid_bold));
--- a/Resource/FontTheme.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/FontTheme.h	Tue Feb 28 09:58:13 2012 +0000
@@ -2,8 +2,8 @@
 
 
 #include "GRE.h"
-#include "ResourceBase.h"
-#include "ImageResource.h"
+#include "Base.h"
+#include "Image.h"
 #include "../Engine/FontRenderer.h"
 #include "../Engine/GGEMain.h"
 #include "../Engine/Font.h"
@@ -14,10 +14,10 @@
 namespace gge { namespace resource {
 	class File;
 
-	ResourceBase *LoadFontTheme(File &File, std::istream &Data, int Size);
+	Base *LoadFontTheme(File &File, std::istream &Data, int Size);
 
-	class FontTheme : public ResourceBase {
-		friend ResourceBase *LoadFontTheme(File &File, std::istream &Data, int Size);
+	class FontTheme : public Base {
+		friend Base *LoadFontTheme(File &File, std::istream &Data, int Size);
 
 	public:
 
@@ -26,7 +26,7 @@
 		////Currently does nothing
 		virtual bool Save(File &File, std::ostream &Data) { return false; }
 
-		FontTheme() : ResourceBase(),
+		FontTheme() : Base(),
 			NormalFont(nullptr),
 			BoldFont(nullptr),
 			ItalicFont(nullptr),
@@ -46,7 +46,7 @@
 		FontTheme(FontRenderer *Normal,FontRenderer *Bold=NULL,FontRenderer *Italic=NULL,
 				  FontRenderer *Small=NULL,
 				  FontRenderer *H1=NULL,FontRenderer *H2=NULL,FontRenderer *H3=NULL) : 
-		    ResourceBase(),
+		    Base(),
 			NormalFont(Normal),
 			BoldFont(Bold),
 			ItalicFont(Italic),
--- a/Resource/GRE.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/GRE.h	Tue Feb 28 09:58:13 2012 +0000
@@ -14,6 +14,6 @@
 	////This namespace contains Gorgon Resource System.
 	namespace resource {
 		class File;
-		class ResourceBase;
+		class Base;
 	}
 }
--- a/Resource/Image & Animation.cd	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/Image & Animation.cd	Tue Feb 28 09:58:13 2012 +0000
@@ -4,7 +4,7 @@
     <Position X="6.5" Y="4.75" Width="1.5" />
     <TypeIdentifier>
       <HashCode>AAAAAKACgACBQAQAAAAAAAAEAEAEAAAAAAAAgAgAAAA=</HashCode>
-      <FileName>E:\Programs\Games\GGE-Test\Sources\GGE\Resource\ResourceBase.h</FileName>
+      <FileName>E:\Programs\Games\GGE-Test\Sources\GGE\Resource\Base.h</FileName>
     </TypeIdentifier>
   </Class>
   <Class Name="gge::resource::ResizableObject" Collapsed="true">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Image.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,697 @@
+#include "../External/PNG/png.h"
+#include "../External/PNG/pngstruct.h"
+#include "Image.h"
+#include "File.h"
+#include "NullImage.h"
+#include "../External/LZMA/LzmaDecode.h"
+#include "../External/JPEG/jpeglib.h"
+#include "../Engine/GGEMain.h"
+#include <cmath>
+#include "../Utils/BasicMath.h"
+
+using namespace gge::resource;
+using namespace gge::graphics;
+using namespace gge::utils;
+using namespace std;
+
+namespace gge { namespace resource {
+
+	void ReadDataFromInputStream(png_structp png_ptr, png_bytep outBytes, png_size_t byteCountToRead) {
+		if(!png_ptr->io_ptr)
+			return;  
+
+		istream& inputStream = *(istream*)(png_ptr->io_ptr);
+		inputStream.read((char*)outBytes,byteCountToRead);
+
+	} 
+
+	Image *LoadImageResource(File& File, istream &Data, int Size) {
+		int i;
+		Image *img=new Image;
+		img->File=&File;
+
+		bool lateloading=false;
+		//BYTE *compressionprops;
+		graphics::ColorMode::Type m;
+		 
+		int target=Data.tellg()+Size;
+		while(Data.tellg()<target) {
+			int gid,size;
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+			auto currenttarget=Data.tellg()+size;
+
+			if(gid==GID::Image_Props) {
+				int w, h;
+
+				ReadFrom(Data,w);
+				ReadFrom(Data,h);
+				ReadFrom(Data,m);
+				ReadFrom<int>(Data);
+
+				img->Resize(w,h,m);
+
+				if(size>16) {
+					lateloading=ReadFrom<char>(Data)!=0;
+				}
+
+				if(size!=17)
+					Data.seekg(size-17,ios::cur);
+			} 
+			else if(gid==GID::Guid) {
+				img->guid.LoadLong(Data);
+			}
+			else if(gid==GID::SGuid) {
+				img->guid.Load(Data);
+			}
+			else if(gid==GID::Image_Cmp_Props) {
+				ReadFrom(Data, img->Compression);
+
+				if(img->Compression==GID::LZMA) {
+					img->CompressionProps=new Byte[LZMA_PROPERTIES_SIZE];
+					Data.read((char*)img->CompressionProps, LZMA_PROPERTIES_SIZE);
+				}
+			} else if(gid==GID::Image_Data) {
+				if(lateloading) {
+					img->DataLocation=(int)Data.tellg();
+					img->DataSize=size;
+
+					Data.seekg(size,ios::cur);
+				} else {
+					if(img->Data.GetSize()!=size)
+						throw std::runtime_error("Image data size mismatch!");
+
+					Data.read((char*)img->Data.GetBuffer(),size);
+
+					img->isLoaded=true;
+				}
+			} else if(gid==GID::Image_Cmp_Data) {
+				if(lateloading) {
+					img->DataLocation=(int)Data.tellg();
+					img->DataSize=size;
+
+					Data.seekg(size,ios::cur);
+				} 
+				else {
+					if(img->Compression==GID::LZMA) {
+						Byte *tmpdata=new Byte[size];
+						Data.read((char*)tmpdata, size);
+
+						size_t processed,processed2;
+						CLzmaDecoderState state;
+
+						LzmaDecodeProperties(&state.Properties,img->CompressionProps,LZMA_PROPERTIES_SIZE);
+						state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
+
+						LzmaDecode(&state,tmpdata,size,&processed,img->Data,img->getwidth()*img->getheight()*img->GetBPP	(),&processed2);
+
+						free(state.Probs);
+						delete tmpdata;
+						delete img->CompressionProps;
+					} 
+					else if(img->Compression==GID::JPEG) {
+						int cpos=(int)Data.tellg();
+						jpeg_decompress_struct cinf;
+						jpeg_decompress_struct* cinfo=&cinf;
+
+
+						//Create an error handler
+						jpeg_error_mgr jerr;
+
+						//point the compression object to the error handler
+						cinfo->err=jpeg_std_error(&jerr);
+
+						//Initialize the decompression object
+						jpeg_create_decompress(cinfo);
+
+						FILE *data2;
+						fopen_s(&data2, File.getFilename().c_str(), "rb");
+						fseek(data2,cpos,SEEK_SET);
+						//Specify the data source
+						jpeg_stdio_src(cinfo, data2);
+						cinfo->src->fill_input_buffer(cinfo);
+
+						//Decode the jpeg data into the image
+						//Read in the header
+						jpeg_read_header(cinfo, true);
+
+						//start to decompress the data
+						jpeg_start_decompress(cinfo);
+
+						int channels=cinfo->num_components;
+
+						if(channels==3)
+							m=graphics::ColorMode::BGR;
+						else if(channels==4)
+							m=graphics::ColorMode::ABGR;
+						else if(channels=1)
+							m=graphics::ColorMode::Alpha;
+
+						if(img->GetMode()!=ColorMode::ARGB)
+							throw std::runtime_error("Image data size mismatch!");
+
+						int stride=img->GetWidth()*channels;
+						int rowsRead=0;
+
+						Byte ** rowPtr = new Byte * [img->getheight()];
+						for(i=0;i<img->GetHeight();i++)
+							rowPtr[i]=img->Data+stride*i;
+
+						while(cinfo->output_scanline < cinfo->output_height) {
+							//read in this row
+							rowsRead+=jpeg_read_scanlines(cinfo, rowPtr+rowsRead, cinfo->output_height - rowsRead);
+						}
+
+						delete rowPtr;
+						fclose(data2);
+					} 
+					else if(img->Compression==GID::PNG) {
+						png_structp png_ptr;
+						png_infop info_ptr;
+
+						unsigned long width,height;
+						int bit_depth,color_type;
+
+						unsigned char sig[8];
+
+						ReadFrom(Data,sig);
+						if (!png_check_sig(sig, 8))
+							goto errorout;
+
+						png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL,NULL);
+						if (!png_ptr)
+							goto errorout;
+
+						info_ptr = png_create_info_struct(png_ptr);
+						if (!info_ptr) {
+							png_destroy_read_struct(&png_ptr, NULL, NULL);
+							goto errorout;
+						}
+
+						png_set_read_fn(png_ptr, dynamic_cast<istream*>(&Data), &ReadDataFromInputStream);
+
+						png_set_sig_bytes(png_ptr, 8);
+						png_read_info(png_ptr, info_ptr);
+
+						png_get_IHDR(png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth,
+							&color_type, NULL, NULL, NULL);
+
+
+						if (color_type == PNG_COLOR_TYPE_PALETTE)
+							png_set_expand(png_ptr);
+						if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+							png_set_expand(png_ptr);
+						if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+							png_set_expand(png_ptr);
+						if (color_type == PNG_COLOR_TYPE_PALETTE)
+							png_set_palette_to_rgb(png_ptr);
+						if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+							png_set_expand_gray_1_2_4_to_8(png_ptr);
+						if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+							png_set_tRNS_to_alpha(png_ptr);
+						if (bit_depth == 16)
+							png_set_strip_16(png_ptr);
+						if (color_type == PNG_COLOR_TYPE_GRAY ||
+							color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+							png_set_gray_to_rgb(png_ptr);
+
+						unsigned int  i, rowbytes;
+						unsigned char **  row_pointers=new unsigned char*[height];
+
+						png_read_update_info(png_ptr, info_ptr);
+
+						int pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
+						int pChannels = (int)png_get_channels(png_ptr, info_ptr);
+
+						unsigned char *image_data;
+
+						image_data = new unsigned char[rowbytes*height];
+
+						if (image_data == NULL) {
+							png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+							goto errorout;
+						}
+
+						for (i = 0;  i < height;  ++i)
+							row_pointers[i] = image_data + i*rowbytes;
+
+						png_read_image(png_ptr, row_pointers);
+
+						png_read_end(png_ptr, NULL);
+
+						png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+
+
+						//currently only RGB is supported
+						if(pChannels!=4)
+							goto errorout;
+
+						for(unsigned y=0;y<height;y++) {
+							for(unsigned x=0;x<width;x++) {
+								img->Data[(x+y*width)*4+2]=row_pointers[y][x*4];
+								img->Data[(x+y*width)*4+1]=row_pointers[y][x*4+1];
+								img->Data[(x+y*width)*4+0]=row_pointers[y][x*4+2];
+								img->Data[(x+y*width)*4+3]=row_pointers[y][x*4+3];
+							}
+						}
+
+						delete[] row_pointers;
+						delete[] image_data;
+
+						img->isLoaded=true;
+					}
+					else {
+errorout:
+						Data.seekg(currenttarget, ios::beg);
+					}
+
+					img->isLoaded=true;
+				}
+			} 
+			else if(gid==GID::Image_Palette) {
+				img->Palette=new Byte[size];
+				Data.read((char*)img->Palette, size);
+			}
+		}
+
+		return img;
+	}
+
+	bool Image::Load(bool force) {
+		if(isLoaded && !force)
+			return false;
+
+		int i;
+		FILE *gfile;
+		errno_t err;
+		//To be compatible with JPEG read
+		err=fopen_s(&gfile, File->getFilename().data(), "rb");
+		if(err != 0) return false;
+
+		fseek(gfile,DataLocation,SEEK_SET);
+		
+		if(this->Compression==GID::LZMA) {
+			this->Data.Resize(this->GetWidth()*this->GetHeight()*this->GetBPP());
+			Byte *tmpdata=new Byte[DataSize];
+			fread(tmpdata,1,this->DataSize,gfile);
+			size_t processed,processed2;
+			CLzmaDecoderState state;
+
+			LzmaDecodeProperties(&state.Properties,this->CompressionProps,LZMA_PROPERTIES_SIZE);
+			state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
+
+			LzmaDecode(&state,tmpdata,DataSize,&processed,this->Data,this->GetWidth()*this->GetHeight()*this->GetBPP(),&processed2);
+
+			free(state.Probs);
+			delete tmpdata;
+			delete this->CompressionProps;
+		} else if(Compression==GID::JPEG) {
+			jpeg_decompress_struct cinf;
+			jpeg_decompress_struct* cinfo=&cinf;
+
+
+			//Create an error handler
+			jpeg_error_mgr jerr;
+
+			//point the compression object to the error handler
+			cinfo->err=jpeg_std_error(&jerr);
+
+			//Initialize the decompression object
+			jpeg_create_decompress(cinfo);
+
+			//Specify the data source
+			jpeg_stdio_src(cinfo, gfile);
+			cinfo->src->fill_input_buffer(cinfo);
+
+			//Decode the jpeg data into the image
+			//Read in the header
+			jpeg_read_header(cinfo, true);
+
+			//start to decompress the data
+			jpeg_start_decompress(cinfo);
+
+			int channels=cinfo->num_components;
+
+			if(channels==3)
+				Mode=graphics::ColorMode::BGR;
+			else if(channels==4)
+				Mode=graphics::ColorMode::ABGR;
+			else if(channels=1)
+				Mode=graphics::ColorMode::Alpha;
+
+			Data.Resize(GetWidth()*GetHeight()*channels);
+
+			int stride=GetWidth()*channels;
+			int rowsRead=0;
+
+			Byte ** rowPtr = new Byte * [GetHeight()];
+			for(i=0;i<GetHeight();i++)
+				rowPtr[i]=Data+stride*i;
+
+			while(cinfo->output_scanline < cinfo->output_height) {
+				//read in this row
+				rowsRead+=jpeg_read_scanlines(cinfo, rowPtr+rowsRead, cinfo->output_height - rowsRead);
+			}
+
+			delete rowPtr;
+		} else {
+			this->Data.Resize(DataSize);
+			fread(this->Data,1,DataSize,gfile);
+		}
+
+		fclose(gfile);
+
+		this->isLoaded=true;
+
+		return true;
+	}
+
+	void Image::Prepare(GGEMain &main, resource::File &file) {
+#ifdef _DEBUG
+			if(Data==NULL) {
+				os::DisplayMessage("Image Resource","Data is not loaded yet.");
+				assert(0);
+			}
+#endif
+		
+		if(Texture.ID>0)
+			system::DestroyTexture(&Texture);
+
+		Texture = graphics::system::GenerateTexture(Data, GetWidth(), GetHeight(), GetMode());
+	}
+
+	bool Image::PNGExport(string filename) {
+		int i;
+		errno_t err;
+		FILE*file;
+		err=fopen_s(&file,filename.data(),"wb");
+		if(err != 0) return false;
+		
+
+		png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+		if (!png_ptr)
+		   return false;
+
+		png_infop info_ptr = png_create_info_struct(png_ptr);
+		if (!info_ptr) {
+		   png_destroy_write_struct(&png_ptr,
+			 (png_infopp)NULL);
+		   return false;
+		}
+		setjmp(png_jmpbuf(png_ptr));
+		png_init_io(png_ptr, file);
+		png_set_IHDR(png_ptr, info_ptr, GetWidth(), GetHeight(),
+	       8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
+	       PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+
+		Byte *newdata=new Byte[GetWidth()*GetHeight()*4];
+		for(i=0;i<GetWidth()*GetHeight();i++) {
+			newdata[i*4+2]=Data[i*4+0];
+			newdata[i*4+1]=Data[i*4+1];
+			newdata[i*4+0]=Data[i*4+2];
+			newdata[i*4+3]=Data[i*4+3];
+		}
+
+		png_write_info(png_ptr, info_ptr);
+		Byte **rows=new Byte*[GetHeight()];
+		for(i=0;i<GetHeight();i++) {
+			rows[i]=newdata+i*GetWidth()*4;
+		}
+		png_write_image(png_ptr, rows);
+		png_write_end(png_ptr, NULL);
+
+
+		fclose(file);
+
+		return true;
+	}
+	Image::PNGReadError Image::ImportPNG(string filename) {
+
+		png_structp png_ptr;
+		png_infop info_ptr;
+
+		unsigned long width,height;
+		int bit_depth,color_type;
+
+		FILE *infile;
+		errno_t err;
+		err=fopen_s(&infile, filename.c_str(), "rb");
+		if(err != 0) return Image::FileNotFound;
+
+	    unsigned char sig[8];
+
+		fread(sig, 1, 8, infile);
+		if (!png_check_sig(sig, 8))
+			return Image::Signature;
+
+		png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL,NULL);
+		if (!png_ptr)
+			return Image::OutofMemory;   /* out of memory */
+
+		info_ptr = png_create_info_struct(png_ptr);
+		if (!info_ptr) {
+			png_destroy_read_struct(&png_ptr, NULL, NULL);
+			return Image::OutofMemory;   /* out of memory */
+		}
+
+		if (setjmp(png_ptr->longjmp_buffer)) {
+			png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+			return Image::ErrorHandlerProblem;
+		}
+
+		png_init_io(png_ptr, infile);
+		png_set_sig_bytes(png_ptr, 8);
+		png_read_info(png_ptr, info_ptr);
+
+		png_get_IHDR(png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth,
+			&color_type, NULL, NULL, NULL);
+
+
+		if (color_type == PNG_COLOR_TYPE_PALETTE)
+			png_set_expand(png_ptr);
+		if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+			png_set_expand(png_ptr);
+		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+			png_set_expand(png_ptr);
+		if (color_type == PNG_COLOR_TYPE_PALETTE)
+			png_set_palette_to_rgb(png_ptr);
+		if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+			png_set_expand_gray_1_2_4_to_8(png_ptr);
+		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+			png_set_tRNS_to_alpha(png_ptr);
+		if (bit_depth == 16)
+			png_set_strip_16(png_ptr);
+		if (color_type == PNG_COLOR_TYPE_GRAY ||
+			color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+			png_set_gray_to_rgb(png_ptr);
+
+		unsigned int  i, rowbytes;
+		unsigned char **  row_pointers=new unsigned char*[height];
+
+		png_read_update_info(png_ptr, info_ptr);
+
+		int pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
+		int pChannels = (int)png_get_channels(png_ptr, info_ptr);
+
+		unsigned char *image_data;
+
+		image_data = new unsigned char[rowbytes*height];
+
+		if (image_data == NULL) {
+			png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+			return Image::OutofMemory;
+		}
+
+		for (i = 0;  i < height;  ++i)
+			row_pointers[i] = image_data + i*rowbytes;
+
+		png_read_image(png_ptr, row_pointers);
+
+		png_read_end(png_ptr, NULL);
+
+		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+
+
+		Resize(width,height,graphics::ColorMode::ARGB);
+
+		//currently only RGB is supported
+		if(pChannels!=3)
+			return Image::UnimplementedType;
+
+		for(unsigned y=0;y<height;y++) {
+			for(unsigned x=0;x<width;x++) {
+				Data[(x+y*width)*4+2]=row_pointers[y][x*3];
+				Data[(x+y*width)*4+1]=row_pointers[y][x*3+1];
+				Data[(x+y*width)*4+0]=row_pointers[y][x*3+2];
+				Data[(x+y*width)*4+3]=0xff;
+			}
+		}
+		
+		delete[] row_pointers;
+		delete[] image_data;
+		
+		isLoaded=true;
+		LeaveData=true;
+
+		fclose(infile);
+
+		return NoError;
+	}
+
+	inline float gaussian(float amount, int dist) {
+		return exp(-(float)dist*(float)dist/(2*amount*amount))/sqrt(2*Pi*amount*amount);
+	}
+
+	Image &Image::Blur(float amount, int windowsize/*=-1*/) {
+		if(windowsize==-1)
+			windowsize=max(1,int(amount*1.5));
+
+		Image *img=new Image(Width+windowsize*2,Height+windowsize*2,Mode);
+
+		if(Mode==ColorMode::ARGB || Mode==ColorMode::ABGR) {
+			blurargb(amount, windowsize, img);
+		}
+		else {
+			bluralpha(amount, windowsize, img);
+		}
+
+		return *img;
+	}
+
+	void Image::blurargb(float amount, int windowsize, Image *img) {
+		float *kernel=new float[windowsize+1];
+		for(int i=0;i<=windowsize;i++)
+			kernel[i]=gaussian(amount, i);
+
+		int newimw=img->Width, newimh=img->Height;
+		int bpp=GetBPP();
+
+		for(int y=0;y<newimh;y++) {
+			for(int x=0;x<newimw;x++) {
+				for(int c=0;c<4;c++) {
+					float sum=0, sum_weights=0;
+					for(int yy=-windowsize;yy<=windowsize;yy++) {
+						for(int xx=-windowsize;xx<=windowsize;xx++) {
+							int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
+
+							if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
+								sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width)*bpp+c ];
+							}
+							sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
+						}
+					}
+
+					img->Data[ (x+y*img->Width)*bpp+c ]=(int)Round(sum/sum_weights);
+				}
+			}
+		}
+
+		delete[] kernel;
+	}
+
+	void Image::bluralpha(float amount, int windowsize, Image *img) {
+		float *kernel=new float[windowsize+1];
+		for(int i=0;i<=windowsize;i++)
+			kernel[i]=gaussian(amount, i);
+
+		int newimw=img->Width, newimh=img->Height;
+		int bpp=GetBPP();
+
+		for(int y=0;y<newimh;y++) {
+			for(int x=0;x<newimw;x++) {
+				float sum=0, sum_weights=0;
+				for(int yy=-windowsize;yy<=windowsize;yy++) {
+					for(int xx=-windowsize;xx<=windowsize;xx++) {
+						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
+
+						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
+							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width) ];
+						}
+						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
+					}
+				}
+
+				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
+			}
+		}
+
+		delete[] kernel;
+	}
+
+	Image &Image::Shadow(float amount, int windowsize/*=-1*/) {
+		if(windowsize==-1)
+			windowsize=max(1,int(amount*1.5));
+
+		Image *img=new Image(Width+windowsize*2,Height+windowsize*2,ColorMode::Alpha);
+
+		if(Mode==ColorMode::ARGB || Mode==ColorMode::ABGR) {
+			shadowargb(amount, windowsize, img);
+		}
+		else {
+			shadowalpha(amount, windowsize, img);
+		}
+
+		return *img;
+	}
+
+	void Image::shadowargb(float amount, int windowsize, Image *img) {
+		float *kernel=new float[windowsize+1];
+		for(int i=0;i<=windowsize;i++)
+			kernel[i]=gaussian(amount, i);
+
+		int newimw=img->Width, newimh=img->Height;
+		int bpp=GetBPP();
+
+		for(int y=0;y<newimh;y++) {
+			for(int x=0;x<newimw;x++) {
+				float sum=0, sum_weights=0;
+				for(int yy=-windowsize;yy<=windowsize;yy++) {
+					for(int xx=-windowsize;xx<=windowsize;xx++) {
+						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
+
+						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
+							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width)*bpp+3 ];
+						}
+						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
+					}
+				}
+
+				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
+			}
+		}
+
+		delete[] kernel;
+	}
+
+	void Image::shadowalpha(float amount, int windowsize, Image *img) {
+		float *kernel=new float[windowsize+1];
+		for(int i=0;i<=windowsize;i++)
+			kernel[i]=gaussian(amount, i);
+
+		int newimw=img->Width, newimh=img->Height;
+		int bpp=GetBPP();
+
+		for(int y=0;y<newimh;y++) {
+			for(int x=0;x<newimw;x++) {
+				float sum=0, sum_weights=0;
+				for(int yy=-windowsize;yy<=windowsize;yy++) {
+					for(int xx=-windowsize;xx<=windowsize;xx++) {
+						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
+
+						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
+							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ oldcoordx+oldcoordy*Width ];
+						}
+						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
+					}
+				}
+
+				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
+			}
+		}
+
+		delete[] kernel;
+	}
+
+
+	NullImage *NullImage::ni;
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Image.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,152 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "../Engine/Graphics.h"
+#include "ResizableObject.h"
+#include "../Engine/Animation.h"
+#include "../Engine/Image.h"
+
+#pragma warning(push)
+#pragma warning(disable:4250)
+
+namespace gge { namespace resource {
+	class File;
+	class Image;
+
+	////This function loads a text resource from the given file
+	Image *LoadImageResource(File& File, std::istream &Data, int Size);
+
+	////This is image resource that holds information about a single image. It supports
+	/// two color modes (ARGB and AL); lzma and jpg compressions
+	class Image : 
+		public Base, virtual public ResizableObject, virtual public ResizableObjectProvider, 
+		virtual public animation::RectangularGraphic2DSequenceProvider, virtual public graphics::ImageTexture,
+		public graphics::ImageData, virtual public animation::RectangularGraphic2DAnimation
+	{
+		friend Image *LoadImageResource(File &File, std::istream &Data, int Size);
+	public:
+		enum PNGReadError {
+			NoError=0,
+			Signature=1,
+			ErrorHandlerProblem=2,
+			OutofMemory=4, 
+			UnimplementedType,
+			FileNotFound
+		};
+
+		////Not used, if paletted image is found, this holds its palette
+		Byte *Palette;
+		////Whether image is loaded or not. Image that are marked as late loading
+		/// are not loaded in initial load request. Image data can be retrieved by
+		/// calling Load function.
+		bool isLoaded;
+		////Whether to leave the data after this image resource is transformed into
+		/// an image object. This flag is used by other systems.
+		bool LeaveData;
+
+		Image() : animation::Base(), ImageTexture(), ImageData() {
+			isLoaded=LeaveData=false; Palette=NULL; 
+			animation::Animations.Remove(this);
+		}
+
+		Image(int Width, int Height, graphics::ColorMode::Type Mode=graphics::ColorMode::ARGB) : animation::Base(), ImageTexture(), ImageData() {
+			this->Resize(Width, Height, Mode);
+			animation::Animations.Remove(this);
+		}
+
+		bool PNGExport(string filename);
+		
+		////02020000h (Basic, Image)
+		virtual GID::Type getGID() const { return GID::Image; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+		////Loads image data from the file. This function is required for late
+		/// loading.
+		bool Load(bool force=false);
+
+		virtual void Prepare(GGEMain &main, File &file);
+
+		PNGReadError ImportPNG(string filename);
+
+		////Returns Bytes/Pixel information
+		int GetBPP() { return graphics::getBPP(Mode); }
+		graphics::ColorMode::Type GetMode() { return Mode; }
+ 
+
+		////Destroys used data
+		void destroy() { Data.RemoveReference(); if(Palette) delete Palette; }
+
+		////Destroys used data
+		virtual ~Image() { if(Palette) delete Palette; }
+
+		/* FOR ANIMATION INTERFACES */
+		virtual void DeleteAnimation() { } //if used as animation, it will not be deleted
+	//TODO ownership has issues in here
+		virtual Image &CreateAnimation(animation::Timer &controller, bool owner=false) { return *this; }
+		virtual Image &CreateAnimation(bool create=false) { return *this; }
+
+		virtual Image &CreateResizableObject(animation::Timer &controller, bool owner=false) { return *this; }
+		virtual Image &CreateResizableObject(bool create=false) { return *this; }
+
+		virtual graphics::RectangularGraphic2D &GraphicAt(unsigned time) { return *this; }
+
+		virtual graphics::Image2D & ImageAt(int time) { return *this; }
+
+		virtual int GetDuration() const	{ return 1; }
+		virtual int GetDuration(unsigned Frame) const { return 1; }
+		virtual int GetNumberofFrames() const { return 1; }
+
+		//Caller is responsible to supply a time between 0 and GetDuration()-1, if no frame exists it should return -1
+		virtual int		 FrameAt(unsigned Time) const { return 0; }
+		//Should always return a time between 0 and GetDuration unless Frame does not exists it should return -1
+		virtual int		 StartOf(unsigned Frame) const { return 0; }
+		virtual	int		 EndOf(unsigned Frame) const { return 1; }
+		/* ... */
+
+		Image &Blur(float amount, int windowsize=-1);
+		Image &Shadow(float amount, int windowsize=-1);
+
+		virtual int GetWidth() const {
+			if(Texture.ID) {
+				return ImageTexture::GetWidth();
+			}
+			else {
+				return ImageData::GetWidth();
+			}
+		}
+
+		virtual int GetHeight() const {
+			if(Texture.ID) {
+				return ImageTexture::GetHeight();
+			}
+			else {
+				return ImageData::GetHeight();
+			}
+		}
+
+		using graphics::ImageTexture::drawin;
+
+	protected:
+		virtual animation::ProgressResult::Type Progress() { return animation::ProgressResult::None; };
+
+		////The file that this image resource is related, used for late loading
+		File *File;
+		////Compression properties read from file, used for late loading
+		Byte *CompressionProps;
+		////Compression mode, not suitable for saving, used for late loading
+		int Compression;
+		////Size of the image data within the file, used for late loading
+		int DataSize;
+		////Location of image data within the file, used for late loading
+		int DataLocation;
+
+		void blurargb(float amount, int windowsize, Image *img);
+		void bluralpha(float amount, int windowsize, Image *img);
+
+		void shadowargb(float amount, int windowsize, Image *img);
+		void shadowalpha(float amount, int windowsize, Image *img);
+	};
+} }
+
+#pragma warning(pop)
--- a/Resource/ImageResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,697 +0,0 @@
-#include "../External/PNG/png.h"
-#include "../External/PNG/pngstruct.h"
-#include "ImageResource.h"
-#include "ResourceFile.h"
-#include "NullImage.h"
-#include "../External/LZMA/LzmaDecode.h"
-#include "../External/JPEG/jpeglib.h"
-#include "../Engine/GGEMain.h"
-#include <cmath>
-#include "../Utils/BasicMath.h"
-
-using namespace gge::resource;
-using namespace gge::graphics;
-using namespace gge::utils;
-using namespace std;
-
-namespace gge { namespace resource {
-
-	void ReadDataFromInputStream(png_structp png_ptr, png_bytep outBytes, png_size_t byteCountToRead) {
-		if(!png_ptr->io_ptr)
-			return;  
-
-		istream& inputStream = *(istream*)(png_ptr->io_ptr);
-		inputStream.read((char*)outBytes,byteCountToRead);
-
-	} 
-
-	ImageResource *LoadImageResource(File& File, istream &Data, int Size) {
-		int i;
-		ImageResource *img=new ImageResource;
-		img->File=&File;
-
-		bool lateloading=false;
-		//BYTE *compressionprops;
-		graphics::ColorMode::Type m;
-		 
-		int target=Data.tellg()+Size;
-		while(Data.tellg()<target) {
-			int gid,size;
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-			auto currenttarget=Data.tellg()+size;
-
-			if(gid==GID::Image_Props) {
-				int w, h;
-
-				ReadFrom(Data,w);
-				ReadFrom(Data,h);
-				ReadFrom(Data,m);
-				ReadFrom<int>(Data);
-
-				img->Resize(w,h,m);
-
-				if(size>16) {
-					lateloading=ReadFrom<char>(Data)!=0;
-				}
-
-				if(size!=17)
-					Data.seekg(size-17,ios::cur);
-			} 
-			else if(gid==GID::Guid) {
-				img->guid.LoadLong(Data);
-			}
-			else if(gid==GID::SGuid) {
-				img->guid.Load(Data);
-			}
-			else if(gid==GID::Image_Cmp_Props) {
-				ReadFrom(Data, img->Compression);
-
-				if(img->Compression==GID::LZMA) {
-					img->CompressionProps=new Byte[LZMA_PROPERTIES_SIZE];
-					Data.read((char*)img->CompressionProps, LZMA_PROPERTIES_SIZE);
-				}
-			} else if(gid==GID::Image_Data) {
-				if(lateloading) {
-					img->DataLocation=(int)Data.tellg();
-					img->DataSize=size;
-
-					Data.seekg(size,ios::cur);
-				} else {
-					if(img->Data.GetSize()!=size)
-						throw std::runtime_error("Image data size mismatch!");
-
-					Data.read((char*)img->Data.GetBuffer(),size);
-
-					img->isLoaded=true;
-				}
-			} else if(gid==GID::Image_Cmp_Data) {
-				if(lateloading) {
-					img->DataLocation=(int)Data.tellg();
-					img->DataSize=size;
-
-					Data.seekg(size,ios::cur);
-				} 
-				else {
-					if(img->Compression==GID::LZMA) {
-						Byte *tmpdata=new Byte[size];
-						Data.read((char*)tmpdata, size);
-
-						size_t processed,processed2;
-						CLzmaDecoderState state;
-
-						LzmaDecodeProperties(&state.Properties,img->CompressionProps,LZMA_PROPERTIES_SIZE);
-						state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
-
-						LzmaDecode(&state,tmpdata,size,&processed,img->Data,img->getwidth()*img->getheight()*img->GetBPP	(),&processed2);
-
-						free(state.Probs);
-						delete tmpdata;
-						delete img->CompressionProps;
-					} 
-					else if(img->Compression==GID::JPEG) {
-						int cpos=(int)Data.tellg();
-						jpeg_decompress_struct cinf;
-						jpeg_decompress_struct* cinfo=&cinf;
-
-
-						//Create an error handler
-						jpeg_error_mgr jerr;
-
-						//point the compression object to the error handler
-						cinfo->err=jpeg_std_error(&jerr);
-
-						//Initialize the decompression object
-						jpeg_create_decompress(cinfo);
-
-						FILE *data2;
-						fopen_s(&data2, File.getFilename().c_str(), "rb");
-						fseek(data2,cpos,SEEK_SET);
-						//Specify the data source
-						jpeg_stdio_src(cinfo, data2);
-						cinfo->src->fill_input_buffer(cinfo);
-
-						//Decode the jpeg data into the image
-						//Read in the header
-						jpeg_read_header(cinfo, true);
-
-						//start to decompress the data
-						jpeg_start_decompress(cinfo);
-
-						int channels=cinfo->num_components;
-
-						if(channels==3)
-							m=graphics::ColorMode::BGR;
-						else if(channels==4)
-							m=graphics::ColorMode::ABGR;
-						else if(channels=1)
-							m=graphics::ColorMode::Alpha;
-
-						if(img->GetMode()!=ColorMode::ARGB)
-							throw std::runtime_error("Image data size mismatch!");
-
-						int stride=img->GetWidth()*channels;
-						int rowsRead=0;
-
-						Byte ** rowPtr = new Byte * [img->getheight()];
-						for(i=0;i<img->GetHeight();i++)
-							rowPtr[i]=img->Data+stride*i;
-
-						while(cinfo->output_scanline < cinfo->output_height) {
-							//read in this row
-							rowsRead+=jpeg_read_scanlines(cinfo, rowPtr+rowsRead, cinfo->output_height - rowsRead);
-						}
-
-						delete rowPtr;
-						fclose(data2);
-					} 
-					else if(img->Compression==GID::PNG) {
-						png_structp png_ptr;
-						png_infop info_ptr;
-
-						unsigned long width,height;
-						int bit_depth,color_type;
-
-						unsigned char sig[8];
-
-						ReadFrom(Data,sig);
-						if (!png_check_sig(sig, 8))
-							goto errorout;
-
-						png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL,NULL);
-						if (!png_ptr)
-							goto errorout;
-
-						info_ptr = png_create_info_struct(png_ptr);
-						if (!info_ptr) {
-							png_destroy_read_struct(&png_ptr, NULL, NULL);
-							goto errorout;
-						}
-
-						png_set_read_fn(png_ptr, dynamic_cast<istream*>(&Data), &ReadDataFromInputStream);
-
-						png_set_sig_bytes(png_ptr, 8);
-						png_read_info(png_ptr, info_ptr);
-
-						png_get_IHDR(png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth,
-							&color_type, NULL, NULL, NULL);
-
-
-						if (color_type == PNG_COLOR_TYPE_PALETTE)
-							png_set_expand(png_ptr);
-						if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
-							png_set_expand(png_ptr);
-						if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
-							png_set_expand(png_ptr);
-						if (color_type == PNG_COLOR_TYPE_PALETTE)
-							png_set_palette_to_rgb(png_ptr);
-						if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
-							png_set_expand_gray_1_2_4_to_8(png_ptr);
-						if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
-							png_set_tRNS_to_alpha(png_ptr);
-						if (bit_depth == 16)
-							png_set_strip_16(png_ptr);
-						if (color_type == PNG_COLOR_TYPE_GRAY ||
-							color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-							png_set_gray_to_rgb(png_ptr);
-
-						unsigned int  i, rowbytes;
-						unsigned char **  row_pointers=new unsigned char*[height];
-
-						png_read_update_info(png_ptr, info_ptr);
-
-						int pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
-						int pChannels = (int)png_get_channels(png_ptr, info_ptr);
-
-						unsigned char *image_data;
-
-						image_data = new unsigned char[rowbytes*height];
-
-						if (image_data == NULL) {
-							png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-							goto errorout;
-						}
-
-						for (i = 0;  i < height;  ++i)
-							row_pointers[i] = image_data + i*rowbytes;
-
-						png_read_image(png_ptr, row_pointers);
-
-						png_read_end(png_ptr, NULL);
-
-						png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
-
-						//currently only RGB is supported
-						if(pChannels!=4)
-							goto errorout;
-
-						for(unsigned y=0;y<height;y++) {
-							for(unsigned x=0;x<width;x++) {
-								img->Data[(x+y*width)*4+2]=row_pointers[y][x*4];
-								img->Data[(x+y*width)*4+1]=row_pointers[y][x*4+1];
-								img->Data[(x+y*width)*4+0]=row_pointers[y][x*4+2];
-								img->Data[(x+y*width)*4+3]=row_pointers[y][x*4+3];
-							}
-						}
-
-						delete[] row_pointers;
-						delete[] image_data;
-
-						img->isLoaded=true;
-					}
-					else {
-errorout:
-						Data.seekg(currenttarget, ios::beg);
-					}
-
-					img->isLoaded=true;
-				}
-			} 
-			else if(gid==GID::Image_Palette) {
-				img->Palette=new Byte[size];
-				Data.read((char*)img->Palette, size);
-			}
-		}
-
-		return img;
-	}
-
-	bool ImageResource::Load(bool force) {
-		if(isLoaded && !force)
-			return false;
-
-		int i;
-		FILE *gfile;
-		errno_t err;
-		//To be compatible with JPEG read
-		err=fopen_s(&gfile, File->getFilename().data(), "rb");
-		if(err != 0) return false;
-
-		fseek(gfile,DataLocation,SEEK_SET);
-		
-		if(this->Compression==GID::LZMA) {
-			this->Data.Resize(this->GetWidth()*this->GetHeight()*this->GetBPP());
-			Byte *tmpdata=new Byte[DataSize];
-			fread(tmpdata,1,this->DataSize,gfile);
-			size_t processed,processed2;
-			CLzmaDecoderState state;
-
-			LzmaDecodeProperties(&state.Properties,this->CompressionProps,LZMA_PROPERTIES_SIZE);
-			state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
-
-			LzmaDecode(&state,tmpdata,DataSize,&processed,this->Data,this->GetWidth()*this->GetHeight()*this->GetBPP(),&processed2);
-
-			free(state.Probs);
-			delete tmpdata;
-			delete this->CompressionProps;
-		} else if(Compression==GID::JPEG) {
-			jpeg_decompress_struct cinf;
-			jpeg_decompress_struct* cinfo=&cinf;
-
-
-			//Create an error handler
-			jpeg_error_mgr jerr;
-
-			//point the compression object to the error handler
-			cinfo->err=jpeg_std_error(&jerr);
-
-			//Initialize the decompression object
-			jpeg_create_decompress(cinfo);
-
-			//Specify the data source
-			jpeg_stdio_src(cinfo, gfile);
-			cinfo->src->fill_input_buffer(cinfo);
-
-			//Decode the jpeg data into the image
-			//Read in the header
-			jpeg_read_header(cinfo, true);
-
-			//start to decompress the data
-			jpeg_start_decompress(cinfo);
-
-			int channels=cinfo->num_components;
-
-			if(channels==3)
-				Mode=graphics::ColorMode::BGR;
-			else if(channels==4)
-				Mode=graphics::ColorMode::ABGR;
-			else if(channels=1)
-				Mode=graphics::ColorMode::Alpha;
-
-			Data.Resize(GetWidth()*GetHeight()*channels);
-
-			int stride=GetWidth()*channels;
-			int rowsRead=0;
-
-			Byte ** rowPtr = new Byte * [GetHeight()];
-			for(i=0;i<GetHeight();i++)
-				rowPtr[i]=Data+stride*i;
-
-			while(cinfo->output_scanline < cinfo->output_height) {
-				//read in this row
-				rowsRead+=jpeg_read_scanlines(cinfo, rowPtr+rowsRead, cinfo->output_height - rowsRead);
-			}
-
-			delete rowPtr;
-		} else {
-			this->Data.Resize(DataSize);
-			fread(this->Data,1,DataSize,gfile);
-		}
-
-		fclose(gfile);
-
-		this->isLoaded=true;
-
-		return true;
-	}
-
-	void ImageResource::Prepare(GGEMain &main, resource::File &file) {
-#ifdef _DEBUG
-			if(Data==NULL) {
-				os::DisplayMessage("Image Resource","Data is not loaded yet.");
-				assert(0);
-			}
-#endif
-		
-		if(Texture.ID>0)
-			system::DestroyTexture(&Texture);
-
-		Texture = graphics::system::GenerateTexture(Data, GetWidth(), GetHeight(), GetMode());
-	}
-
-	bool ImageResource::PNGExport(string filename) {
-		int i;
-		errno_t err;
-		FILE*file;
-		err=fopen_s(&file,filename.data(),"wb");
-		if(err != 0) return false;
-		
-
-		png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-		if (!png_ptr)
-		   return false;
-
-		png_infop info_ptr = png_create_info_struct(png_ptr);
-		if (!info_ptr) {
-		   png_destroy_write_struct(&png_ptr,
-			 (png_infopp)NULL);
-		   return false;
-		}
-		setjmp(png_jmpbuf(png_ptr));
-		png_init_io(png_ptr, file);
-		png_set_IHDR(png_ptr, info_ptr, GetWidth(), GetHeight(),
-	       8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
-	       PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
-
-		Byte *newdata=new Byte[GetWidth()*GetHeight()*4];
-		for(i=0;i<GetWidth()*GetHeight();i++) {
-			newdata[i*4+2]=Data[i*4+0];
-			newdata[i*4+1]=Data[i*4+1];
-			newdata[i*4+0]=Data[i*4+2];
-			newdata[i*4+3]=Data[i*4+3];
-		}
-
-		png_write_info(png_ptr, info_ptr);
-		Byte **rows=new Byte*[GetHeight()];
-		for(i=0;i<GetHeight();i++) {
-			rows[i]=newdata+i*GetWidth()*4;
-		}
-		png_write_image(png_ptr, rows);
-		png_write_end(png_ptr, NULL);
-
-
-		fclose(file);
-
-		return true;
-	}
-	ImageResource::PNGReadError ImageResource::ImportPNG(string filename) {
-
-		png_structp png_ptr;
-		png_infop info_ptr;
-
-		unsigned long width,height;
-		int bit_depth,color_type;
-
-		FILE *infile;
-		errno_t err;
-		err=fopen_s(&infile, filename.c_str(), "rb");
-		if(err != 0) return ImageResource::FileNotFound;
-
-	    unsigned char sig[8];
-
-		fread(sig, 1, 8, infile);
-		if (!png_check_sig(sig, 8))
-			return ImageResource::Signature;
-
-		png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL,NULL);
-		if (!png_ptr)
-			return ImageResource::OutofMemory;   /* out of memory */
-
-		info_ptr = png_create_info_struct(png_ptr);
-		if (!info_ptr) {
-			png_destroy_read_struct(&png_ptr, NULL, NULL);
-			return ImageResource::OutofMemory;   /* out of memory */
-		}
-
-		if (setjmp(png_ptr->longjmp_buffer)) {
-			png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-			return ImageResource::ErrorHandlerProblem;
-		}
-
-		png_init_io(png_ptr, infile);
-		png_set_sig_bytes(png_ptr, 8);
-		png_read_info(png_ptr, info_ptr);
-
-		png_get_IHDR(png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth,
-			&color_type, NULL, NULL, NULL);
-
-
-		if (color_type == PNG_COLOR_TYPE_PALETTE)
-			png_set_expand(png_ptr);
-		if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
-			png_set_expand(png_ptr);
-		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
-			png_set_expand(png_ptr);
-		if (color_type == PNG_COLOR_TYPE_PALETTE)
-			png_set_palette_to_rgb(png_ptr);
-		if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
-			png_set_expand_gray_1_2_4_to_8(png_ptr);
-		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
-			png_set_tRNS_to_alpha(png_ptr);
-		if (bit_depth == 16)
-			png_set_strip_16(png_ptr);
-		if (color_type == PNG_COLOR_TYPE_GRAY ||
-			color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-			png_set_gray_to_rgb(png_ptr);
-
-		unsigned int  i, rowbytes;
-		unsigned char **  row_pointers=new unsigned char*[height];
-
-		png_read_update_info(png_ptr, info_ptr);
-
-		int pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
-		int pChannels = (int)png_get_channels(png_ptr, info_ptr);
-
-		unsigned char *image_data;
-
-		image_data = new unsigned char[rowbytes*height];
-
-		if (image_data == NULL) {
-			png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-			return ImageResource::OutofMemory;
-		}
-
-		for (i = 0;  i < height;  ++i)
-			row_pointers[i] = image_data + i*rowbytes;
-
-		png_read_image(png_ptr, row_pointers);
-
-		png_read_end(png_ptr, NULL);
-
-		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-
-
-		Resize(width,height,graphics::ColorMode::ARGB);
-
-		//currently only RGB is supported
-		if(pChannels!=3)
-			return ImageResource::UnimplementedType;
-
-		for(unsigned y=0;y<height;y++) {
-			for(unsigned x=0;x<width;x++) {
-				Data[(x+y*width)*4+2]=row_pointers[y][x*3];
-				Data[(x+y*width)*4+1]=row_pointers[y][x*3+1];
-				Data[(x+y*width)*4+0]=row_pointers[y][x*3+2];
-				Data[(x+y*width)*4+3]=0xff;
-			}
-		}
-		
-		delete[] row_pointers;
-		delete[] image_data;
-		
-		isLoaded=true;
-		LeaveData=true;
-
-		fclose(infile);
-
-		return NoError;
-	}
-
-	inline float gaussian(float amount, int dist) {
-		return exp(-(float)dist*(float)dist/(2*amount*amount))/sqrt(2*Pi*amount*amount);
-	}
-
-	ImageResource &ImageResource::Blur(float amount, int windowsize/*=-1*/) {
-		if(windowsize==-1)
-			windowsize=max(1,int(amount*1.5));
-
-		ImageResource *img=new ImageResource(Width+windowsize*2,Height+windowsize*2,Mode);
-
-		if(Mode==ColorMode::ARGB || Mode==ColorMode::ABGR) {
-			blurargb(amount, windowsize, img);
-		}
-		else {
-			bluralpha(amount, windowsize, img);
-		}
-
-		return *img;
-	}
-
-	void ImageResource::blurargb(float amount, int windowsize, ImageResource *img) {
-		float *kernel=new float[windowsize+1];
-		for(int i=0;i<=windowsize;i++)
-			kernel[i]=gaussian(amount, i);
-
-		int newimw=img->Width, newimh=img->Height;
-		int bpp=GetBPP();
-
-		for(int y=0;y<newimh;y++) {
-			for(int x=0;x<newimw;x++) {
-				for(int c=0;c<4;c++) {
-					float sum=0, sum_weights=0;
-					for(int yy=-windowsize;yy<=windowsize;yy++) {
-						for(int xx=-windowsize;xx<=windowsize;xx++) {
-							int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
-
-							if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
-								sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width)*bpp+c ];
-							}
-							sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
-						}
-					}
-
-					img->Data[ (x+y*img->Width)*bpp+c ]=(int)Round(sum/sum_weights);
-				}
-			}
-		}
-
-		delete[] kernel;
-	}
-
-	void ImageResource::bluralpha(float amount, int windowsize, ImageResource *img) {
-		float *kernel=new float[windowsize+1];
-		for(int i=0;i<=windowsize;i++)
-			kernel[i]=gaussian(amount, i);
-
-		int newimw=img->Width, newimh=img->Height;
-		int bpp=GetBPP();
-
-		for(int y=0;y<newimh;y++) {
-			for(int x=0;x<newimw;x++) {
-				float sum=0, sum_weights=0;
-				for(int yy=-windowsize;yy<=windowsize;yy++) {
-					for(int xx=-windowsize;xx<=windowsize;xx++) {
-						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
-
-						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
-							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width) ];
-						}
-						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
-					}
-				}
-
-				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
-			}
-		}
-
-		delete[] kernel;
-	}
-
-	ImageResource &ImageResource::Shadow(float amount, int windowsize/*=-1*/) {
-		if(windowsize==-1)
-			windowsize=max(1,int(amount*1.5));
-
-		ImageResource *img=new ImageResource(Width+windowsize*2,Height+windowsize*2,ColorMode::Alpha);
-
-		if(Mode==ColorMode::ARGB || Mode==ColorMode::ABGR) {
-			shadowargb(amount, windowsize, img);
-		}
-		else {
-			shadowalpha(amount, windowsize, img);
-		}
-
-		return *img;
-	}
-
-	void ImageResource::shadowargb(float amount, int windowsize, ImageResource *img) {
-		float *kernel=new float[windowsize+1];
-		for(int i=0;i<=windowsize;i++)
-			kernel[i]=gaussian(amount, i);
-
-		int newimw=img->Width, newimh=img->Height;
-		int bpp=GetBPP();
-
-		for(int y=0;y<newimh;y++) {
-			for(int x=0;x<newimw;x++) {
-				float sum=0, sum_weights=0;
-				for(int yy=-windowsize;yy<=windowsize;yy++) {
-					for(int xx=-windowsize;xx<=windowsize;xx++) {
-						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
-
-						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
-							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ (oldcoordx+oldcoordy*Width)*bpp+3 ];
-						}
-						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
-					}
-				}
-
-				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
-			}
-		}
-
-		delete[] kernel;
-	}
-
-	void ImageResource::shadowalpha(float amount, int windowsize, ImageResource *img) {
-		float *kernel=new float[windowsize+1];
-		for(int i=0;i<=windowsize;i++)
-			kernel[i]=gaussian(amount, i);
-
-		int newimw=img->Width, newimh=img->Height;
-		int bpp=GetBPP();
-
-		for(int y=0;y<newimh;y++) {
-			for(int x=0;x<newimw;x++) {
-				float sum=0, sum_weights=0;
-				for(int yy=-windowsize;yy<=windowsize;yy++) {
-					for(int xx=-windowsize;xx<=windowsize;xx++) {
-						int oldcoordx=x+xx-windowsize, oldcoordy=y+yy-windowsize;
-
-						if(oldcoordx>=0 && oldcoordy>=0 && oldcoordx<Width && oldcoordy<Height) {
-							sum+=kernel[abs(xx)]*kernel[abs(yy)]*Data[ oldcoordx+oldcoordy*Width ];
-						}
-						sum_weights+=kernel[abs(xx)]*kernel[abs(yy)];
-					}
-				}
-
-				img->Data[ (x+y*img->Width) ]=(int)Round(sum/sum_weights);
-			}
-		}
-
-		delete[] kernel;
-	}
-
-
-	NullImage *NullImage::ni;
-} }
--- a/Resource/ImageResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "../Engine/Graphics.h"
-#include "ResizableObject.h"
-#include "../Engine/Animation.h"
-#include "../Engine/Image.h"
-
-#pragma warning(push)
-#pragma warning(disable:4250)
-
-namespace gge { namespace resource {
-	class File;
-	class ImageResource;
-
-	////This function loads a text resource from the given file
-	ImageResource *LoadImageResource(File& File, std::istream &Data, int Size);
-
-	////This is image resource that holds information about a single image. It supports
-	/// two color modes (ARGB and AL); lzma and jpg compressions
-	class ImageResource : 
-		public ResourceBase, virtual public ResizableObject, virtual public ResizableObjectProvider, 
-		virtual public animation::RectangularGraphic2DSequenceProvider, virtual public graphics::ImageTexture,
-		public graphics::ImageData, virtual public animation::RectangularGraphic2DAnimation
-	{
-		friend ImageResource *LoadImageResource(File &File, std::istream &Data, int Size);
-	public:
-		enum PNGReadError {
-			NoError=0,
-			Signature=1,
-			ErrorHandlerProblem=2,
-			OutofMemory=4, 
-			UnimplementedType,
-			FileNotFound
-		};
-
-		////Not used, if paletted image is found, this holds its palette
-		Byte *Palette;
-		////Whether image is loaded or not. Image that are marked as late loading
-		/// are not loaded in initial load request. Image data can be retrieved by
-		/// calling Load function.
-		bool isLoaded;
-		////Whether to leave the data after this image resource is transformed into
-		/// an image object. This flag is used by other systems.
-		bool LeaveData;
-
-		ImageResource() : animation::AnimationBase(), ImageTexture(), ImageData() {
-			isLoaded=LeaveData=false; Palette=NULL; 
-			animation::Animations.Remove(this);
-		}
-
-		ImageResource(int Width, int Height, graphics::ColorMode::Type Mode=graphics::ColorMode::ARGB) : animation::AnimationBase(), ImageTexture(), ImageData() {
-			this->Resize(Width, Height, Mode);
-			animation::Animations.Remove(this);
-		}
-
-		bool PNGExport(string filename);
-		
-		////02020000h (Basic, Image)
-		virtual GID::Type getGID() const { return GID::Image; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-		////Loads image data from the file. This function is required for late
-		/// loading.
-		bool Load(bool force=false);
-
-		virtual void Prepare(GGEMain &main, File &file);
-
-		PNGReadError ImportPNG(string filename);
-
-		////Returns Bytes/Pixel information
-		int GetBPP() { return graphics::getBPP(Mode); }
-		graphics::ColorMode::Type GetMode() { return Mode; }
- 
-
-		////Destroys used data
-		void destroy() { Data.RemoveReference(); if(Palette) delete Palette; }
-
-		////Destroys used data
-		virtual ~ImageResource() { if(Palette) delete Palette; }
-
-		/* FOR ANIMATION INTERFACES */
-		virtual void DeleteAnimation() { } //if used as animation, it will not be deleted
-	//TODO ownership has issues in here
-		virtual ImageResource &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) { return *this; }
-		virtual ImageResource &CreateAnimation(bool create=false) { return *this; }
-
-		virtual ImageResource &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) { return *this; }
-		virtual ImageResource &CreateResizableObject(bool create=false) { return *this; }
-
-		virtual graphics::RectangularGraphic2D &GraphicAt(unsigned time) { return *this; }
-
-		virtual graphics::Image2D & ImageAt(int time) { return *this; }
-
-		virtual int GetDuration() const	{ return 1; }
-		virtual int GetDuration(unsigned Frame) const { return 1; }
-		virtual int GetNumberofFrames() const { return 1; }
-
-		//Caller is responsible to supply a time between 0 and GetDuration()-1, if no frame exists it should return -1
-		virtual int		 FrameAt(unsigned Time) const { return 0; }
-		//Should always return a time between 0 and GetDuration unless Frame does not exists it should return -1
-		virtual int		 StartOf(unsigned Frame) const { return 0; }
-		virtual	int		 EndOf(unsigned Frame) const { return 1; }
-		/* ... */
-
-		ImageResource &Blur(float amount, int windowsize=-1);
-		ImageResource &Shadow(float amount, int windowsize=-1);
-
-		virtual int GetWidth() const {
-			if(Texture.ID) {
-				return ImageTexture::GetWidth();
-			}
-			else {
-				return ImageData::GetWidth();
-			}
-		}
-
-		virtual int GetHeight() const {
-			if(Texture.ID) {
-				return ImageTexture::GetHeight();
-			}
-			else {
-				return ImageData::GetHeight();
-			}
-		}
-
-		using graphics::ImageTexture::drawin;
-
-	protected:
-		virtual animation::ProgressResult::Type Progress() { return animation::ProgressResult::None; };
-
-		////The file that this image resource is related, used for late loading
-		File *File;
-		////Compression properties read from file, used for late loading
-		Byte *CompressionProps;
-		////Compression mode, not suitable for saving, used for late loading
-		int Compression;
-		////Size of the image data within the file, used for late loading
-		int DataSize;
-		////Location of image data within the file, used for late loading
-		int DataLocation;
-
-		void blurargb(float amount, int windowsize, ImageResource *img);
-		void bluralpha(float amount, int windowsize, ImageResource *img);
-
-		void shadowargb(float amount, int windowsize, ImageResource *img);
-		void shadowalpha(float amount, int windowsize, ImageResource *img);
-	};
-} }
-
-#pragma warning(pop)
--- a/Resource/LinkNode.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/LinkNode.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,5 +1,5 @@
 #include "LinkNode.h"
-#include "ResourceFile.h"
+#include "File.h"
 
 using namespace gge;
 using namespace gge::utils;
@@ -7,15 +7,15 @@
 
 namespace gge { namespace resource {
 	void LinkNodeResource::Resolve(resource::File &file) {
-		ResourceBase *parent=File->Root().FindParent(guid);
+		Base *parent=File->Root().FindParent(guid);
 		File->Redirects.Add(new Redirect(this->guid, target));
 
 		if(parent) {
 
-			for(SortedCollection<ResourceBase>::Iterator item=parent->Subitems.First();
-				item.isValid(); item.Next()) {
+			for(SortedCollection<Base>::Iterator item=parent->Subitems.First();
+				item.IsValid(); item.Next()) {
 				if(item->isEqual(guid)) {
-					ResourceBase *t=file.Root().FindObject(target);
+					Base *t=file.Root().FindObject(target);
 					if(t) {
 						item.GetWrapper().SetItem(t);
 						break;
@@ -31,11 +31,11 @@
 		}
 	}
 
-	ResourceBase * LinkNodeResource::GetTarget(resource::File &file) {
+	Base * LinkNodeResource::GetTarget(resource::File &file) {
 		return file.Root().FindObject(target);
 	}
 
-	ResourceBase *LoadLinkNodeResource(File &File, istream &Data, int Size) {
+	Base *LoadLinkNodeResource(File &File, istream &Data, int Size) {
 		LinkNodeResource *link=new LinkNodeResource;
 
 		int target=Data.tellg()+Size;
--- a/Resource/LinkNode.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/LinkNode.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,12 +1,12 @@
 #pragma once
 
 
-#include "ResourceBase.h"
+#include "Base.h"
 
 
 namespace gge { namespace resource {
-	class LinkNodeResource : public ResourceBase {
-		friend ResourceBase *LoadLinkNodeResource(File &File, std::istream &Data, int Size);
+	class LinkNodeResource : public Base {
+		friend Base *LoadLinkNodeResource(File &File, std::istream &Data, int Size);
 	public:
 
 		LinkNodeResource() : target(nullptr) {  }
@@ -18,7 +18,7 @@
 
 		virtual void Resolve(File &file);
 
-		ResourceBase *GetTarget(resource::File &file);
+		Base *GetTarget(resource::File &file);
 
 	protected:
 		utils::SGuid target;
--- a/Resource/NullImage.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/NullImage.h	Tue Feb 28 09:58:13 2012 +0000
@@ -2,7 +2,7 @@
 
 
 #include "GRE.h"
-#include "ResourceBase.h"
+#include "Base.h"
 #include "../Engine/Graphics.h"
 #include "ResizableObject.h"
 #include "../Engine/Animation.h"
@@ -15,7 +15,7 @@
 namespace gge { namespace resource {
 
 	class NullImage : 
-		public ResourceBase, virtual public ResizableObject, public virtual graphics::ImageTexture, public ResizableObjectProvider, 
+		public Base, virtual public ResizableObject, public virtual graphics::ImageTexture, public ResizableObjectProvider, 
 		public animation::RectangularGraphic2DSequenceProvider, virtual public animation::RectangularGraphic2DAnimation
 	{
 		friend void Init(GGEMain &Main);
@@ -23,10 +23,10 @@
 
 		virtual GID::Type getGID() const { return GID::Image_NULL; }
 		virtual void DeleteAnimation() { } //if used as animation, it will not be deleted
-		virtual NullImage &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) { return *this; }
+		virtual NullImage &CreateAnimation(animation::Timer &controller, bool owner=false) { return *this; }
 		virtual NullImage &CreateAnimation(bool create=false) { return *this; }
 
-		virtual NullImage &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) { return *this; }
+		virtual NullImage &CreateResizableObject(animation::Timer &controller, bool owner=false) { return *this; }
 		virtual NullImage &CreateResizableObject(bool create=false) { return *this; }
 
 		virtual graphics::RectangularGraphic2D &GraphicAt(unsigned time) { return *this; }
@@ -48,7 +48,7 @@
 		}
 
 	protected:
-		NullImage() : animation::AnimationBase() {  }
+		NullImage() : animation::Base() {  }
 
 		static NullImage *ni;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Pointer.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,24 @@
+#include "Pointer.h"
+#include "File.h"
+
+namespace gge { namespace resource {
+
+	void Pointer::LoadExtra(File &File, std::istream &Data, GID::Type gid, int size) {
+		if(gid==GID::Pointer_Props) {
+			ReadFrom(Data, Hotspot);
+			Type=(gge::Pointer::PointerType)ReadFrom<int>(Data);
+		}
+		else {
+			EatChunk(Data,size);
+		}
+	}
+
+	Pointer *LoadPointerResource(File &File, std::istream &Data, int Size) {
+		Pointer *pointer=new Pointer;
+
+		LoadAnimationResourceEx(pointer, File, Data, Size);
+
+		return pointer;
+	}
+
+}}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Pointer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,32 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "../Engine/Animation.h"
+#include "Image.h"
+#include "../Resource/ResizableObject.h"
+#include "../Utils/Point2D.h"
+#include "Animation.h"
+#include "../Engine/Pointer.h"
+
+#pragma warning(push)
+#pragma warning(disable:4250)
+
+namespace gge { namespace resource {
+
+	class File;
+	class Pointer;
+
+	Pointer *LoadPointerResource(File &File, std::istream &Data, int Size);
+
+	class Pointer : public Animation {
+		friend Pointer *LoadPointerResource(File &File, std::istream &Data, int Size);
+	public:
+		utils::Point Hotspot;
+		gge::Pointer::PointerType Type;
+
+	protected:
+		virtual void LoadExtra(File &File, std::istream &Data, GID::Type gid, int size);
+	};
+
+}}
\ No newline at end of file
--- a/Resource/PointerResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#include "PointerResource.h"
-#include "ResourceFile.h"
-
-namespace gge { namespace resource {
-
-	void PointerResource::LoadExtra(File &File, std::istream &Data, GID::Type gid, int size) {
-		if(gid==GID::Pointer_Props) {
-			ReadFrom(Data, Hotspot);
-			Type=(Pointer::PointerType)ReadFrom<int>(Data);
-		}
-		else {
-			EatChunk(Data,size);
-		}
-	}
-
-	PointerResource *LoadPointerResource(File &File, std::istream &Data, int Size) {
-		PointerResource *pointer=new PointerResource;
-
-		LoadAnimationResourceEx(pointer, File, Data, Size);
-
-		return pointer;
-	}
-
-}}
\ No newline at end of file
--- a/Resource/PointerResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "../Engine/Animation.h"
-#include "ImageResource.h"
-#include "../Resource/ResizableObject.h"
-#include "../Utils/Point2D.h"
-#include "AnimationResource.h"
-#include "../Engine/Pointer.h"
-
-#pragma warning(push)
-#pragma warning(disable:4250)
-
-namespace gge { namespace resource {
-
-	class File;
-	class PointerResource;
-
-	PointerResource *LoadPointerResource(File &File, std::istream &Data, int Size);
-
-	class PointerResource : public AnimationResource {
-		friend PointerResource *LoadPointerResource(File &File, std::istream &Data, int Size);
-	public:
-		utils::Point Hotspot;
-		Pointer::PointerType Type;
-
-	protected:
-		virtual void LoadExtra(File &File, std::istream &Data, GID::Type gid, int size);
-	};
-
-}}
\ No newline at end of file
--- a/Resource/ResizableObject.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Resource/ResizableObject.h	Tue Feb 28 09:58:13 2012 +0000
@@ -7,15 +7,15 @@
 
 	class File;
 
-	class ResizableObject : public virtual graphics::SizelessGraphic2D, public virtual animation::AnimationBase  {
+	class ResizableObject : public virtual graphics::SizelessGraphic2D, public virtual animation::Base  {
 	public:
 
 		
 	};
 
-	class ResizableObjectProvider : virtual public animation::AnimationProvider {
+	class ResizableObjectProvider : virtual public animation::Provider {
 	public:
-		virtual ResizableObject &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) = 0;
+		virtual ResizableObject &CreateResizableObject(animation::Timer &controller, bool owner=false) = 0;
 		virtual ResizableObject &CreateResizableObject(bool create=false) = 0;
 	};
 
--- a/Resource/ResourceBase.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#include "ResourceBase.h"
-
-using namespace gge::utils;
-
-namespace gge { namespace resource {
-	void ResourceBase::Prepare(GGEMain &main, File &file) {
-		for(SortedCollection<ResourceBase>::Iterator resource=Subitems.First();
-			resource.isValid(); resource.Next()) {
-
-			resource->Prepare(main, file);
-		}
-	}
-
-	void ResourceBase::Resolve(File &file) {
-		for(SortedCollection<ResourceBase>::Iterator resource=Subitems.First();
-			resource.isValid();) {
-
-			ResourceBase &r=resource;
-			resource.Next();
-
-			r.Resolve(file);
-		}
-	}
-
-	ResourceBase *ResourceBase::FindObject(utils::SGuid guid) {
-		for(SortedCollection<ResourceBase>::Iterator resource=Subitems.First();
-			resource.isValid(); resource.Next()) {
-
-			if(resource->isEqual(guid))
-				return resource.CurrentPtr();
-
-			ResourceBase *temp=resource->FindObject(guid);
-			if(temp)
-				return temp;
-		}
-
-		return NULL;
-	}
-
-	ResourceBase *ResourceBase::FindParent(utils::SGuid guid) {
-		for(SortedCollection<ResourceBase>::Iterator resource=Subitems.First();
-			resource.isValid(); resource.Next()) {
-
-			if(resource->isEqual(guid))
-				return this;
-
-			ResourceBase *temp=resource->FindParent(guid);
-			if(temp)
-				return temp;
-		}
-
-		return NULL;
-	}
-
-	ResourceBase::ResourceBase() : guid(nullptr), name(""), caption("") { }
-
-	ResourceBase::~ResourceBase() {
-		Subitems.Destroy();
-	}
-
-} }
--- a/Resource/ResourceBase.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#pragma once
-
-#include "../Utils/Collection.h"
-#include "../Engine/GGEMain.h"
-#include "../Utils/SGuid.h"
-
-#include "GRE.h"
-#include "Definitions.h"
-
-#include <fstream>
-#include <iosfwd>
-
-using namespace gge;
-
-namespace gge { namespace resource {
-
-
-	////This class is the base for all Gorgon Resources
-	class ResourceBase {
-	public:
-		////This function shall return Gorgon ID of this resource
-		virtual GID::Type getGID() const = 0;
-		////This function shall prepare this resource to be used
-		/// after file is loaded, default behavior is to pass
-		/// the request to children
-		virtual void Prepare(GGEMain &main, File &file);
-		////This function shall resolve links or similar constructs
-		virtual void Resolve(File &file);
-
-		ResourceBase();
-		virtual ~ResourceBase();
-		
-		////This function shall save this resource to the given file
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-
-		////This function tests whether this object has the given utils::SGuid
-		bool isEqual(const utils::SGuid &guid) const { return guid==this->guid; }
-
-		////utils::SGuid to identify this resource object
-		utils::SGuid guid;
-		////Name of this resource object, may not be loaded.
-		string name;
-		////Caption of this resource object, may not be loaded.
-		string caption;
-
-		////Subitems that this resource object have. Some of the sub items
-		/// can be hidden therefore, this is not guaranteed to be complete
-		utils::SortedCollection<ResourceBase> Subitems;
-
-		////Searches the public children of this resource object
-		virtual ResourceBase *FindObject(utils::SGuid guid);
-
-		////Searches the public children of this resource object
-		virtual ResourceBase *FindParent(utils::SGuid guid);
-	};
-} }
--- a/Resource/ResourceFile.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-#include "ResourceFile.h"
-#include "TextResource.h"
-#include "ImageResource.h"
-#include "DataResource.h"
-#include "AnimationResource.h"
-#include "BitmapFontResource.h"
-#include "SoundResource.h"
-#include "FontTheme.h"
-#include "LinkNode.h"
-#include "FontTheme.h"
-#include "PointerResource.h"
-
-using namespace std;
-using namespace gge::utils;
-
-namespace gge { namespace resource {
-
-	void File::LoadFile(const string &Filename) {
-		CheckAndDelete(root);
-
-		char sgn[7];
-
-		this->Filename=Filename;
-
-		///*Check file existence
-
-		ifstream data;
-		data.open(Filename, ios::in | ios::binary);
-		if(data.fail())
-			throw load_error(load_error::FileNotFound, load_error::strings::FileNotFound);
-
-
-		///*Check file signature
-		data.read(sgn, 6);
-		sgn[6]=0;
-		if(string("GORGON")!=sgn)
-			throw load_error(load_error::Signature, load_error::strings::Signature);
-
-		///*Check file version
-		ReadFrom(data, FileVersion);
-		if(FileVersion>CurrentVersion)
-			throw load_error(load_error::VersionMismatch, load_error::strings::VersionMismatch);
-
-		///*Load file type
-		ReadFrom(data, FileType);
-
-		///*Check first element
-		if(ReadFrom<int>(data)!=GID::Folder)
-			throw load_error(load_error::Containment, load_error::strings::Containment);
-
-		int size;
-		ReadFrom(data, size);
-
-		///*Load first element
-		root=LoadFolderResource(*this, data, size,LoadNames);
-		if(!root)
-			throw load_error(load_error::Containment, load_error::strings::Containment);
-
-		root->Resolve(*this);
-
-		isloaded=true;
-
-		///*Close file
-		data.close();
-	}
-
-	ResourceBase *File::LoadObject(istream &Data, int GID, int Size) {
-		for(utils::Collection<ResourceLoader>::Iterator loader=Loaders.First();
-			loader.isValid(); loader.Next()) {
-
-			if(loader->GId==GID) {
-				return loader->Loader(*this, Data, Size);
-			}
-		}
-
-		EatChunk(Data,Size);
-		return NULL;
-	}
-
-	void File::AddBasicLoaders() {
-		Loaders.Add(new ResourceLoader(GID::Folder, std::bind(LoadFolderResource, placeholders::_1, placeholders::_2, placeholders::_3, false)));
-		Loaders.Add(new ResourceLoader(GID::LinkNode, LoadLinkNodeResource)); 
-		Loaders.Add(new ResourceLoader(GID::Text, LoadTextResource)); 
-		Loaders.Add(new ResourceLoader(GID::Image, LoadImageResource)); 
-		Loaders.Add(new ResourceLoader(GID::Data, LoadDataResource)); 
-	}
-
-	void File::AddExtendedLoaders() {
-		AddBasicLoaders();
-		Loaders.Add(new ResourceLoader(GID::Sound, LoadSoundResource)); 
-	}
-
-	void File::AddGameLoaders() {
-		AddExtendedLoaders();
-		Loaders.Add(new ResourceLoader(GID::Animation, LoadAnimationResource)); 
-		Loaders.Add(new ResourceLoader(GID::Pointer, LoadPointerResource)); 
-		Loaders.Add(new ResourceLoader(GID::Font, LoadBitmapFontResource)); 
-		Loaders.Add(new ResourceLoader(GID::FontTheme, LoadFontTheme)); 
-		Loaders.Add(new ResourceLoader(GID::FontTheme, LoadFontTheme)); 
-	}
-
-	ResourceBase * File::FindObject( utils::SGuid guid ) {
-		if(guid.isEmpty()) 
-			return NULL;
-
-		for(utils::Collection<Redirect>::Iterator i=Redirects.First();i.isValid();i.Next()) {
-			if(i->source==guid)
-				guid=i->target;
-		}
-
-		return root->FindObject(guid);
-	}
-
-	const string load_error::strings::FileNotFound		= "Cannot find the file specified";
-	const string load_error::strings::Signature			= "Signature mismatch";
-	const string load_error::strings::VersionMismatch	= "Version mismatch";
-	const string load_error::strings::Containment		= "The supplied file is does not contain any data or its representation is invalid.";
-
-} }
--- a/Resource/ResourceFile.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-#pragma once
-
-#include <stdexcept>
-#include <iostream>
-#include <fstream>
-#include <functional>
-
-#include "GRE.h"
-#include "../Utils/Collection.h"
-#include "Definitions.h"
-#include "FolderResource.h"
-
-namespace gge { namespace resource {
-
-	////This class defines a resource loader
-	class ResourceLoader {
-	public:
-		////This is Resource loader function prototype
-		typedef std::function<ResourceBase* (File&, std::istream&, int)> LoaderFunction;
-
-		////Gorgon ID of the resource
-		GID::Type GId;
-
-		////Load handler function
-		LoaderFunction Loader;
-
-		////Filling constructor
-		ResourceLoader(GID::Type gid, LoaderFunction loader) : GId(gid), Loader(loader) 
-		{ }
-	};
-
-	class Redirect {
-	public:
-		Redirect(utils::SGuid &source, utils::SGuid &target) : 
-		  source(source), target(target) { }
-
-		utils::SGuid source;
-		utils::SGuid target;
-	};
-
-	class load_error : public std::runtime_error {
-	public:
-
-		enum ErrorType {
-			FileNotFound	= 1,
-			Signature		= 2,
-			VersionMismatch	= 3,
-			Containment		= 4
-		};
-
-		class strings {
-		public:
-			static const string FileNotFound	;
-			static const string Signature		;
-			static const string VersionMismatch	;
-			static const string Containment		;
-		};
-
-
-		load_error(ErrorType number, const string &text) : runtime_error(text), number(number) {
-
-		}
-
-		load_error(ErrorType number, const char *text) : runtime_error(text), number(number) {
-
-		}
-
-		ErrorType number;
-	};
-
-	class File {
-	public:
-		File() : root(new FolderResource), LoadNames(false) {
-
-		}
-
-		////Resource Loaders
-		utils::Collection<ResourceLoader> Loaders;
-		utils::Collection<Redirect>		  Redirects;
-
-		////File type
-		GID::Type FileType;
-		////File version
-		int FileVersion;
-		bool LoadNames;
-		FolderResource &Root() { return *root; }
-		////Returns the filename used for the last load or save operation
-		string getFilename() const { return Filename; }
-
-		////Loads a given file throws load_error
-		///@Filename	: File to be loaded
-		void LoadFile(const string &Filename);
-
-		////Returns if a file is loaded
-		bool isLoaded() const { return isloaded; }
-
-		////Loads a resource object from the given file, GID and size
-		ResourceBase *LoadObject(std::istream &Data, int GID, int Size);
-
-		////Searches the given resource object within this file
-		ResourceBase *FindObject(utils::SGuid guid);
-
-		template<class T_>
-		void FindObject(utils::SGuid guid, T_ *&object) {
-			object=dynamic_cast<T_*>(FindObject(guid));
-		}
-		
-		////Adds basic resource loaders 
-		void AddBasicLoaders();
-
-		////Adds extended resource loaders
-		void AddExtendedLoaders();
-
-		////Adds game resource loaders
-		void AddGameLoaders();
-
-		void Prepare(GGEMain &main) { root->Prepare(main, *this); }
-		void Prepare(GGEMain *main) { root->Prepare(*main, *this); }
-		void Prepare() { root->Prepare(Main, *this); }
-
-	protected:
-		////The root folder, root changes while loading a file
-		FolderResource *root;
-
-	private:
-		bool isloaded;
-		string Filename;
-	};
-
-	inline void EatChunk(std::istream &file, std::streamoff Size) { file.seekg(Size, std::ios::cur); }
-
-	template<int B_, class T_>
-	inline void ReadFrom(std::istream &Data, T_ &object) {
-		Data.read(reinterpret_cast<char*>(&object), B_);
-	}
-
-	template<class T_>
-	inline void ReadFrom(std::istream &Data, T_ &object) {
-		Data.read(reinterpret_cast<char*>(&object), sizeof(object));
-	}
-
-	template<>
-	inline void ReadFrom<std::string>(std::istream &Data, std::string &object) {
-		int temp;
-		ReadFrom(Data, temp);
-		char *text=new char[temp];
-		Data.read(text, temp);
-		object.assign(text,temp);
-	}
-
-	template<class T_>
-	inline T_ ReadFrom(std::istream &Data) {
-		T_ object;
-		Data.read(reinterpret_cast<char*>(&object), sizeof(object));
-
-		return object;
-	}
-} }
-
-inline int operator +(const std::streampos &l, int r) {
-	return (int)l + r;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Sound.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,84 @@
+#include "Sound.h"
+#include "File.h"
+#include "../External/LZMA/LzmaDecode.h"
+#include "../Engine/Sound.h"
+
+using namespace std;
+using namespace gge::sound;
+using namespace gge::sound::system;
+
+namespace gge { namespace resource {
+	Sound *LoadSoundResource(File &File, istream &Data, int Size) {
+		Sound *snd=new Sound;
+
+		int target=Data.tellg()+Size;
+		int buffersize;
+		Byte *compressionprops=NULL;
+
+		while(Data.tellg()<target) {
+			int gid,size,compression=0;
+			ReadFrom(Data, gid);
+			ReadFrom(Data, size);
+
+			if(gid==GID::Sound_Props) {
+				ReadFrom(Data, buffersize);
+				ReadFrom(Data, snd->Format.Channels);
+				ReadFrom(Data, snd->Format.BlockAlign);
+				ReadFrom(Data, snd->Format.BitsPerSample);
+				ReadFrom(Data, snd->Format.SamplesPerSec);
+				ReadFrom(Data, snd->Format.AvgBytesPerSec);
+				ReadFrom(Data, snd->Format.FormatTag);
+
+				snd->Format.Size=sizeof(snd->Format);
+
+				if(size>20)
+					Data.seekg(size-20,ios::cur);
+			} 
+			else if(gid==GID::Guid) {
+				snd->guid.LoadLong(Data);
+			}
+			else if(gid==GID::SGuid) {
+				snd->guid.Load(Data);
+			}
+			else if(gid==GID::Sound_Wave) {
+				snd->Size=size;
+				snd->Data=new Byte[size];
+
+				Data.read((char*)snd->Data, size);
+			} else if(gid==GID::Sound_Cmp_Props) {
+				ReadFrom(Data, compression);
+
+				if(compression==GID::LZMA) {
+					compressionprops=new Byte[LZMA_PROPERTIES_SIZE];
+					Data.read((char*)compressionprops,LZMA_PROPERTIES_SIZE);
+				}
+			} else if(gid==GID::Sound_Cmp_Wave) {
+				snd->Data=new Byte[buffersize];
+				snd->Size=buffersize;
+				Byte *tmpdata=new Byte[size];
+
+				Data.read((char*)tmpdata, size);
+				
+				size_t processed,processed2;
+				CLzmaDecoderState state;
+				LzmaDecodeProperties(&state.Properties,compressionprops,LZMA_PROPERTIES_SIZE);
+				state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
+
+				LzmaDecode(&state,tmpdata,size,&processed,snd->Data,buffersize,&processed2);
+
+				delete[] tmpdata;
+				free(state.Probs);
+
+				if(compressionprops)
+					delete[] compressionprops;
+			}
+		}
+
+		return snd;
+	}
+
+	void Sound::Prepare( GGEMain &main, File &file ) {
+		Buffer=sound::system::CreateSoundBuffer(Format, Data, Size);
+	}
+
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Sound.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+#include "../Engine/Sound.h"
+#include "../Engine/Wave.h"
+
+namespace gge { namespace resource {
+	class File;
+	class Sound;
+	
+	////This function loads a sound resource from the given file
+	Sound *LoadSoundResource(File &File, std::istream &Data, int Size);
+
+	////This is sound resource. It may contain 22kHz or 44kHz mono or stereo wave files.
+	/// Also supports LZMA compression. No native sound compression is supported.
+	class Sound : public Base {
+		friend Sound *LoadSoundResource(File &File, std::istream &Data, int Size);
+	public:
+		////04010000h (Extended, Sound)
+		virtual GID::Type getGID() const { return GID::Sound; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+
+		////Wave data
+		Byte *Data;
+		////Format
+		gge::sound::system::WaveFormat Format;
+		////Size of the data
+		int Size;
+
+		Sound() { Buffer=NULL; Data=NULL; Size=0; Format.BitsPerSample=Format.Channels=0; }
+
+		operator gge::sound::system::SoundBufferHandle() {
+			return Buffer;
+		}
+
+		////Destroys used data
+		void destroy() { if(Data) delete Data; }
+		////Destroys used data
+		virtual ~Sound() { destroy(); Base::~Base(); }
+
+		////When this file is prepared to be used, this value will be used to store sound buffer
+		gge::sound::system::SoundBufferHandle Buffer;
+
+		gge::sound::Wave *CreateWave() { return new gge::sound::Wave(Buffer); }
+
+		gge::sound::Wave *Create3DWave(float maxWaveDistance) { return new gge::sound::Wave(Buffer,	maxWaveDistance); }
+
+		virtual void Prepare(GGEMain &main, File &file);
+	};
+} }
--- a/Resource/SoundResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#include "SoundResource.h"
-#include "ResourceFile.h"
-#include "../External/LZMA/LzmaDecode.h"
-#include "../Engine/Sound.h"
-
-using namespace std;
-using namespace gge::sound;
-using namespace gge::sound::system;
-
-namespace gge { namespace resource {
-	ResourceBase *LoadSoundResource(File &File, istream &Data, int Size) {
-		SoundResource *snd=new SoundResource;
-
-		int target=Data.tellg()+Size;
-		int buffersize;
-		Byte *compressionprops=NULL;
-
-		while(Data.tellg()<target) {
-			int gid,size,compression=0;
-			ReadFrom(Data, gid);
-			ReadFrom(Data, size);
-
-			if(gid==GID::Sound_Props) {
-				ReadFrom(Data, buffersize);
-				ReadFrom(Data, snd->Format.Channels);
-				ReadFrom(Data, snd->Format.BlockAlign);
-				ReadFrom(Data, snd->Format.BitsPerSample);
-				ReadFrom(Data, snd->Format.SamplesPerSec);
-				ReadFrom(Data, snd->Format.AvgBytesPerSec);
-				ReadFrom(Data, snd->Format.FormatTag);
-
-				snd->Format.Size=sizeof(snd->Format);
-
-				if(size>20)
-					Data.seekg(size-20,ios::cur);
-			} 
-			else if(gid==GID::Guid) {
-				snd->guid.LoadLong(Data);
-			}
-			else if(gid==GID::SGuid) {
-				snd->guid.Load(Data);
-			}
-			else if(gid==GID::Sound_Wave) {
-				snd->Size=size;
-				snd->Data=new Byte[size];
-
-				Data.read((char*)snd->Data, size);
-			} else if(gid==GID::Sound_Cmp_Props) {
-				ReadFrom(Data, compression);
-
-				if(compression==GID::LZMA) {
-					compressionprops=new Byte[LZMA_PROPERTIES_SIZE];
-					Data.read((char*)compressionprops,LZMA_PROPERTIES_SIZE);
-				}
-			} else if(gid==GID::Sound_Cmp_Wave) {
-				snd->Data=new Byte[buffersize];
-				snd->Size=buffersize;
-				Byte *tmpdata=new Byte[size];
-
-				Data.read((char*)tmpdata, size);
-				
-				size_t processed,processed2;
-				CLzmaDecoderState state;
-				LzmaDecodeProperties(&state.Properties,compressionprops,LZMA_PROPERTIES_SIZE);
-				state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb));
-
-				LzmaDecode(&state,tmpdata,size,&processed,snd->Data,buffersize,&processed2);
-
-				delete[] tmpdata;
-				free(state.Probs);
-
-				if(compressionprops)
-					delete[] compressionprops;
-			}
-		}
-
-		return snd;
-	}
-
-	void SoundResource::Prepare( GGEMain &main, File &file ) {
-		Buffer=sound::system::CreateSoundBuffer(Format, Data, Size);
-	}
-
-} }
--- a/Resource/SoundResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-#include "../Engine/Sound.h"
-#include "../Engine/Wave.h"
-
-namespace gge { namespace resource {
-	class File;
-	
-	////This function loads a sound resource from the given file
-	ResourceBase *LoadSoundResource(File &File, std::istream &Data, int Size);
-
-	////This is sound resource. It may contain 22kHz or 44kHz mono or stereo wave files.
-	/// Also supports LZMA compression. No native sound compression is supported.
-	class SoundResource : public ResourceBase {
-		friend ResourceBase *LoadSoundResource(File &File, std::istream &Data, int Size);
-	public:
-		////04010000h (Extended, Sound)
-		virtual GID::Type getGID() const { return GID::Sound; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-
-		////Wave data
-		Byte *Data;
-		////Format
-		gge::sound::system::WaveFormat Format;
-		////Size of the data
-		int Size;
-
-		SoundResource() { Buffer=NULL; Data=NULL; Size=0; Format.BitsPerSample=Format.Channels=0; }
-
-		operator gge::sound::system::SoundBufferHandle() {
-			return Buffer;
-		}
-
-		////Destroys used data
-		void destroy() { if(Data) delete Data; }
-		////Destroys used data
-		virtual ~SoundResource() { destroy(); ResourceBase::~ResourceBase(); }
-
-		////When this file is prepared to be used, this value will be used to store sound buffer
-		gge::sound::system::SoundBufferHandle Buffer;
-
-		gge::sound::Wave *CreateWave() { return new gge::sound::Wave(Buffer); }
-
-		gge::sound::Wave *Create3DWave(float maxWaveDistance) { return new gge::sound::Wave(Buffer,	maxWaveDistance); }
-
-		virtual void Prepare(GGEMain &main, File &file);
-	};
-} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Text.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,19 @@
+#include "Text.h"
+#include "File.h"
+
+using namespace std;
+
+namespace gge { namespace resource {
+	Text *LoadTextResource(File &File, istream &Data, int Size) {
+		char *tmpstr=new char[Size+1];
+
+		Data.read(tmpstr,Size);
+		Text* txt=new Text();
+		tmpstr[Size]=0;
+		txt->Value=tmpstr;
+
+		delete tmpstr;
+
+		return txt;
+	}
+} }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource/Text.h	Tue Feb 28 09:58:13 2012 +0000
@@ -0,0 +1,27 @@
+#pragma once
+
+#include "GRE.h"
+#include "Base.h"
+
+namespace gge { namespace resource {
+	class File;
+	class Text;
+	
+	////This function loads a text resource from the given file
+	Text *LoadTextResource(File &File, std::istream &Data, int Size);
+
+	////This is basic text resource, it holds a simple string. This resource is mostly useless
+	/// because of data array resource. Also it does not employ any GUID mechanism.
+	/// Still it can be used to hold a long text which is not related with other data.
+	class Text : public Base {
+		friend Text *LoadTextResource(File &File, std::istream &Data, int Size);
+	public:
+		////The text contained within this resource
+		string Value;
+		
+		////02010000h (Basic, Text)
+		virtual GID::Type getGID() const { return GID::Text; }
+		////Currently does nothing
+		virtual bool Save(File &File, std::ostream &Data) { return false; }
+	};
+} }
\ No newline at end of file
--- a/Resource/TextResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#include "TextResource.h"
-#include "ResourceFile.h"
-
-using namespace std;
-
-namespace gge { namespace resource {
-	ResourceBase *LoadTextResource(File &File, istream &Data, int Size) {
-		char *tmpstr=new char[Size+1];
-
-		Data.read(tmpstr,Size);
-		TextResource* txt=new TextResource();
-		tmpstr[Size]=0;
-		txt->Text=tmpstr;
-
-		delete tmpstr;
-
-		return txt;
-	}
-} }
--- a/Resource/TextResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#pragma once
-
-#include "GRE.h"
-#include "ResourceBase.h"
-
-namespace gge { namespace resource {
-	class File;
-	
-	////This function loads a text resource from the given file
-	ResourceBase *LoadTextResource(File &File, std::istream &Data, int Size);
-
-	////This is basic text resource, it holds a simple string. This resource is mostly useless
-	/// because of data array resource. Also it does not employ any GUID mechanism.
-	/// Still it can be used to hold a long text which is not related with other data.
-	class TextResource : public ResourceBase {
-		friend ResourceBase *LoadTextResource(File &File, std::istream &Data, int Size);
-	public:
-		////The text contained within this resource
-		string Text;
-		
-		////02010000h (Basic, Text)
-		virtual GID::Type getGID() const { return GID::Text; }
-		////Currently does nothing
-		virtual bool Save(File &File, std::ostream &Data) { return false; }
-	};
-} }
\ No newline at end of file
--- a/Utils/ConsumableEvent.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Utils/ConsumableEvent.h	Tue Feb 28 09:58:13 2012 +0000
@@ -807,7 +807,7 @@
 		////Unregisters the given event handler using handler function
 		template<class F_>
 		Token Find(F_ handler) {
-			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.isValid(); it.Next()) {
+			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.IsValid(); it.Next()) {
 				if(Compare(&(*it), handler)) {
 
 					return reinterpret_cast<Token> (object);
@@ -818,7 +818,7 @@
 		////Unregisters the given handler referenced by the object and function
 		template<class R_, class F_>
 		Token Find(R_ *obj, F_ handler) {
-			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.isValid(); it.Next()) {
+			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.IsValid(); it.Next()) {
 				if(Compare(&(*it), obj, handler)) {
 
 					return reinterpret_cast<Token> (object);
@@ -829,7 +829,7 @@
 		////Unregisters the given event handler using handler function
 		template<class F_>
 		void Unregister(F_ handler) {
-			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.isValid(); it.Next()) {
+			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.IsValid(); it.Next()) {
 				if(Compare(&(*it), handler)) {
 					Unregister(reinterpret_cast<Token>(&it.GetWrapper()));
 					return;
@@ -840,7 +840,7 @@
 		////Unregisters the given handler referenced by the object and function
 		template<class R_, class F_>
 		void Unregister(R_ *obj, F_ handler) {
-			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.isValid(); it.Next()) {
+			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.IsValid(); it.Next()) {
 				if(Compare(&(*it),obj, handler)) {
 					Unregister(reinterpret_cast<Token>(&it.GetWrapper()));
 					return;
@@ -856,7 +856,7 @@
 		////Unregisters the given handler referenced by the object and function
 		template<class R_, class F_>
 		void UnregisterClass(R_ *obj, F_ handler) {
-			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.isValid(); it.Next()) {
+			for(SortedCollection<HANDLER_,int>::Iterator it=events.First(); it.IsValid(); it.Next()) {
 				if(Compare(&(*it), obj, handler)) {
 					Unregister(reinterpret_cast<Token>(&it.GetWrapper()));
 					return;
@@ -960,7 +960,7 @@
 		////This function triggers the event causing all 
 		/// handlers to be called
 		Token Fire(P_ params) {
-			for(SortedCollection<HANDLER_, int>::Iterator it=events.First();it.isValid();it.Next()) {
+			for(SortedCollection<HANDLER_, int>::Iterator it=events.First();it.IsValid();it.Next()) {
 				if(it->enabled)
 					if(it->Fire(params, *this->object, eventname))
 						return reinterpret_cast<Token>(&it.GetWrapper());
--- a/Utils/EventChain.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Utils/EventChain.h	Tue Feb 28 09:58:13 2012 +0000
@@ -742,7 +742,7 @@
 		template<class F_>
 		void Unregister(F_ handler) {
 			for(Collection<prvt::eventchain::EventHandler<P_, O_>, 5>::Iterator it = events.First();
-				it.isValid();it.Next()) {
+				it.IsValid();it.Next()) {
 				if(prvt::eventchain::Compare(&(*it), handler)) {
 					it.Delete();
 				}
@@ -753,7 +753,7 @@
 		template<class R_, class F_>
 		void Unregister(R_ *obj, F_ handler) {
 			for(Collection<prvt::eventchain::EventHandler<P_, O_>, 5>::Iterator it = events.First();
-				it.isValid();it.Next()) {
+				it.IsValid();it.Next()) {
 					if(prvt::eventchain::Compare<R_, P_, O_>(&(*it), obj, handler)) {
 						it.Delete();
 					}
@@ -798,7 +798,7 @@
 		/// handlers to be called
 		void Fire(P_ params) {
 			for(Collection<prvt::eventchain::EventHandler<P_, O_>, 5>::Iterator it = events.First();
-				it.isValid();it.Next()) {
+				it.IsValid();it.Next()) {
 				it->Fire(params, *this->object, eventname);
 			}
 		}
@@ -858,7 +858,7 @@
 		template<class R_>
 		void linkedfire(P_ params) {
 			for(Collection<prvt::eventchain::EventHandler<P_, O_>, 5>::Iterator it = events.First();
-				it.isValid();it.Next()) {
+				it.IsValid();it.Next()) {
 				if(!checklinkedfire<R_>(it.CurrentPtr()))
 					it->Fire(params, *this->object, eventname);
 			}
--- a/Utils/Iterator.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Utils/Iterator.h	Tue Feb 28 09:58:13 2012 +0000
@@ -107,12 +107,12 @@
 		}
 
 		////Checks if the iterator is pointing to a valid item
-		bool isValid() const {
+		bool IsValid() const {
 			return iterator().isvalid();
 		}
 		
 		operator bool() const {
-			return isValid();
+			return IsValid();
 		}
 
 		////Compares two iterators if they point to the same item
--- a/Widgets/Base/Blueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Base/Blueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -2,7 +2,7 @@
 
 
 #include "..\..\Engine\Pointer.h"
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 
 
 namespace gge { namespace widgets {
--- a/Widgets/Base/Container.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Base/Container.h	Tue Feb 28 09:58:13 2012 +0000
@@ -68,7 +68,7 @@
 		virtual void Enable() { 
 			if(!IsEnabled()) {
 				isenabled=true;
-				for(auto it=Widgets.First();it.isValid();it.Next()) {
+				for(auto it=Widgets.First();it.IsValid();it.Next()) {
 					call_widget_containerenabledchanged(*it, true);
 				}
 			} 
@@ -76,7 +76,7 @@
 		virtual void Disable() { 
 			if(IsEnabled()) {
 				isenabled=false;
-				for(auto it=Widgets.First();it.isValid();it.Next()) {
+				for(auto it=Widgets.First();it.IsValid();it.Next()) {
 					call_widget_containerenabledchanged(*it, false);
 				}
 			} 
@@ -125,7 +125,7 @@
 			if(!isvisible || !isenabled)
 				return false;
 
-			for(auto it=Widgets.First();it.isValid();it.Next()) {
+			for(auto it=Widgets.First();it.IsValid();it.Next()) {
 				if(it->isvisible && it->isenabled) {
 					if(it->Focus())
 						return true;
@@ -138,7 +138,7 @@
 			if(!isvisible || !isenabled)
 				return false;
 
-			for(auto it=Widgets.Find(Focused)+1;it.isValid();it.Next()) {
+			for(auto it=Widgets.Find(Focused)+1;it.IsValid();it.Next()) {
 				if(it->isvisible && it->isenabled) {
 					if(it->Focus())
 						return true;
@@ -146,7 +146,7 @@
 			}
 
 			//roll again from bottom
-			for(auto it=Widgets.First();it.isValid() && it.CurrentPtr()!=Focused;it.Next()) {
+			for(auto it=Widgets.First();it.IsValid() && it.CurrentPtr()!=Focused;it.Next()) {
 				if(it->isvisible && it->isenabled) {
 					if(it->Focus())
 						return true;
@@ -159,7 +159,7 @@
 			if(!isvisible || !isenabled)
 				return false;
 
-			for(auto it=Widgets.Find(Focused)-1;it.isValid();it.Previous()) {
+			for(auto it=Widgets.Find(Focused)-1;it.IsValid();it.Previous()) {
 				if(it->isvisible && it->isenabled) {
 					if(it->Focus())
 						return true;
@@ -167,7 +167,7 @@
 			}
 
 			//roll again from bottom
-			for(auto it=Widgets.Last();it.isValid() && &(*it)!=Focused;it.Previous()) {
+			for(auto it=Widgets.Last();it.IsValid() && &(*it)!=Focused;it.Previous()) {
 				if(it->isvisible && it->isenabled) {
 					if(it->Focus())
 						return true;
@@ -245,7 +245,7 @@
 		//given widget simply does not exists
 		virtual bool RemoveWidget(WidgetBase &widget) {
 			auto it=Widgets.Find(widget);
-			if(!it.isValid())
+			if(!it.IsValid())
 				return false;
 
 			if(!call_widget_detach(widget))
@@ -289,7 +289,7 @@
 			if(!IsVisible())
 				return;
 
-			for(auto it=Widgets.Last();it.isValid();it.Previous()) {
+			for(auto it=Widgets.Last();it.IsValid();it.Previous()) {
 				if(it->IsVisible())
 					it->Draw();
 			}
@@ -384,7 +384,7 @@
 
 
 		virtual ~ContainerBase() {
-			for(auto it=Widgets.First();it.isValid();it.Next()) {
+			for(auto it=Widgets.First();it.IsValid();it.Next()) {
 				if(it->BoundToContainer)
 					it.Delete();
 			}
@@ -466,7 +466,7 @@
 				return false;
 
 			auto it=Widgets.Find(widget);
-			if(!it.isValid())
+			if(!it.IsValid())
 				return false;
 		
 			if(!focus_changing(widget))
--- a/Widgets/Base/Widget.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Base/Widget.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -115,7 +115,7 @@
 		BoundsChanged();
 	}
 
-	void WidgetBase::playsound(resource::SoundResource *snd) {
+	void WidgetBase::playsound(resource::Sound *snd) {
 		int x=location.x+size.Width/2;
 		int y=location.y+size.Height/2;
 		if(Container) {
--- a/Widgets/Base/Widget.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Base/Widget.h	Tue Feb 28 09:58:13 2012 +0000
@@ -7,7 +7,7 @@
 #include "..\..\Utils\Size2D.h"
 #include "../../Engine/Pointer.h"
 #include "../Basic/WidgetLayer.h"
-#include "../../Resource/SoundResource.h"
+#include "../../Resource/Sound.h"
 
 
 namespace gge { namespace widgets {
@@ -275,7 +275,7 @@
 
 	protected:
 		
-		void playsound(resource::SoundResource *snd);
+		void playsound(resource::Sound *snd);
 
 		virtual void draw()=0;
 
--- a/Widgets/Basic/BorderData.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/BorderData.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -2,10 +2,10 @@
 
 #include "Line.h"
 #include "Rectangle.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Engine\Animation.h"
-#include "..\..\Resource\AnimationResource.h"
-#include "..\..\Resource\ImageResource.h"
+#include "..\..\Resource\Animation.h"
+#include "..\..\Resource\Image.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Utils\SGuid.h"
 #include "ResizableObjectResource.h"
@@ -42,7 +42,7 @@
 				bdr->AutoBorderWidth = ReadFrom<int>(Data)!=0;
 			}
 			else {
-				ResourceBase *rb=LoadResizableObjectResource(File, Data, size);
+				resource::Base *rb=LoadResizableObjectResource(File, Data, size);
 
 				if(rb)
 					bdr->Subitems.Add(rb);
@@ -53,7 +53,7 @@
 	}
 
 	void BorderDataResource::Prepare(GGEMain &main, resource::File &file) {
-		ResourceBase::Prepare(main, file);
+		Base::Prepare(main, file);
 
 		ResizableObjectResource *ror= dynamic_cast<ResizableObjectResource *>(file.Root().FindObject(target));
 
--- a/Widgets/Basic/BorderData.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/BorderData.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,10 +1,10 @@
 #pragma once
 
 
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Definitions.h"
 #include "..\..\Resource\ResizableObject.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Engine\Animation.h"
 #include "..\..\Utils\Margins.h"
@@ -68,8 +68,8 @@
 			object->DeleteAnimation();
 		}
 
-		virtual void SetController( animation::AnimationTimer &controller, bool owner=false ) {
-			AnimationBase::SetController(controller, owner);
+		virtual void SetController( animation::Timer &controller, bool owner=false ) {
+			Base::SetController(controller, owner);
 			object->SetController(controller);
 		}
 
@@ -97,14 +97,14 @@
 		{ return object->CalculateHeight(controller, h); }
 	};
 
-	class BorderDataResource : public resource::ResourceBase, virtual public resource::ResizableObjectProvider {
+	class BorderDataResource : public resource::Base, virtual public resource::ResizableObjectProvider {
 		friend BorderDataResource *LoadBorderDataResource(resource::File& File, std::istream &Data, int Size);
 	public:
 
 		BorderDataResource(ResizableObjectResource &object) : object(&object), Margins(0), Padding(0), BorderWidth(0), AutoBorderWidth(true) 
 		{ }
 
-		virtual BorderData &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) { 
+		virtual BorderData &CreateResizableObject(animation::Timer &controller, bool owner=false) { 
 			BorderData *bd=new BorderData(object->CreateResizableObject(controller, owner), AutoBorderWidth);
 			if(!AutoBorderWidth)
 				bd->BorderWidth=BorderWidth;
@@ -125,7 +125,7 @@
 		}
 
 
-		virtual BorderData &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) 
+		virtual BorderData &CreateAnimation(animation::Timer &controller, bool owner=false) 
 		{ return CreateResizableObject(controller, owner); }
 
 		virtual BorderData &CreateAnimation(bool create=false)
--- a/Widgets/Basic/Line.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Line.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,8 +1,8 @@
 
 #include "Line.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Engine\Animation.h"
-#include "..\..\Resource\AnimationResource.h"
+#include "..\..\Resource\Animation.h"
 #include "..\..\Resource\NullImage.h"
 #include <vector>
 #include "..\..\Utils\SGuid.h"
@@ -16,7 +16,7 @@
 namespace gge { namespace widgets {
 
 	namespace lineresource_prvt {
-		void setlineprovider(vector<AnimationResource *> &anims, RectangularGraphic2DSequenceProvider *&obj, int id) {
+		void setlineprovider(vector<Animation *> &anims, RectangularGraphic2DSequenceProvider *&obj, int id) {
 			if((int)anims.size()<=id) {
 				obj=&NullImage::Get();
 			}
@@ -38,7 +38,7 @@
 	LineResource *LoadLineResource(resource::File& File, std::istream &Data, int Size) {
 		LineResource *line;
 		SGuid g;
-		vector<AnimationResource *> anims;
+		vector<Animation *> anims;
 		RectangularGraphic2DSequenceProvider *start=NULL, *loop=NULL, *end=NULL;
 		bool istiled=true;
 		LineResource::OrientationType orientation=LineResource::Horizontal;
--- a/Widgets/Basic/Line.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Line.h	Tue Feb 28 09:58:13 2012 +0000
@@ -5,10 +5,10 @@
 // and center part can either be tiled or scaled.
 // 
 
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Definitions.h"
 #include "..\..\Resource\ResizableObject.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Engine\Animation.h"
 #include "..\..\Utils\Margins.h"
@@ -23,7 +23,7 @@
 
 	class Line : public resource::ResizableObject {
 	public:
-		Line(LineResource &parent, animation::AnimationTimer &controller, bool owner=false);
+		Line(LineResource &parent, animation::Timer &controller, bool owner=false);
 		Line(LineResource &parent, bool create=false);
 
 		LineResource &parent;
@@ -36,8 +36,8 @@
 			end->DeleteAnimation();
 		}
 
-		virtual void SetController( animation::AnimationTimer &controller, bool owner=false ) {
-			AnimationBase::SetController(controller, owner);
+		virtual void SetController( animation::Timer &controller, bool owner=false ) {
+			Base::SetController(controller, owner);
 			start->SetController(controller);
 			loop->SetController(controller);
 			end->SetController(controller);
@@ -62,7 +62,7 @@
 
 	class MaskedLine : public Line {
 	public:
-		MaskedLine(LineResource &parent, animation::AnimationTimer &controller, LineResource *mask, bool owner=false);
+		MaskedLine(LineResource &parent, animation::Timer &controller, LineResource *mask, bool owner=false);
 		MaskedLine(LineResource &parent, LineResource *mask, bool create=false);
 
 		virtual ~MaskedLine() {
@@ -78,8 +78,8 @@
 	};
 
 
-	class LineResource : public resource::ResourceBase, virtual public resource::ResizableObjectProvider, 
-		virtual public animation::DiscreteAnimationProvider 
+	class LineResource : public resource::Base, virtual public resource::ResizableObjectProvider, 
+		virtual public animation::DiscreteProvider 
 	{
 		friend LineResource *LoadLineResource(resource::File& File, std::istream &Data, int Size);
 	public:
@@ -97,10 +97,10 @@
 
 		virtual GID::Type getGID() const { return GID::Line; }
 
-		virtual Line &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) { return CreateResizableObject(controller,owner); }
+		virtual Line &CreateAnimation(animation::Timer &controller, bool owner=false) { return CreateResizableObject(controller,owner); }
 		virtual Line &CreateAnimation(bool create=false) { return CreateResizableObject(create); }
 
-		virtual Line &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) {
+		virtual Line &CreateResizableObject(animation::Timer &controller, bool owner=false) {
 			if(Mask==NULL)
 				return *new Line(*this, controller,owner); 
 			else
@@ -148,7 +148,7 @@
 		virtual	int		 EndOf(unsigned Frame) const { return loop->EndOf(Frame); }
 
 		virtual void Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 			Mask=dynamic_cast<LineResource*>(file.Root().FindObject(mask));
 		}
 
@@ -189,13 +189,13 @@
 		}
 	}
 
-	inline Line::Line(LineResource &parent, animation::AnimationTimer &controller, bool owner/*=false*/) : parent(parent), AnimationBase(controller, owner) {
+	inline Line::Line(LineResource &parent, animation::Timer &controller, bool owner/*=false*/) : parent(parent), Base(controller, owner) {
 		start=&parent.GetStart().CreateAnimation(controller);
 		loop=&parent.GetLoop().CreateAnimation(controller);
 		end=&parent.GetEnd().CreateAnimation(controller);
 	}
 
-	inline Line::Line(LineResource &parent, bool create/*=false*/) : parent(parent), AnimationBase(create) {
+	inline Line::Line(LineResource &parent, bool create/*=false*/) : parent(parent), Base(create) {
 		if(Controller) {
 			start=&parent.GetStart().CreateAnimation(*Controller);
 			loop=&parent.GetLoop().CreateAnimation(*Controller);
@@ -217,7 +217,7 @@
 	}
 	
 
-	inline MaskedLine::MaskedLine(LineResource &parent, animation::AnimationTimer &controller, LineResource *mask, bool owner/*=false*/) : 
+	inline MaskedLine::MaskedLine(LineResource &parent, animation::Timer &controller, LineResource *mask, bool owner/*=false*/) : 
 	Line(parent, controller, owner) {
 		Mask=&mask->CreateResizableObject(controller);
 	}
--- a/Widgets/Basic/PetContainer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/PetContainer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -93,7 +93,7 @@
 		}
 
 		void InformEnabledChange(bool state) {
-			for(auto it=Widgets.First();it.isValid();it.Next()) {
+			for(auto it=Widgets.First();it.IsValid();it.Next()) {
 				call_widget_containerenabledchanged(*it, false);
 			}
 		}
--- a/Widgets/Basic/Placeholder.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Placeholder.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,5 +1,5 @@
 #include "Placeholder.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 
 using namespace gge::resource;
--- a/Widgets/Basic/Placeholder.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Placeholder.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #pragma once
 
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Definitions.h"
 #include "..\..\Utils\Margins.h"
 #include "..\..\Utils\Size2D.h"
@@ -56,7 +56,7 @@
 
 	};
 
-	class PlaceholderResource : public Placeholder, public resource::ResourceBase {
+	class PlaceholderResource : public Placeholder, public resource::Base {
 	public:
 
 		virtual GID::Type getGID() const { return GID::Placeholder; }
--- a/Widgets/Basic/Rectangle.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Rectangle.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,7 +1,7 @@
 #include "Rectangle.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Engine\Animation.h"
-#include "..\..\Resource\AnimationResource.h"
+#include "..\..\Resource\Animation.h"
 #include "..\..\Resource\NullImage.h"
 #include <vector>
 #include "..\..\Utils\SGuid.h"
@@ -16,7 +16,7 @@
 
 
 	namespace rectangleresource_prvt {
-		void setrectangleprovider(vector<AnimationResource *> &anims, RectangularGraphic2DSequenceProvider *&obj, int id) {
+		void setrectangleprovider(vector<Animation *> &anims, RectangularGraphic2DSequenceProvider *&obj, int id) {
 			if((int)anims.size()<=id) {
 				obj=&NullImage::Get();
 			}
@@ -38,7 +38,7 @@
 	RectangleResource *LoadRectangleResource(resource::File& File, std::istream &Data, int Size) {
 		RectangleResource *rectangle;
 		SGuid g;
-		vector<AnimationResource *> anims;
+		vector<Animation *> anims;
 		RectangularGraphic2DSequenceProvider *tl=NULL, *t=NULL, *tr=NULL;
 		RectangularGraphic2DSequenceProvider * l=NULL, *c=NULL, * r=NULL;
 		RectangularGraphic2DSequenceProvider *bl=NULL, *b=NULL, *br=NULL;
--- a/Widgets/Basic/Rectangle.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/Rectangle.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,10 +1,10 @@
 #pragma once
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\..\Engine\Animation.h"
 #include "..\..\Resource\ResizableObject.h"
 #include "..\Definitions.h"
 #include "..\..\Utils\Margins.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 namespace gge { namespace widgets {
 
@@ -15,7 +15,7 @@
 
 	class Rectangle : public resource::ResizableObject {
 	public:
-		Rectangle(RectangleResource &parent, animation::AnimationTimer &controller, bool owner=false);
+		Rectangle(RectangleResource &parent, animation::Timer &controller, bool owner=false);
 		Rectangle(RectangleResource &parent, bool create=false);
 
 		RectangleResource &parent;
@@ -36,8 +36,8 @@
 			br->DeleteAnimation();
 		}
 
-		virtual void SetController( animation::AnimationTimer &controller, bool owner=false ) {
-			AnimationBase::SetController(controller, owner);
+		virtual void SetController( animation::Timer &controller, bool owner=false ) {
+			Base::SetController(controller, owner);
 			tl->SetController(controller);
 			t ->SetController(controller);
 			tr->SetController(controller);
@@ -71,7 +71,7 @@
 
 	class MaskedRectangle : public Rectangle {
 	public:
-		MaskedRectangle(RectangleResource &parent, animation::AnimationTimer &controller, RectangleResource *mask, bool owner=false);
+		MaskedRectangle(RectangleResource &parent, animation::Timer &controller, RectangleResource *mask, bool owner=false);
 		MaskedRectangle(RectangleResource &parent, RectangleResource *mask, bool create=false);
 
 		Rectangle *Mask;
@@ -86,8 +86,8 @@
 		virtual void drawin(graphics::ImageTarget2D& Target, const graphics::SizeController2D &controller, int X, int Y, int W, int H) const;
 	};
 
-	class RectangleResource : public resource::ResourceBase, virtual public resource::ResizableObjectProvider, 
-		virtual public animation::DiscreteAnimationProvider 
+	class RectangleResource : public resource::Base, virtual public resource::ResizableObjectProvider, 
+		virtual public animation::DiscreteProvider 
 	{
 		friend RectangleResource *LoadRectangleResource(resource::File& File, std::istream &Data, int Size);
 	public:
@@ -116,14 +116,14 @@
 
 		virtual GID::Type getGID() const { return GID::Rectangle; }
 
-		virtual Rectangle &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) {
+		virtual Rectangle &CreateAnimation(animation::Timer &controller, bool owner=false) {
 			return CreateResizableObject(controller, owner);
 		}
 		virtual Rectangle &CreateAnimation(bool create=false) {
 			return CreateResizableObject(create);
 		}
 
-		virtual Rectangle &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false) { 
+		virtual Rectangle &CreateResizableObject(animation::Timer &controller, bool owner=false) { 
 			if(Mask==NULL)
 				return *new Rectangle(*this, controller,owner); 
 			else
@@ -197,7 +197,7 @@
 		virtual	int		 EndOf(unsigned Frame) const { return c->EndOf(Frame); }
 
 		virtual void Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 			Mask=dynamic_cast<RectangleResource*>(file.Root().FindObject(mask));
 		}
 
@@ -225,7 +225,7 @@
 		return controller.CalculateHeight(h, c->GetHeight(), t->GetHeight()+b->GetHeight());
 	}
 
-	inline Rectangle::Rectangle(RectangleResource &parent, animation::AnimationTimer &controller, bool owner/*=false*/) : parent(parent), AnimationBase(controller, owner) {
+	inline Rectangle::Rectangle(RectangleResource &parent, animation::Timer &controller, bool owner/*=false*/) : parent(parent), Base(controller, owner) {
 		tl=&parent.GetTL().CreateAnimation(controller);
 		t=&parent.GetT().CreateAnimation(controller);
 		tr=&parent.GetTR().CreateAnimation(controller);
@@ -237,7 +237,7 @@
 		br=&parent.GetBR().CreateAnimation(controller);
 	}
 
-	inline Rectangle::Rectangle(RectangleResource &parent, bool create/*=false*/) : parent(parent), AnimationBase(create) {
+	inline Rectangle::Rectangle(RectangleResource &parent, bool create/*=false*/) : parent(parent), Base(create) {
 		if(Controller) {
 			tl=&parent.GetTL().CreateAnimation(*Controller);
 			t=&parent.GetT().CreateAnimation(*Controller);
@@ -263,7 +263,7 @@
 	}
 
 
-	inline MaskedRectangle::MaskedRectangle(RectangleResource &parent, animation::AnimationTimer &controller, RectangleResource *mask, bool owner/*=false*/) : 
+	inline MaskedRectangle::MaskedRectangle(RectangleResource &parent, animation::Timer &controller, RectangleResource *mask, bool owner/*=false*/) : 
 	Rectangle(parent, controller, owner) {
 		Mask=&mask->CreateResizableObject(controller);
 	}
--- a/Widgets/Basic/ResizableObjectResource.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/ResizableObjectResource.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,10 +1,10 @@
 
 #include "Line.h"
 #include "Rectangle.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Engine\Animation.h"
-#include "..\..\Resource\AnimationResource.h"
-#include "..\..\Resource\ImageResource.h"
+#include "..\..\Resource\Animation.h"
+#include "..\..\Resource\Image.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Utils\SGuid.h"
 #include "ResizableObjectResource.h"
@@ -39,7 +39,7 @@
 				rol->SizeController.VerticalTiling=(SizeController2D::TilingType)ReadFrom<int>(Data);
 			}
 			else {
-				ResourceBase *rb=File.LoadObject(Data, gid, size);
+				resource::Base *rb=File.LoadObject(Data, gid, size);
 				if(rb)
 					rol->Subitems.Add(rb);
 			}
@@ -50,7 +50,7 @@
 
 
 	void ResizableObjectResource::Prepare(GGEMain &main, resource::File &file) {
-		ResourceBase::Prepare(main, file);
+		Base::Prepare(main, file);
 
 		resource::ResizableObjectProvider *provider= dynamic_cast<resource::ResizableObjectProvider *>(file.Root().FindObject(target));
 
--- a/Widgets/Basic/ResizableObjectResource.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Basic/ResizableObjectResource.h	Tue Feb 28 09:58:13 2012 +0000
@@ -1,10 +1,10 @@
 #pragma once
 
 
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Definitions.h"
 #include "..\..\Resource\ResizableObject.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Engine\Animation.h"
 
@@ -31,8 +31,8 @@
 			object->DeleteAnimation();
 		}
 
-		virtual void SetController( animation::AnimationTimer &controller, bool owner=false ) {
-			AnimationBase::SetController(controller, owner);
+		virtual void SetController( animation::Timer &controller, bool owner=false ) {
+			Base::SetController(controller, owner);
 			object->SetController(controller);
 		}
 
@@ -65,7 +65,7 @@
 
 	};
 
-	class ResizableObjectResource : public resource::ResourceBase, virtual public resource::ResizableObjectProvider {
+	class ResizableObjectResource : public resource::Base, virtual public resource::ResizableObjectProvider {
 		friend ResizableObjectResource *LoadResizableObjectResource(resource::File& File, std::istream &Data, int Size);
 	public:
 
@@ -75,14 +75,14 @@
 		}
 
 
-		virtual ResizableObject &CreateResizableObject(animation::AnimationTimer &controller, bool owner=false)
+		virtual ResizableObject &CreateResizableObject(animation::Timer &controller, bool owner=false)
 		{ return *new ResizableObject(object->CreateResizableObject(controller, owner),SizeController); }
 
 		virtual ResizableObject &CreateResizableObject(bool create=false)
 		{ return *new ResizableObject(object->CreateResizableObject(create),SizeController); }
 
 
-		virtual ResizableObject &CreateAnimation(animation::AnimationTimer &controller, bool owner=false) 
+		virtual ResizableObject &CreateAnimation(animation::Timer &controller, bool owner=false) 
 		{ return CreateResizableObject(controller, owner); }
 
 		virtual ResizableObject &CreateAnimation(bool create=false)
--- a/Widgets/Checkbox/CheckboxBase.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Checkbox/CheckboxBase.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "CheckboxBase.h"
 #include "..\..\Utils\Size2D.h"
-#include "..\..\Resource\BitmapFontResource.h"
+#include "..\..\Resource\BitmapFont.h"
 
 using namespace gge::utils;
 using namespace gge::resource;
@@ -352,8 +352,8 @@
 										text,eprint,3,TextAlignment::Left);
 								}
 
-								if(dynamic_cast<BitmapFontResource*>(font->getRenderer())) {
-									ImageResource *im=dynamic_cast<BitmapFontResource*>(font->getRenderer())->Characters['_'];
+								if(dynamic_cast<BitmapFont*>(font->getRenderer())) {
+									Image *im=dynamic_cast<BitmapFont*>(font->getRenderer())->Characters['_'];
 									innerlayer.SetCurrentColor(font->Color);
 									im->DrawStretched(innerlayer, 
 										eprint[1].Out.position.x-1,eprint[1].Out.position.y,
--- a/Widgets/Checkbox/CheckboxBase.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Checkbox/CheckboxBase.h	Tue Feb 28 09:58:13 2012 +0000
@@ -173,10 +173,10 @@
 
 
 
-			animation::AnimationController focus_anim;
-			animation::AnimationController state_anim;
-			animation::AnimationController style_anim;
-			animation::AnimationController wait_timeout;
+			animation::Controller focus_anim;
+			animation::Controller state_anim;
+			animation::Controller style_anim;
+			animation::Controller wait_timeout;
 
 			bool focus_anim_loop;
 			bool state_anim_loop;
@@ -197,7 +197,7 @@
 			void playsound(Blueprint::FocusType focusfrom, Blueprint::FocusType focusto, int statefrom, int stateto, Blueprint::StyleType stylefrom, Blueprint::StyleType styleto);
 
 		private:
-			animation::AnimationController &getanimation(Blueprint::TransitionType transition) {
+			animation::Controller &getanimation(Blueprint::TransitionType transition) {
 				if(transition==Blueprint::FocusTransition)
 					return focus_anim;
 				else if(transition==Blueprint::StateTransition)
--- a/Widgets/Checkbox/CheckboxBlueprint.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Checkbox/CheckboxBlueprint.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "CheckboxBlueprint.h"
 #include "..\..\Engine\Pointer.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 using namespace gge::resource;
 using namespace std;
@@ -38,7 +38,7 @@
 					EatChunk(Data, size-(1 * 8 + 5 * 4));
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -88,7 +88,7 @@
 					bp->Subitems.Add(l, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -139,7 +139,7 @@
 					bp->Subitems.Add(elm, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -179,7 +179,7 @@
 					bp->Subitems.Add(grp, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -319,9 +319,9 @@
 		}
 
 		void Blueprint::Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 			
-			for(auto it=Subitems.First();it.isValid();it.Next()) {
+			for(auto it=Subitems.First();it.IsValid();it.Next()) {
 				Blueprint::Group &g=dynamic_cast<Blueprint::Group &>(*it);
 
 				Mapping[g] = &g;
@@ -335,7 +335,7 @@
 		}
 
 		void Blueprint::Group::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			Normal			=dynamic_cast<Blueprint::Element*>(file.FindObject(normal));
 			Mapping[Blueprint::Normal][Blueprint::Style_None]=Normal;
@@ -378,7 +378,7 @@
 
 
 		void Blueprint::Element::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			Border				=dynamic_cast<BorderDataResource*>(file.FindObject(border));
 			Symbol				=dynamic_cast<resource::ResizableObjectProvider*>(file.FindObject(symbol));
@@ -388,7 +388,7 @@
 			SymbolPlace	=dynamic_cast<Placeholder*>(file.FindObject(symbolplace));
 			TextPlace		=dynamic_cast<Placeholder*>(file.FindObject(textplace));
 			IconPlace		=dynamic_cast<Placeholder*>(file.FindObject(iconplace));
-			Sound				=dynamic_cast<resource::SoundResource*>(file.FindObject(sound));
+			Sound				=dynamic_cast<resource::Sound*>(file.FindObject(sound));
 			Overlay				=dynamic_cast<BorderDataResource*>(file.FindObject(overlay));
 
 			for(int i=0;i<3;i++) {
@@ -398,7 +398,7 @@
 
 
 		void Blueprint::Line::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			Border				=dynamic_cast<BorderDataResource*>(file.FindObject(border));
 		}
--- a/Widgets/Checkbox/CheckboxBlueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Checkbox/CheckboxBlueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -9,7 +9,7 @@
 #include "..\Basic\BorderData.h"
 #include "..\..\Engine\Font.h"
 #include "..\Basic\Placeholder.h"
-#include "..\..\Resource\SoundResource.h"
+#include "..\..\Resource\Sound.h"
 #include "..\..\Utils\Size2D.h"
 #include "..\..\Resource\NullImage.h"
 #include "..\..\Engine\Wave.h"
@@ -26,7 +26,7 @@
 
 		Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 
-		class Blueprint : public widgets::Blueprint, public resource::ResourceBase {
+		class Blueprint : public widgets::Blueprint, public resource::Base {
 			friend Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 		public:
 
@@ -129,7 +129,7 @@
 
 			class Element;
 
-			class Line : public resource::ResourceBase {
+			class Line : public resource::Base {
 				friend Line *LoadLine(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;
 			public:
@@ -165,7 +165,7 @@
 				utils::SGuid border;
 			};
 
-			class Element : public resource::ResourceBase {
+			class Element : public resource::Base {
 				friend Blueprint::Element *LoadElement(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;
 			public:
@@ -185,7 +185,7 @@
 				Placeholder					*SymbolPlace;
 				Placeholder					*TextPlace;
 				Placeholder					*IconPlace;
-				resource::SoundResource		*Sound;
+				resource::Sound		*Sound;
 				BorderDataResource			*Overlay;
 
 				Line *Lines[3];
@@ -220,7 +220,7 @@
 					return IconPlace;
 				}
 				template<>
-				resource::SoundResource *Get<resource::SoundResource, 7>() const {
+				resource::Sound *Get<resource::Sound, 7>() const {
 					return Sound;
 				}
 				template<>
@@ -260,7 +260,7 @@
 
 			};
 
-			class Group : public resource::ResourceBase {
+			class Group : public resource::Base {
 				friend Group *LoadGroup(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;
 			public:
@@ -442,8 +442,8 @@
 			Placeholder *GetIconPlace(Group **groups, StyleMode style, TransitionType &type) const {
 				return Get<Placeholder, 6>(groups, style, type);
 			}
-			resource::SoundResource *GetSound(Group **groups, StyleMode style, TransitionType &type) const {
-				return GetNoInverse<resource::SoundResource, 7>(groups, style, type);
+			resource::Sound *GetSound(Group **groups, StyleMode style, TransitionType &type) const {
+				return GetNoInverse<resource::Sound, 7>(groups, style, type);
 			}
 			BorderDataResource *GetOverlay(Group **groups, StyleMode style, TransitionType &type) const {
 				return Get<BorderDataResource, 8>(groups, style, type);
--- a/Widgets/ClassDiagram.cd	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/ClassDiagram.cd	Tue Feb 28 09:58:13 2012 +0000
@@ -39,7 +39,7 @@
     <Position X="5" Y="1.5" Width="1.5" />
     <TypeIdentifier>
       <HashCode>AAAAAKACgACBQAQAAAAAAAAEAEAEAAAAAAAAgAgAAAA=</HashCode>
-      <FileName>D:\programs\games\GGE-Test\Sources\GGE\Resource\ResourceBase.h</FileName>
+      <FileName>D:\programs\games\GGE-Test\Sources\GGE\Resource\Base.h</FileName>
     </TypeIdentifier>
   </Class>
   <Class Name="gge::resource::ResizableObjectProvider" Collapsed="true">
--- a/Widgets/Combobox.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Combobox.h	Tue Feb 28 09:58:13 2012 +0000
@@ -78,7 +78,7 @@
 		}
 
 		void DeleteAll(const T_ &value) {
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				if(it->Value==value) {
 					listbox.Remove(*it);
 					it.Delete();
@@ -87,7 +87,7 @@
 		}
 
 		ListItem *Find(const T_ &value) {
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				if(it->Value==value)
 					return it.CurrentPtr();
 			}
@@ -200,13 +200,13 @@
 						if(Key==input::keyboard::KeyCodes::Down) {
 							auto it=OrderedCollection::Find(GetSelectedItem());
 
-							if(!it.isValid()) {
+							if(!it.IsValid()) {
 								if(GetCount())
 									setvalue(OrderedCollection::get_(0)->Value);
 							}
 							else {
 								it.Next();
-								if(it.isValid()) {
+								if(it.IsValid()) {
 									setvalue(it->Value);
 								}
 							}
@@ -216,7 +216,7 @@
 						else if(Key==input::keyboard::KeyCodes::Up) {
 							auto it=OrderedCollection::Find(GetSelectedItem());
 							it.Previous();
-							if(it.isValid()) {
+							if(it.IsValid()) {
 								setvalue(it->Value);
 							}
 
--- a/Widgets/Combobox/ComboboxBlueprint.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Combobox/ComboboxBlueprint.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,5 +1,5 @@
 #include "ComboboxBlueprint.h"
-#include "../../Resource/ResourceFile.h"
+#include "../../Resource/File.h"
 
 using namespace gge::resource;
 using namespace gge::utils;
@@ -36,7 +36,7 @@
 					EatChunk(Data, size-(1 * 8 + 3 * 8 + 1*16));
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -49,7 +49,7 @@
 
 
 		void Blueprint::Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 
 			file.FindObject(textbox, Textbox);
 			file.FindObject(listbox, Listbox);
--- a/Widgets/Combobox/ComboboxBlueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Combobox/ComboboxBlueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -13,7 +13,7 @@
 
 		Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 
-		class Blueprint : public resource::ResourceBase, public widgets::Blueprint {
+		class Blueprint : public resource::Base, public widgets::Blueprint {
 			friend Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 		public:
 
--- a/Widgets/DialogWindow.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/DialogWindow.h	Tue Feb 28 09:58:13 2012 +0000
@@ -36,7 +36,7 @@
 		}
 
 		void ClearDialogButtons() {
-			for(auto i=dialogbuttons.First();i.isValid();i.Next())
+			for(auto i=dialogbuttons.First();i.IsValid();i.Next())
 				i->Detach();
 
 			dialogbuttons.Clear();
--- a/Widgets/Interfaces/IOption.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Interfaces/IOption.h	Tue Feb 28 09:58:13 2012 +0000
@@ -153,10 +153,10 @@
 			}
 			else {
 				auto it=Options.Find(currentoption);
-				if(it.isValid())
+				if(it.IsValid())
 					it.Next();
 
-				if(it.isValid())
+				if(it.IsValid())
 					Set(*it);
 				else
 					Set(*Options.First());
@@ -172,10 +172,10 @@
 			}
 			else {
 				auto it=Options.Find(currentoption);
-				if(it.isValid())
+				if(it.IsValid())
 					it.Previous();
 
-				if(it.isValid())
+				if(it.IsValid())
 					Set(*it);
 				else
 					Set(*Options.Last());
@@ -213,7 +213,7 @@
 		}
 
 		virtual O_ *FindOption(const T_ &value) {
-			for(auto i=Options.First();i.isValid();i.Next()) {
+			for(auto i=Options.First();i.IsValid();i.Next()) {
 				if(i->Value==value)
 					return i.CurrentPtr();
 			}
@@ -221,7 +221,7 @@
 			return NULL;
 		}
 		virtual const O_ *FindOption(const T_ &value) const {
-			for(auto i=Options.First();i.isValid();i.Next()) {
+			for(auto i=Options.First();i.IsValid();i.Next()) {
 				if(i->Value==value)
 					return i.CurrentPtr();
 			}
@@ -269,7 +269,7 @@
 		utils::EventChain<OptionGroup> changeevent;
 
 		void clearall() {
-			for(auto i=Options.First();i.isValid();i.Next()) {
+			for(auto i=Options.First();i.IsValid();i.Next()) {
 				i->Uncheck();
 			}
 		}
--- a/Widgets/Label.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Label.h	Tue Feb 28 09:58:13 2012 +0000
@@ -36,7 +36,7 @@
 		virtual bool Accessed() {
 			auto it=Container->Widgets.Find(this);
 			it.Next();
-			if(it.isValid())
+			if(it.IsValid())
 				it->Focus();
 
 			return true;
--- a/Widgets/LayerWidget.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/LayerWidget.h	Tue Feb 28 09:58:13 2012 +0000
@@ -14,7 +14,7 @@
 		}
 
 		virtual bool MouseEvent(input::mouse::Event::Type event, utils::Point location, int amount)  {
-			return true;
+			return !input::mouse::Event::isScroll(event);
 		}
 
 
--- a/Widgets/Listbox.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Listbox.h	Tue Feb 28 09:58:13 2012 +0000
@@ -102,7 +102,7 @@
 		}
 
 		void DeleteAll(const T_ &value) {
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				if(it->Value==value) {
 					remove(*it);
 					it.Delete();
@@ -111,7 +111,7 @@
 		}
 
 		ListItem *Find(const T_ &value) {
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				if(it->Value==value)
 					return it.CurrentPtr();
 			}
@@ -231,7 +231,7 @@
 		virtual void SetBlueprint(const widgets::Blueprint &bp) {
 			Base::SetBlueprint(bp);
 
-			for(auto it=First();it.isValid();it.Next())
+			for(auto it=First();it.IsValid();it.Next())
 				it->SetBlueprint(*Base::bp->Item);
 
 			if(GetCount())
@@ -272,7 +272,7 @@
 		ListItem *active;
 
 		void clearall(ListItem *item=NULL) {
-			for(auto it=First();it.isValid();it.Next())
+			for(auto it=First();it.IsValid();it.Next())
 				if(it.CurrentPtr()!=item) callclear(*it);
 		}
 
@@ -333,11 +333,11 @@
 		void reorganize() {
 			//panel.Widgets.Clear();
 
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				panel.RemoveWidget(*it);
 			}
 
-			for(auto it=First();it.isValid();it.Next()) {
+			for(auto it=First();it.IsValid();it.Next()) {
 				add(*it);
 			}
 		}
--- a/Widgets/Listbox/ListboxBase.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Listbox/ListboxBase.h	Tue Feb 28 09:58:13 2012 +0000
@@ -174,7 +174,7 @@
 				if(autoheight) {
 					panel.SetHeight(200);
 					int h=0;
-					for(auto it=panel.Widgets.First();it.isValid();it.Next()) {
+					for(auto it=panel.Widgets.First();it.IsValid();it.Next()) {
 						if(it->IsVisible())
 							h+=it->GetHeight();
 					}
--- a/Widgets/Listbox/ListboxBlueprint.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Listbox/ListboxBlueprint.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "ListboxBlueprint.h"
 #include "..\..\Engine\Pointer.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 using namespace gge::resource;
 using namespace std;
@@ -43,7 +43,7 @@
 					EatChunk(Data, size-(1 * 8 + 5 * 8));
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -56,7 +56,7 @@
 
 
 		void Blueprint::Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 
 			file.FindObject(item, Item);
 			file.FindObject(header, Header);
--- a/Widgets/Listbox/ListboxBlueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Listbox/ListboxBlueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -7,11 +7,11 @@
 
 #include "..\Base\BluePrint.h"
 #include "..\Definitions.h"
-#include "..\..\Resource\SoundResource.h"
+#include "..\..\Resource\Sound.h"
 
 #include <map>
 #include "..\Panel\PanelBlueprint.h"
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Checkbox\CheckboxBlueprint.h"
 
 
@@ -20,7 +20,7 @@
 
 	namespace listbox {
 
-		class Blueprint : public widgets::Blueprint, public resource::ResourceBase {
+		class Blueprint : public widgets::Blueprint, public resource::Base {
 			friend Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 		public:
 
--- a/Widgets/Main.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Main.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -24,7 +24,7 @@
 
 
 	void Draw_Signal(IntervalObject &interval, void *data) {
-		for(utils::Collection<WidgetBase>::Iterator i=DrawQueue.First();i.isValid();i.Next()) {
+		for(utils::Collection<WidgetBase>::Iterator i=DrawQueue.First();i.IsValid();i.Next()) {
 			i->waitingforredraw=false;
 			i->draw();
 		}
@@ -35,21 +35,21 @@
 
 	void RegisterLoaders(resource::File &File) {
 		File.AddGameLoaders();
-		File.Loaders.Add(new resource::ResourceLoader(GID::Line, LoadLineResource)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Rectangle, LoadRectangleResource)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::ResizableObj, LoadResizableObjectResource)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::BorderData, LoadBorderDataResource)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Placeholder, LoadPlaceholderResource)); 
+		File.Loaders.Add(new resource::Loader(GID::Line, LoadLineResource)); 
+		File.Loaders.Add(new resource::Loader(GID::Rectangle, LoadRectangleResource)); 
+		File.Loaders.Add(new resource::Loader(GID::ResizableObj, LoadResizableObjectResource)); 
+		File.Loaders.Add(new resource::Loader(GID::BorderData, LoadBorderDataResource)); 
+		File.Loaders.Add(new resource::Loader(GID::Placeholder, LoadPlaceholderResource)); 
 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Checkbox, checkbox::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Slider, slider::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Panel, panel::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Textbox, textbox::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Listbox, listbox::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Combobox, combobox::Load)); 
-		File.Loaders.Add(new resource::ResourceLoader(GID::Tabpanel, tabpanel::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Checkbox, checkbox::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Slider, slider::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Panel, panel::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Textbox, textbox::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Listbox, listbox::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Combobox, combobox::Load)); 
+		File.Loaders.Add(new resource::Loader(GID::Tabpanel, tabpanel::Load)); 
 
-		File.Loaders.Add(new resource::ResourceLoader(GID::WR, LoadWR)); 
+		File.Loaders.Add(new resource::Loader(GID::WR, LoadWR)); 
 	}
 
 	void Init(GGEMain &Main) {
--- a/Widgets/Main.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Main.h	Tue Feb 28 09:58:13 2012 +0000
@@ -5,7 +5,7 @@
 // widget files
 // 
 
-#include "..\Resource\ResourceFile.h"
+#include "..\Resource\File.h"
 #include "..\Engine\GGEMain.h"
 #include "Base\VirtualPanel.h"
 
--- a/Widgets/Organizers/LinearOrganizer.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Organizers/LinearOrganizer.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -116,14 +116,14 @@
 	void LinearOrganizer::sync() {
 		if(!attachedto) return;
 
-		for(auto w=organizedwidgets.First();w.isValid();w.Next()) {
-			if(!attachedto->Widgets.Find(*w).isValid()) {
+		for(auto w=organizedwidgets.First();w.IsValid();w.Next()) {
+			if(!attachedto->Widgets.Find(*w).IsValid()) {
 				w.Remove();
 			}
 		}
 
-		for(auto w=attachedto->Widgets.First();w.isValid();w.Next()) {
-			if(!organizedwidgets.Find(*w).isValid()) {
+		for(auto w=attachedto->Widgets.First();w.IsValid();w.Next()) {
+			if(!organizedwidgets.Find(*w).IsValid()) {
 				organizedwidgets.Add(w);
 				rows[currentrow].columns.push_back(w.CurrentPtr());
 			}
--- a/Widgets/Organizers/LinearOrganizer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Organizers/LinearOrganizer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -74,7 +74,7 @@
 		LinearOrganizer &operator <<(RadioGroup<T_> &rg) {
 			if(!attachedto) return *this;
 
-			for(auto i=rg.First();i.isValid();i.Next()) {
+			for(auto i=rg.First();i.IsValid();i.Next()) {
 				*attachedto<<*i;
 				NextLine();
 			}
@@ -92,11 +92,14 @@
 			return *this;
 		}
 
-		template <class T_>
 		LinearOrganizer &operator <<(const std::string &text) {
 			Label *l=new Label(text);
+			l->TextWrap=false;
+			l->Autosize=AutosizeModes::Autosize;
 
-			*this<<l;
+			*this<<*l;
+
+			return *this;
 		}
 
 		LinearOrganizer &operator <<(Modifier m) {
--- a/Widgets/Organizers/ListOrganizer.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Organizers/ListOrganizer.h	Tue Feb 28 09:58:13 2012 +0000
@@ -12,7 +12,7 @@
 			if(!attachedto) return;
 
 			int y=0;
-			for(auto it=attachedto->Widgets.First();it.isValid();it.Next()) {
+			for(auto it=attachedto->Widgets.First();it.IsValid();it.Next()) {
 				if(it->IsVisible()) {
 					it->SetWidth(attachedto->GetUsableWidth());
 					it->Move(0, y);
--- a/Widgets/Panel/PanelBase.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Panel/PanelBase.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "PanelBase.h"
 #include "..\..\Utils\Size2D.h"
-#include "..\..\Resource\BitmapFontResource.h"
+#include "..\..\Resource\BitmapFont.h"
 
 using namespace gge::utils;
 using namespace gge::resource;
@@ -226,7 +226,7 @@
 			innerlayer.BoundingBox=inner;
 
 			Size size=Size(inner.Width(), 0);
-			for(auto i=Widgets.First();i.isValid();i.Next()) {
+			for(auto i=Widgets.First();i.IsValid();i.Next()) {
 				int y=i->GetBounds().BottomRight().y;
 				if(size.Height<y)
 					size.Height=y;
@@ -485,7 +485,7 @@
 
 				if(TextAlignment::GetHorizontal(align)==TextAlignment::Left) {
 					int x=margins.Left;
-					for(auto i=titlebuttons.Last();i.isValid();i.Previous()) {
+					for(auto i=titlebuttons.Last();i.IsValid();i.Previous()) {
 						if(i->IsVisible()) {
 							int y=Alignment::CalculateLocation(align, Bounds(0,margins.Top, 0,height+margins.TotalY()), Size(0,i->GetHeight())).y;
 
@@ -499,7 +499,7 @@
 				}
 				else {
 					int x=size.Width-margins.Right;
-					for(auto i=titlebuttons.Last();i.isValid();i.Previous()) {
+					for(auto i=titlebuttons.Last();i.IsValid();i.Previous()) {
 						if(i->IsVisible()) {
 							int y=Alignment::CalculateLocation(align, Bounds(0,margins.Top, 0,height+margins.TotalY()), Size(0,i->GetHeight())).y;
 
@@ -530,7 +530,7 @@
 				if(TextAlignment::GetHorizontal(align)==TextAlignment::Left) {
 					int x=margins.Left;
 					int cw=0;
-					for(auto i=dialogbuttons.Last();i.isValid();i.Previous()) {
+					for(auto i=dialogbuttons.Last();i.IsValid();i.Previous()) {
 						if(i->IsVisible()) {
 							int y=Alignment::CalculateLocation(align, Bounds(0,controls.BaseLayer.BoundingBox.Bottom-height-margins.TotalY(), 0,controls.BaseLayer.BoundingBox.Bottom-margins.Bottom), Size(0,i->GetHeight())).y;
 
@@ -549,7 +549,7 @@
 				else {
 					int x=size.Width-margins.Right;
 					int cw=0;
-					for(auto i=dialogbuttons.Last();i.isValid();i.Previous()) {
+					for(auto i=dialogbuttons.Last();i.IsValid();i.Previous()) {
 						if(i->IsVisible()) {
 							int y=Alignment::CalculateLocation(align, Bounds(0,controls.BaseLayer.BoundingBox.Bottom-(height+margins.TotalY()), 0,controls.BaseLayer.BoundingBox.Bottom-margins.Bottom), Size(0,i->GetHeight())).y;
 
--- a/Widgets/Panel/PanelBase.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Panel/PanelBase.h	Tue Feb 28 09:58:13 2012 +0000
@@ -31,7 +31,7 @@
 				innerlayer.Add(scrollinglayer);
 				scrollinglayer.Add(background, 1);
 				scrollinglayer.Add(widgetlayer, 0);
-				innerlayer.EnableClipping=true;
+				innerlayer.ClippingEnabled=true;
 
 				style_anim.Pause();
 				style_anim.Finished.Register(this, &Base::style_anim_finished);
@@ -77,7 +77,7 @@
 					setstyle(widgets::Blueprint::Normal);
 					WidgetBase::Enable();
 
-					for(auto it=Widgets.First();it.isValid();it.Next()) {
+					for(auto it=Widgets.First();it.IsValid();it.Next()) {
 						call_widget_containerenabledchanged(*it, true);
 					}
 				}
@@ -498,7 +498,7 @@
 			//for dialog buttons
 			PetContainer<Base> dialogcontrols;
 
-			animation::AnimationTimer &getanimation(bool transition) {
+			animation::Timer &getanimation(bool transition) {
 				if(transition)
 					return style_anim;
 				else
@@ -562,8 +562,8 @@
 			Blueprint::StyleType next_style;
 
 		//TODO Animations, idle, transition, animation finish function
-			animation::AnimationController style_anim;
-			animation::AnimationTimer	   idle_anim;
+			animation::Controller style_anim;
+			animation::Timer	   idle_anim;
 			bool style_anim_loop;
 
 
--- a/Widgets/Panel/PanelBlueprint.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Panel/PanelBlueprint.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "PanelBlueprint.h"
 #include "..\..\Engine\Pointer.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 using namespace gge::resource;
 using namespace std;
@@ -46,7 +46,7 @@
 					Data.seekg(ptarget+size);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -106,7 +106,7 @@
 					bp->Subitems.Add(elm, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -119,7 +119,7 @@
 
 
 		void Blueprint::Element::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			file.FindObject(innerborder, InnerBorder);
 			file.FindObject(outerborder, OuterBorder);
@@ -133,7 +133,7 @@
 
 
 		void Blueprint::Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 
 			file.FindObject(scroller, Scroller);
 			file.FindObject(titlelabel, TitleLabel);
--- a/Widgets/Panel/PanelBlueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Panel/PanelBlueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -7,11 +7,11 @@
 
 #include "..\Base\BluePrint.h"
 #include "..\Definitions.h"
-#include "..\..\Resource\SoundResource.h"
+#include "..\..\Resource\Sound.h"
 
 #include <map>
 #include "..\Slider\SliderBlueprint.h"
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 #include "..\Checkbox\CheckboxBlueprint.h"
 
 
@@ -20,12 +20,12 @@
 
 	namespace panel {
 
-		class Blueprint : public widgets::Blueprint, public resource::ResourceBase {
+		class Blueprint : public widgets::Blueprint, public resource::Base {
 			friend Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 		public:
 
 
-			class Element : public resource::ResourceBase {
+			class Element : public resource::Base {
 				friend Blueprint::Element *LoadElement(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;
 			public:
@@ -47,7 +47,7 @@
 				Byte						 BGOpacity;
 				BorderDataResource			*TitleBorder;
 				BorderDataResource			*DialogButtonBorder;
-				resource::SoundResource		*Sound;
+				resource::Sound		*Sound;
 				BorderDataResource			*Overlay;
 
 
@@ -80,7 +80,7 @@
 					return DialogButtonBorder;
 				}
 				template<>
-				resource::SoundResource *Get<resource::SoundResource, 7>() const {
+				resource::Sound *Get<resource::Sound, 7>() const {
 					return Sound;
 				}
 				template<>
@@ -213,8 +213,8 @@
 			BorderDataResource *GetDialogButtonBorder(StyleMode style, bool &transition) const {
 				return Get<BorderDataResource, 6>(style, transition);
 			}
-			resource::SoundResource *GetSound(StyleMode style, bool &type) const {
-				return Get<resource::SoundResource, 7>(style, type);
+			resource::Sound *GetSound(StyleMode style, bool &type) const {
+				return Get<resource::Sound, 7>(style, type);
 			}
 			BorderDataResource *GetOverlay(StyleMode style, bool &transition) const {
 				return Get<BorderDataResource, 8>(style, transition);
--- a/Widgets/RadioButton.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/RadioButton.h	Tue Feb 28 09:58:13 2012 +0000
@@ -193,7 +193,7 @@
 
 	template<class T_>
 	static ContainerBase &operator <<(ContainerBase &container, RadioGroup<T_> &rg) {
-		for(auto i=rg.First();i.isValid();i.Next()) {
+		for(auto i=rg.First();i.IsValid();i.Next()) {
 			container<<*i;
 		}
 
--- a/Widgets/Slider/SliderBase.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Slider/SliderBase.h	Tue Feb 28 09:58:13 2012 +0000
@@ -61,7 +61,7 @@
 		//Template parameter must allow +, -, / and (float) operators, for enums T_=int should be used
 		// and enum should be mapped manually to ints
 		template<class T_, class floattype=typename floattype<T_>::Type>
-		class Base : public WidgetBase, public ISliderType, private animation::AnimationBase {
+		class Base : public WidgetBase, public ISliderType, private animation::Base {
 		public:
 
 
@@ -1109,7 +1109,7 @@
 		private:
 			std::map<T_, std::string> namedlocations;
 
-			animation::AnimationController &getanimation(Blueprint::TransitionType transition) {
+			animation::Controller &getanimation(Blueprint::TransitionType transition) {
 				if(transition==Blueprint::FocusTransition)
 					return focus_anim;
 				else
@@ -1162,12 +1162,12 @@
 			Blueprint::FocusType next_focus;
 			Blueprint::StyleType next_style;
 
-			animation::AnimationController focus_anim;
-			animation::AnimationController style_anim;
-			animation::AnimationTimer	   idle_anim;
-
-
-			animation::AnimationController key_repeat;
+			animation::Controller focus_anim;
+			animation::Controller style_anim;
+			animation::Timer	   idle_anim;
+
+
+			animation::Controller key_repeat;
 			int key_repeat_timeout;
 			bool goingup, goingdown;
 
@@ -1248,12 +1248,12 @@
 				bool value;
 				bool valuedisplay;
 				float speed; //percent/sec
-				animation::AnimationController controller;
+				animation::Controller controller;
 				floattype stepvalue;
 				floattype sourcevalue;
 				T_ targetvalue;
 
-				animation::AnimationController indst_controller;
+				animation::Controller indst_controller;
 				floattype indst_stepvalue;
 				floattype indst_sourcevalue;
 				T_ indst_targetvalue;
--- a/Widgets/Slider/SliderBlueprint.cpp	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Slider/SliderBlueprint.cpp	Tue Feb 28 09:58:13 2012 +0000
@@ -1,6 +1,6 @@
 #include "SliderBlueprint.h"
 #include "..\..\Engine\Pointer.h"
-#include "..\..\Resource\ResourceFile.h"
+#include "..\..\Resource\File.h"
 
 using namespace gge::resource;
 using namespace std;
@@ -59,7 +59,7 @@
 					Data.seekg(ptarget+size);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -115,7 +115,7 @@
 					bp->Subitems.Add(elm, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
@@ -155,13 +155,13 @@
 					bp->Subitems.Add(grp, bp->Subitems.HighestOrder()+1);
 				}
 				else {
-					ResourceBase *res=File.LoadObject(Data, gid,size);
+					resource::Base *res=File.LoadObject(Data, gid,size);
 					if(res)
 						bp->Subitems.Add(res, bp->Subitems.HighestOrder()+1);
 				}
 			}
 
-			for(auto it=bp->Subitems.First();it.isValid();it.Next()) {
+			for(auto it=bp->Subitems.First();it.IsValid();it.Next()) {
 				Blueprint::Group &g=dynamic_cast<Blueprint::Group &>(*it);
 
 				bp->Mapping[g] = &g;
@@ -174,7 +174,7 @@
 
 
 		void Blueprint::Element::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			Border				=dynamic_cast<BorderDataResource*>(file.FindObject(border));
 			Symbol				=dynamic_cast<animation::RectangularGraphic2DSequenceProvider*>(file.FindObject(symbol));
@@ -187,7 +187,7 @@
 			SymbolPlace			=dynamic_cast<Placeholder*>(file.FindObject(symbolplace));
 			TextPlace			=dynamic_cast<Placeholder*>(file.FindObject(textplace));
 			ValuePlace			=dynamic_cast<Placeholder*>(file.FindObject(valueplace));
-			Sound				=dynamic_cast<resource::SoundResource*>(file.FindObject(sound));
+			Sound				=dynamic_cast<resource::Sound*>(file.FindObject(sound));
 			Overlay				=dynamic_cast<BorderDataResource*>(file.FindObject(overlay));
 
 			Ruler				=dynamic_cast<BorderDataResource*>(file.FindObject(ruler));
@@ -200,7 +200,7 @@
 		}
 
 		void Blueprint::Group::Prepare(GGEMain &main, resource::File &file) {
-			resource::ResourceBase::Prepare(main,file);
+			resource::Base::Prepare(main,file);
 
 			UpButton		=dynamic_cast<checkbox::Blueprint*>(file.FindObject(upbutton));
 			DownButton		=dynamic_cast<checkbox::Blueprint*>(file.FindObject(downbutton));
@@ -253,9 +253,9 @@
 
 
 		void Blueprint::Prepare(GGEMain &main, resource::File &file) {
-			ResourceBase::Prepare(main, file);
+			Base::Prepare(main, file);
 
-			TickSound			=dynamic_cast<resource::SoundResource*>(file.FindObject(ticksound));
+			TickSound			=dynamic_cast<resource::Sound*>(file.FindObject(ticksound));
 		}
 
 		Blueprint::AnimationInfo Blueprint::HasStyleAnimation(OrientationType o, FocusMode focus, StyleMode style) const {
--- a/Widgets/Slider/SliderBlueprint.h	Sun Feb 26 21:17:47 2012 +0000
+++ b/Widgets/Slider/SliderBlueprint.h	Tue Feb 28 09:58:13 2012 +0000
@@ -7,11 +7,11 @@
 
 #include "..\Base\BluePrint.h"
 #include "..\Definitions.h"
-#include "..\..\Resource\SoundResource.h"
+#include "..\..\Resource\Sound.h"
 
 #include <map>
 #include "..\Checkbox\CheckboxBlueprint.h"
-#include "..\..\Resource\ResourceBase.h"
+#include "..\..\Resource\Base.h"
 
 
 
@@ -19,7 +19,7 @@
 
 	namespace slider {
 
-		class Blueprint : public widgets::Blueprint, public resource::ResourceBase {
+		class Blueprint : public widgets::Blueprint, public resource::Base {
 			friend Blueprint *Load(resource::File& File, std::istream &Data, int Size);
 		public:
 
@@ -64,7 +64,7 @@
 				}
 			};
 
-			class Element : public resource::ResourceBase {
+			class Element : public resource::Base {
 				friend Blueprint::Element *LoadElement(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;
 			public:
@@ -83,7 +83,7 @@
 				Placeholder					*SymbolPlace;
 				Placeholder					*TextPlace;
 				Placeholder					*ValuePlace;
-				resource::SoundResource		*Sound;
+				resource::Sound		*Sound;
 				BorderDataResource			*Overlay;
 
 				BorderDataResource			*Ruler;
@@ -121,7 +121,7 @@
 					return TextPlace;
 				}
 				template<>
-				resource::SoundResource *Get<resource::SoundResource, 7>() const {
+				resource::Sound *Get<resource::Sound, 7>() const {
 					return Sound;
 				}
 				template<>
@@ -188,7 +188,7 @@
 				utils::SGuid tickmarkborder;
 			};
 
-			class Group : public resource::ResourceBase {
+			class Group : public resource::Base {
 				friend Group *LoadGroup(resource::File& File, std::istream &Data, int Size);
 				friend class Blueprint;