* geffects >> gorgon::effects

Thu, 21 Apr 2011 01:53:15 +0000

author
cemkalyoncu
date
Thu, 21 Apr 2011 01:53:15 +0000
changeset 20
cc549c0f8ebd
parent 19
b0d0e9926fcc
child 21
016809939f8a

* geffects >> gorgon::effects
* gre >> gorgon::resource
* gorgonwidgets >> gorgon::widgets
* graphics moved to gorgon::graphics
* no longer using any namespace in headers
* widget layer moved to widgets

Effects/CountingText.cpp file | annotate | diff | comparison | revisions
Effects/CountingText.h file | annotate | diff | comparison | revisions
Effects/Flip.cpp 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.cpp 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/CustomLayer.cpp file | annotate | diff | comparison | revisions
Engine/Font.cpp file | annotate | diff | comparison | revisions
Engine/Font.h file | annotate | diff | comparison | revisions
Engine/FontRenderer.h file | annotate | diff | comparison | revisions
Engine/GGEMain.cpp file | annotate | diff | comparison | revisions
Engine/GGEMain.h file | annotate | diff | comparison | revisions
Engine/GraphicLayers.cpp file | annotate | diff | comparison | revisions
Engine/GraphicLayers.h file | annotate | diff | comparison | revisions
Engine/Graphics.cpp file | annotate | diff | comparison | revisions
Engine/Graphics.h file | annotate | diff | comparison | revisions
Engine/Layer.cpp file | annotate | diff | comparison | revisions
Engine/Pointer.cpp file | annotate | diff | comparison | revisions
Engine/Pointer.h file | annotate | diff | comparison | revisions
Resource/AnimationResource.cpp file | annotate | diff | comparison | revisions
Resource/AnimationResource.h file | annotate | diff | comparison | revisions
Resource/BitmapFontResource.cpp file | annotate | diff | comparison | revisions
Resource/BitmapFontResource.h file | annotate | diff | comparison | revisions
Resource/DataResource.cpp file | annotate | diff | comparison | revisions
Resource/DataResource.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/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/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/SoundResource.cpp file | annotate | diff | comparison | revisions
Resource/SoundResource.h file | annotate | diff | comparison | revisions
Resource/TextResource.cpp file | annotate | diff | comparison | revisions
Resource/TextResource.h file | annotate | diff | comparison | revisions
Utils/BasicGraphics.h file | annotate | diff | comparison | revisions
Utils/Binary.h file | annotate | diff | comparison | revisions
Utils/Bounds2D.h file | annotate | diff | comparison | revisions
Utils/BufferList.h file | annotate | diff | comparison | revisions
Utils/GGE.h file | annotate | diff | comparison | revisions
Utils/Iterator.h file | annotate | diff | comparison | revisions
Utils/PAClassList.h file | annotate | diff | comparison | revisions
Utils/Point2D.h file | annotate | diff | comparison | revisions
Utils/Rectangle2D.h file | annotate | diff | comparison | revisions
Utils/ValueList.h file | annotate | diff | comparison | revisions
Widgets/Button.cpp file | annotate | diff | comparison | revisions
Widgets/Button.h file | annotate | diff | comparison | revisions
Widgets/ButtonBP.h file | annotate | diff | comparison | revisions
Widgets/ButtonElement.cpp file | annotate | diff | comparison | revisions
Widgets/ButtonElement.h file | annotate | diff | comparison | revisions
Widgets/ButtonLoader.cpp file | annotate | diff | comparison | revisions
Widgets/ButtonStyleGroup.h file | annotate | diff | comparison | revisions
Widgets/CheckboxBP.h file | annotate | diff | comparison | revisions
Widgets/CheckboxBase.h file | annotate | diff | comparison | revisions
Widgets/CheckboxElement.cpp file | annotate | diff | comparison | revisions
Widgets/CheckboxElement.h file | annotate | diff | comparison | revisions
Widgets/CheckboxLoader.cpp file | annotate | diff | comparison | revisions
Widgets/CheckboxStyleGroup.cpp file | annotate | diff | comparison | revisions
Widgets/CheckboxStyleGroup.h file | annotate | diff | comparison | revisions
Widgets/Frame.cpp file | annotate | diff | comparison | revisions
Widgets/Frame.h file | annotate | diff | comparison | revisions
Widgets/FrameBP.h file | annotate | diff | comparison | revisions
Widgets/IWidgetContainer.h file | annotate | diff | comparison | revisions
Widgets/Label.h file | annotate | diff | comparison | revisions
Widgets/Line.cpp file | annotate | diff | comparison | revisions
Widgets/Line.h file | annotate | diff | comparison | revisions
Widgets/Rectangle.cpp file | annotate | diff | comparison | revisions
Widgets/Rectangle.h file | annotate | diff | comparison | revisions
Widgets/ResizableObjectResource.cpp file | annotate | diff | comparison | revisions
Widgets/ResizableObjectResource.h file | annotate | diff | comparison | revisions
Widgets/SliderBP.cpp file | annotate | diff | comparison | revisions
Widgets/SliderBP.h file | annotate | diff | comparison | revisions
Widgets/SliderBase.cpp file | annotate | diff | comparison | revisions
Widgets/SliderBase.h file | annotate | diff | comparison | revisions
Widgets/SliderElement.cpp file | annotate | diff | comparison | revisions
Widgets/SliderElement.h file | annotate | diff | comparison | revisions
Widgets/SliderLoader.cpp file | annotate | diff | comparison | revisions
Widgets/SliderStyleGroup.h file | annotate | diff | comparison | revisions
Widgets/Textbox.cpp file | annotate | diff | comparison | revisions
Widgets/Textbox.h file | annotate | diff | comparison | revisions
Widgets/TextboxBP.cpp file | annotate | diff | comparison | revisions
Widgets/TextboxBP.h file | annotate | diff | comparison | revisions
Widgets/TextboxElement.cpp file | annotate | diff | comparison | revisions
Widgets/TextboxElement.h file | annotate | diff | comparison | revisions
Widgets/TextboxLoader.cpp file | annotate | diff | comparison | revisions
Widgets/TextboxStyleGroup.h file | annotate | diff | comparison | revisions
Widgets/VirtualFrame.h file | annotate | diff | comparison | revisions
Widgets/WidgetMain.cpp file | annotate | diff | comparison | revisions
Widgets/WidgetMain.h file | annotate | diff | comparison | revisions
Widgets/WidgetRegistry.cpp file | annotate | diff | comparison | revisions
Widgets/WidgetRegistry.h file | annotate | diff | comparison | revisions
--- a/Effects/CountingText.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/CountingText.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,9 +1,10 @@
 #include "CountingText.h"
 
 using namespace gge;
-using namespace gre;
+using namespace gge::graphics;
+using namespace gge::resource;
 
-namespace geffects {
+namespace gge { namespace effects {
 	void CountingText::Setup(float From, float To, int Time) {
 		if(Time)
 			speed=(To-From)/Time;
@@ -47,4 +48,4 @@
 				current=to;
 		}
 	}
-}
\ No newline at end of file
+} }
--- a/Effects/CountingText.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/CountingText.h	Thu Apr 21 01:53:15 2011 +0000
@@ -7,7 +7,7 @@
 #include "../Resource/BitmapFontResource.h"
 
 
-namespace geffects {
+namespace gge { namespace effects {
 
 	////This effect displays a counting number going from a given value to another one.
 	class CountingText : public AnimatorBase {
@@ -17,7 +17,7 @@
 		utils::EventChain<CountingText> FinishedEvent;
 
 		////Color of the text, default is black
-		RGBint Color;
+		graphics::RGBint Color;
 		////Text shadow, default is none
 		gge::ShadowParams Shadow;
 		////Alignment of the text, default is left
@@ -29,11 +29,11 @@
 		////Customized printing format, printf style that can feature a %f as the current value
 		string Format;
 		////The font to be used
-		gre::BitmapFontResource *Font;
+		resource::BitmapFontResource *Font;
 
 
 		////Initializes the effect
-		CountingText(BitmapFontResource *Font=NULL, RGBint color=RGBint(0xff000000), int Width=0, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams(), int Decimals=0) : 
+		CountingText(resource::BitmapFontResource *Font=NULL, graphics::RGBint color=graphics::RGBint(0xff000000), int Width=0, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams(), int Decimals=0) : 
 			Color(color),
 			Font(Font),
 			Shadow(Shadow),
@@ -53,7 +53,7 @@
 		void Setup(float To, int Time) { Setup(current, To, Time); }
 		
 		////Prints the current text to a layer
-		void Print(I2DColorizableGraphicsTarget *target, int X, int Y);
+		void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y);
 
 	protected:
 		float from;
@@ -65,4 +65,4 @@
 		virtual bool isFinished();
 		virtual void Process(int Time);
 	};
-}
\ No newline at end of file
+} }
--- a/Effects/Flip.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/Flip.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,9 +2,10 @@
 
 #include "Flip.h"
 
-using namespace gre;
+using namespace gge::resource;
+using namespace gge::graphics;
 
-namespace geffects {
+namespace gge { namespace effects {
 	void FlipEffect::Draw(I2DGraphicsTarget *Layer,int X,int Y) {
 		if(isFinished()) {
 			if(Backside) {
@@ -184,4 +185,4 @@
 			Backside=!Backside;
 		}
 	}
-};
\ No newline at end of file
+} }
--- a/Effects/Flip.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/Flip.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,7 @@
 #include "../Engine/Graphics.h"
 #include "../Engine/GraphicLayers.h"
 
-namespace geffects {
+namespace gge { namespace effects {
 	enum FlipSide {
 		EAFS_Top=1,
 		EAFS_Left,
@@ -14,7 +14,7 @@
 		EAFS_Right,
 	};
 
-	class FlipEffect : public gge::AnimatorBase, public gge::Buffered2DGraphic {
+	class FlipEffect : public AnimatorBase, public graphics::Buffered2DGraphic {
 	public:
 		////This event is fired when the animation
 		/// completes
@@ -28,7 +28,7 @@
 		void Flip(int ETA);
 		void CenterPivot();
 
-		gge::Buffered2DGraphic *Front,*Back;
+		graphics::Buffered2DGraphic *Front,*Back;
 		FlipSide Side;
 		bool Backside;
 		bool Flipping;
@@ -38,8 +38,8 @@
 		Point PivotFront;
 		Point PivotBack;
 
-		virtual void Draw(I2DGraphicsTarget *Layer, int X, int Y);
-		virtual void Draw(I2DGraphicsTarget &Layer, int X, int Y) { Draw(&Layer, X,Y); }
+		virtual void Draw(graphics::I2DGraphicsTarget *Layer, int X, int Y);
+		virtual void Draw(graphics::I2DGraphicsTarget &Layer, int X, int Y) { Draw(&Layer, X,Y); }
 
 	protected:
 		void Initialize();
@@ -47,4 +47,4 @@
 		virtual bool isFinished() { return AnimatorBase::currentTime()>=ETA; }
 		virtual void Process(int Time);
 	};
-};
\ No newline at end of file
+} }
--- a/Effects/LayerMover.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/LayerMover.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,6 +1,6 @@
 #include "LayerMover.h"
 
-namespace geffects {
+namespace gge { namespace effects {
 	void LayerMover::Setup(Point From, Point To, int Time) {
 
 		from=From;
@@ -55,4 +55,4 @@
 		Target->Y=current.y;
 
 	}
-}
\ No newline at end of file
+} }
--- a/Effects/LayerMover.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/LayerMover.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,7 @@
 #include "../Engine/Graphics.h"
 #include "../Engine/Layer.h"
 
-namespace geffects {
+namespace gge { namespace effects {
 
 	////This effect moves a given layer. Moving operation is animated from a given
 	/// value to another one
@@ -50,4 +50,4 @@
 		virtual bool isFinished();
 		virtual void Process(int Time);
 	};
-}
+} }
--- a/Effects/LayerResizer.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/LayerResizer.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,5 +1,5 @@
 #include "LayerResizer.h"
-namespace geffects {
+namespace gge { namespace effects {
 	void LayerResizer::Setup(gge::Rectangle From, gge::Rectangle To, int Time) {
 
 		from=From;
@@ -88,4 +88,4 @@
 		}
 		Target->H=Round(current.Height);
 	}
-}
\ No newline at end of file
+} }
--- a/Effects/LayerResizer.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/LayerResizer.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,10 +6,7 @@
 #include "../Engine/Graphics.h"
 #include "../Engine/Layer.h"
 
-using namespace gge;
-using namespace gre;
-
-namespace geffects {
+namespace gge { namespace effects {
 
 	////This effect resizes a given layer. Resize operation is animated from a given
 	/// value to another one
@@ -56,4 +53,4 @@
 		virtual bool isFinished();
 		virtual void Process(int Time);
 	};
-}
+} }
--- a/Effects/Tinting.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/Tinting.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,7 +1,9 @@
 #include "Tinting.h"
 #include "../Engine/GGEMain.h"
 
-namespace geffects {
+using namespace gge::graphics;
+
+namespace gge { namespace effects {
 	void Tinting::Setup(RGBint From, RGBint To, int Time) {
 
 		from=From;
@@ -80,4 +82,4 @@
 		}
 		Target->Ambient.b=current.b*255;
 	}
-}
\ No newline at end of file
+} }
--- a/Effects/Tinting.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Effects/Tinting.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,10 +5,7 @@
 #include "../Engine/Animator.h"
 #include "../Engine/Graphics.h"
 
-using namespace gge;
-using namespace gre;
-
-namespace geffects {
+namespace gge { namespace effects {
 
 	////This effect tints a given colorizable target. Tinting is animated from a given
 	/// value to another one
@@ -19,10 +16,10 @@
 		utils::EventChain<Tinting> FinishedEvent;
 
 		////Target of this effect
-		I2DColorizableGraphicsTarget *Target;
+		graphics::I2DColorizableGraphicsTarget *Target;
 
 		////Initializes the effect
-		Tinting(I2DColorizableGraphicsTarget *Target) : 
+		Tinting(graphics::I2DColorizableGraphicsTarget *Target) : 
 			from(), to(), current(), 
 			speed(0, 0,0,0),
 			Target(Target),
@@ -32,7 +29,7 @@
 		}
 
 		////Initializes the effect
-		Tinting(I2DColorizableGraphicsTarget &Target) : 
+		Tinting(graphics::I2DColorizableGraphicsTarget &Target) : 
 			from(), to(), current(), 
 			speed(0, 0,0,0),
 			Target(&Target),
@@ -43,17 +40,17 @@
 		
 		////Sets source and destination to the given values and allows time duration to reach the
 		/// destination
-		void Setup(RGBint From, RGBint To, int Time);
+		void Setup(graphics::RGBint From, graphics::RGBint To, int Time);
 		////Sets current destination to the given value and allows time duration to reach it
-		void Setup(RGBint To, int Time) { Setup(current, To, Time); }
+		void Setup(graphics::RGBint To, int Time) { Setup(current, To, Time); }
 
 	protected:
-		RGBfloat from;
-		RGBfloat to;
-		RGBfloat current;
-		RGBfloat speed;
+		graphics::RGBfloat from;
+		graphics::RGBfloat to;
+		graphics::RGBfloat current;
+		graphics::RGBfloat speed;
 
 		virtual bool isFinished();
 		virtual void Process(int Time);
 	};
-}
\ No newline at end of file
+} }
--- a/Engine/CustomLayer.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/CustomLayer.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,10 +3,14 @@
 #include "GGEMain.h"
 #include <gl/gl.h>
 
+using namespace gge::graphics;
+
 namespace gge {
-	extern RGBfloat CurrentLayerColor;
-	extern int trX,trY;
-	extern int scX,scY,scW,scH;
+	namespace graphics {
+		extern RGBfloat CurrentLayerColor;
+		extern int trX,trY;
+		extern int scX,scY,scW,scH;
+	}
 
 	CustomLayer::CustomLayer(CustomRenderer Renderer,int X, int Y, int W, int H) : LayerBase() {
 		this->X=X;
--- a/Engine/Font.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Font.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,6 +1,9 @@
 #include "Font.h"
 #include "../Resource/FontTheme.h"
 
+using namespace gge::resource;
+using namespace gge::graphics;
+
 namespace gge {
 	Font::Font(FontTheme &Theme, RGBint Color, FontStyle Style, ShadowParams Shadow) :
 	  Theme(&Theme), Style(Style), Color(Color), Shadow(Shadow)
--- a/Engine/Font.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Font.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,9 +3,9 @@
 #include "FontRenderer.h"
 #include "../Resource/ResourceFile.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class FontTheme; 
-};
+} }
 
 namespace gge {
 	class FontInitiator;
@@ -26,19 +26,19 @@
 
 		Font::Font();
 		Font(const Font &);
-		Font(gre::FontTheme &Theme, RGBint Color=RGBint(0xf0001000), FontStyle Style=Normal, ShadowParams Shadow=ShadowParams());
-		Font(gre::FontTheme *Theme, RGBint Color=RGBint(0xf0001000), FontStyle Style=Normal, ShadowParams Shadow=ShadowParams());
+		Font(resource::FontTheme &Theme, graphics::RGBint Color=graphics::RGBint(0xf0001000), FontStyle Style=Normal, ShadowParams Shadow=ShadowParams());
+		Font(resource::FontTheme *Theme, graphics::RGBint Color=graphics::RGBint(0xf0001000), FontStyle Style=Normal, ShadowParams Shadow=ShadowParams());
 
 		Font &operator =(Font &);
 		Font &operator =(const FontStyle);
 		
 
-		static FontInitiator Load(ResourceFile* file,FILE* gfile,int sz);
+		static FontInitiator Load(resource::ResourceFile* file,FILE* gfile,int sz);
 
 
-		gre::FontTheme *Theme;
+		resource::FontTheme *Theme;
 		FontStyle Style;
-		RGBint Color;
+		graphics::RGBint Color;
 		ShadowParams Shadow;
 
 		//Info functions
@@ -50,36 +50,36 @@
 
 		//Print Functions
 		////Prints the given text to the target using given color.
-		void Print(I2DColorizableGraphicsTarget *target, int X, int Y, string Text);
+		void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, string Text);
 		////Prints the given text to the target using given color. Text is wrapped and aligned as necessary
-		void Print(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT);
+		void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT);
 		////This method is extended to cover meta functionality for advanced text rendering
-		void Print(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT);
+		void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT);
 		////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
 		void Print_Test(int X, int Y, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align);
 
 
 		//Target references
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, string Text) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, string Text) 
 		{ Print(&target, X, Y, Text); }
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
 		{ Print(&target, X, Y, W, Text, Align); }
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
 		{ Print(&target, X, Y, W, Text, Data, DataLen, Align); }
 
-		void Print(I2DColorizableGraphicsTarget &target, Point p, string Text) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, Point p, string Text) 
 		{ Print(&target, p.x, p.y, Text); }
-		void Print(I2DColorizableGraphicsTarget &target, Point p, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, Point p, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
 		{ Print(&target, p.x, p.y, W, Text, Align); }
-		void Print(I2DColorizableGraphicsTarget &target, Point p, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
+		void Print(graphics::I2DColorizableGraphicsTarget &target, Point p, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
 		{ Print(&target, p.x, p.y, W, Text, Data, DataLen, Align); }
 
-		void Print(I2DColorizableGraphicsTarget *target, Point p, string Text) 
+		void Print(graphics::I2DColorizableGraphicsTarget *target, Point p, string Text) 
 		{ Print(target, p.x, p.y, Text); }
-		void Print(I2DColorizableGraphicsTarget *target, Point p, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
+		void Print(graphics::I2DColorizableGraphicsTarget *target, Point p, int W, string Text, TextAlignment Align=TEXTALIGN_LEFT) 
 		{ Print(target, p.x, p.y, W, Text, Align); }
-		void Print(I2DColorizableGraphicsTarget *target, Point p, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
+		void Print(graphics::I2DColorizableGraphicsTarget *target, Point p, int W, string Text, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT)
 		{ Print(target, p.x, p.y, W, Text, Data, DataLen, Align); }
 
 	protected:
@@ -91,9 +91,9 @@
 		FontInitiator() : file(NULL) { }
 		Guid *guid_theme;
 		Font::FontStyle Style;
-		RGBint Color;
+		graphics::RGBint Color;
 		ShadowParams Shadow;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 
 		operator Font();
 	};
--- a/Engine/FontRenderer.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/FontRenderer.h	Thu Apr 21 01:53:15 2011 +0000
@@ -2,9 +2,9 @@
 
 #include "../Engine/Graphics.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
-}
+} }
 
 namespace gge {
 
@@ -48,20 +48,20 @@
 		ShadowTypes Type;
 		Point Offset;
 		////Shadow color
-		RGBint Color;
+		graphics::RGBint Color;
 
 		ShadowParams() : Type(None), Offset(Point(1,2)), Color(0x60808080) 
 		{ }
 
-		ShadowParams(ShadowTypes Type, RGBint color, int XDist, int YDist) : 
+		ShadowParams(ShadowTypes Type, graphics::RGBint color, int XDist, int YDist) : 
 			Type(Type), Offset(Point(XDist, YDist)), Color(color) 
 		{ }
 
-		ShadowParams(ShadowTypes Type, RGBint color, Point Offset=Point(1,2)) : 
+		ShadowParams(ShadowTypes Type, graphics::RGBint color, Point Offset=Point(1,2)) : 
 			Type(Type), Color(color), Offset(Offset) 
 		{ }
 
-		static ShadowParams Load(gre::ResourceFile* file,FILE* gfile,int sz) {
+		static ShadowParams Load(resource::ResourceFile* file,FILE* gfile,int sz) {
 			ShadowParams s;
 
 			fread(&s.Type, 4,1, gfile);
@@ -112,11 +112,11 @@
 		friend class Font;
 	protected:
 		////Prints the given text to the target using given color.
-		virtual void Print(I2DColorizableGraphicsTarget *target, int X, int Y, string Text, RGBint Color, ShadowParams Shadow=ShadowParams())=0;
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, string Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams())=0;
 		////Prints the given text to the target using given color. Text is wrapped and aligned as necessary
-		virtual void Print(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams())=0;
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, graphics::RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams())=0;
 		////This method is extended to cover meta functionality for advanced text rendering
-		virtual void Print(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams())=0;
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams())=0;
 		////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, string Text, EPrintData *Data, int DataLen, TextAlignment Align)=0;
--- a/Engine/GGEMain.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/GGEMain.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -28,7 +28,7 @@
 #ifdef _DEBUG
 		if(Window!=NULL)
 			throw std::runtime_error("System already initialized.");
-#elif
+#else
 		if(Window!=NULL)
 			return;
 #endif
@@ -88,9 +88,9 @@
 	}
 
 	void GGEMain::Render() {
-		gge::PreRender();
+		graphics::PreRender();
 		LayerBase::Render();
-		gge::PostRender(Device);
+		graphics::PostRender(Device);
 	}
 
 	IntervalObject *GGEMain::RegisterInterval(unsigned int Timeout, void* Data, IntervalSignalEvent Signal) {
--- a/Engine/GGEMain.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/GGEMain.h	Thu Apr 21 01:53:15 2011 +0000
@@ -117,7 +117,7 @@
 
 		////Initializes graphic subsystem. All graphic related functions will fail if
 		/// called before this method. 
-		os::DeviceHandle InitializeGraphics() { Device = gge::InitializeGraphics(Window, BitDepth, Width, Height); return Device; }
+		os::DeviceHandle InitializeGraphics() { Device = gge::graphics::Initialize(Window, BitDepth, Width, Height); return Device; }
 		////Initializes sound subsystem. All sound related functions will fail if
 		/// called before this method.
 		void		 InitializeSound() { gge::sound::system::InitializeSound(Window); }
--- a/Engine/GraphicLayers.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/GraphicLayers.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -4,7 +4,7 @@
 using namespace gge::utils;
 using namespace gge::input;
 
-namespace gge {
+namespace gge { namespace graphics {
 	RGBfloat CurrentLayerColor;
 	int trX,trY;
 	int scX,scY,scW,scH;
@@ -28,7 +28,7 @@
 
 		EnableClipping=false;
 	}
-	void Basic2DLayer::Draw(gge::GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
+	void Basic2DLayer::Draw(GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
 		BasicSurface *surface=Surfaces.Add();
 
 		surface->setTexture(Image);
@@ -68,7 +68,7 @@
 				surface->TextureCoords[2].t=(float)H/Image->H;
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=(float)H/Image->H;
 				surface->VertexCoords[3].x=X;
@@ -99,7 +99,7 @@
 					surface->TextureCoords[2].t=(float)H/Image->H;
 					surface->VertexCoords[2].x=x+Image->W;
 					surface->VertexCoords[2].y=Y+H;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=(float)H/Image->H;
 					surface->VertexCoords[3].x=x;
@@ -126,7 +126,7 @@
 				surface->TextureCoords[2].t=(float)H/Image->H;
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=(float)H/Image->H;
 				surface->VertexCoords[3].x=x;
@@ -159,7 +159,7 @@
 					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[2].x=X+W;
 					surface->VertexCoords[2].y=y+Image->H;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 					surface->VertexCoords[3].x=X;
@@ -186,7 +186,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[3].x=X;
@@ -219,7 +219,7 @@
 						surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 						surface->VertexCoords[2].x=x+Image->W;
 						surface->VertexCoords[2].y=cy;
-			 
+
 						surface->TextureCoords[3].s=0;
 						surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 						surface->VertexCoords[3].x=x;
@@ -246,12 +246,12 @@
 					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[2].x=X+W;
 					surface->VertexCoords[2].y=cy;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[3].x=x;
 					surface->VertexCoords[3].y=cy;
-					
+
 				}
 
 				//this part is the last partial row
@@ -280,7 +280,7 @@
 					surface->TextureCoords[2].t=pty;
 					surface->VertexCoords[2].x=x+Image->W;
 					surface->VertexCoords[2].y=cy;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=pty;
 					surface->VertexCoords[3].x=x;
@@ -307,7 +307,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[3].x=x;
@@ -339,7 +339,7 @@
 			surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[3].x=X;
@@ -370,7 +370,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[2].x=x+Image->W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[3].x=x;
@@ -397,7 +397,7 @@
 			surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[3].x=x;
@@ -427,45 +427,18 @@
 			surface->TextureCoords[2].t=(float)H/Image->H;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=(float)H/Image->H;
 			surface->VertexCoords[3].x=X;
 			surface->VertexCoords[3].y=Y+H;
 		} else {
-				//we leave at least a portion of an image to the last part
-				//so that there will be less controls
-				int y=Y,ty=Y+H-Image->H;
-				//draw whole parts where image is texture repeated in
-				//x axis, we only need to draw multiple images for y axis
-				for(y=Y;y<ty;y+=Image->H) {
-					BasicSurface *surface=Surfaces.Add();
-
-					surface->setTexture(Image);
-					surface->CreateTextureCoords();
-
-					surface->TextureCoords[0].s=0;
-					surface->TextureCoords[0].t=0;
-					surface->VertexCoords[0].x=X;
-					surface->VertexCoords[0].y=y;
-
-					surface->TextureCoords[1].s=Image->ImageCoord[1].s;
-					surface->TextureCoords[1].t=0;
-					surface->VertexCoords[1].x=X+W;
-					surface->VertexCoords[1].y=y;
-
-					surface->TextureCoords[2].s=Image->ImageCoord[2].s;
-					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
-					surface->VertexCoords[2].x=X+W;
-					surface->VertexCoords[2].y=y+Image->H;
-		 
-					surface->TextureCoords[3].s=0;
-					surface->TextureCoords[3].t=Image->ImageCoord[3].t;
-					surface->VertexCoords[3].x=X;
-					surface->VertexCoords[3].y=y+Image->H;
-				}
-
-				//last image (might be partial)
+			//we leave at least a portion of an image to the last part
+			//so that there will be less controls
+			int y=Y,ty=Y+H-Image->H;
+			//draw whole parts where image is texture repeated in
+			//x axis, we only need to draw multiple images for y axis
+			for(y=Y;y<ty;y+=Image->H) {
 				BasicSurface *surface=Surfaces.Add();
 
 				surface->setTexture(Image);
@@ -482,14 +455,41 @@
 				surface->VertexCoords[1].y=y;
 
 				surface->TextureCoords[2].s=Image->ImageCoord[2].s;
-				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
+				surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[2].x=X+W;
-				surface->VertexCoords[2].y=Y+H;
-	 
+				surface->VertexCoords[2].y=y+Image->H;
+
 				surface->TextureCoords[3].s=0;
-				surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
+				surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 				surface->VertexCoords[3].x=X;
-				surface->VertexCoords[3].y=Y+H;
+				surface->VertexCoords[3].y=y+Image->H;
+			}
+
+			//last image (might be partial)
+			BasicSurface *surface=Surfaces.Add();
+
+			surface->setTexture(Image);
+			surface->CreateTextureCoords();
+
+			surface->TextureCoords[0].s=0;
+			surface->TextureCoords[0].t=0;
+			surface->VertexCoords[0].x=X;
+			surface->VertexCoords[0].y=y;
+
+			surface->TextureCoords[1].s=Image->ImageCoord[1].s;
+			surface->TextureCoords[1].t=0;
+			surface->VertexCoords[1].x=X+W;
+			surface->VertexCoords[1].y=y;
+
+			surface->TextureCoords[2].s=Image->ImageCoord[2].s;
+			surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
+			surface->VertexCoords[2].x=X+W;
+			surface->VertexCoords[2].y=Y+H;
+
+			surface->TextureCoords[3].s=0;
+			surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
+			surface->VertexCoords[3].x=X;
+			surface->VertexCoords[3].y=Y+H;
 		}
 	}
 
@@ -540,14 +540,14 @@
 			BasicSurface *surface=Surfaces[i];
 			glBindTexture(GL_TEXTURE_2D, surface->getTexture()->ID);
 			glBegin(GL_QUADS);
-				glTexCoord2fv(surface->TextureCoords[0].vect);
-				glVertex3fv(surface->VertexCoords[0].vect);
-				glTexCoord2fv(surface->TextureCoords[1].vect);
-				glVertex3fv(surface->VertexCoords[1].vect);
-				glTexCoord2fv(surface->TextureCoords[2].vect);
-				glVertex3fv(surface->VertexCoords[2].vect);
-				glTexCoord2fv(surface->TextureCoords[3].vect);
-				glVertex3fv(surface->VertexCoords[3].vect);
+			glTexCoord2fv(surface->TextureCoords[0].vect);
+			glVertex3fv(surface->VertexCoords[0].vect);
+			glTexCoord2fv(surface->TextureCoords[1].vect);
+			glVertex3fv(surface->VertexCoords[1].vect);
+			glTexCoord2fv(surface->TextureCoords[2].vect);
+			glVertex3fv(surface->VertexCoords[2].vect);
+			glTexCoord2fv(surface->TextureCoords[3].vect);
+			glVertex3fv(surface->VertexCoords[3].vect);
 			glEnd();
 		}
 
@@ -560,7 +560,7 @@
 		glPopMatrix();
 		trX-=X;
 		trY-=Y;
-		
+
 		if(EnableClipping) {
 			scX=pscX;
 			scY=pscY;
@@ -647,14 +647,14 @@
 			glColor4f(surface->Color.r*CurrentLayerColor.r,surface->Color.g*CurrentLayerColor.g,surface->Color.b*CurrentLayerColor.b,surface->Color.a*CurrentLayerColor.a);
 			glBindTexture(GL_TEXTURE_2D, surface->getTexture()->ID);
 			glBegin(GL_QUADS);
-				glTexCoord2fv(surface->TextureCoords[0].vect);
-				glVertex3fv(surface->VertexCoords[0].vect);
-				glTexCoord2fv(surface->TextureCoords[1].vect);
-				glVertex3fv(surface->VertexCoords[1].vect);
-				glTexCoord2fv(surface->TextureCoords[2].vect);
-				glVertex3fv(surface->VertexCoords[2].vect);
-				glTexCoord2fv(surface->TextureCoords[3].vect);
-				glVertex3fv(surface->VertexCoords[3].vect);
+			glTexCoord2fv(surface->TextureCoords[0].vect);
+			glVertex3fv(surface->VertexCoords[0].vect);
+			glTexCoord2fv(surface->TextureCoords[1].vect);
+			glVertex3fv(surface->VertexCoords[1].vect);
+			glTexCoord2fv(surface->TextureCoords[2].vect);
+			glVertex3fv(surface->VertexCoords[2].vect);
+			glTexCoord2fv(surface->TextureCoords[3].vect);
+			glVertex3fv(surface->VertexCoords[3].vect);
 			glEnd();
 		}
 
@@ -671,7 +671,7 @@
 		glPopMatrix();
 		trX-=X;
 		trY-=Y;
-		
+
 		if(EnableClipping) {
 			scX=pscX;
 			scY=pscY;
@@ -683,7 +683,7 @@
 
 	}
 
-	void Colorizable2DLayer::Draw(gge::GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4, RGBint color) {
+	void Colorizable2DLayer::Draw(GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4, RGBint color) {
 		ColorizableSurface *surface=Surfaces.Add();
 
 		surface->setTexture(Image);
@@ -701,7 +701,7 @@
 		surface->Color=ToRGBfloat(color);
 	}
 
-	void Colorizable2DLayer::Draw(gge::GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
+	void Colorizable2DLayer::Draw(GLTexture *Image, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
 		ColorizableSurface *surface=Surfaces.Add();
 
 		surface->setTexture(Image);
@@ -743,7 +743,7 @@
 				surface->TextureCoords[2].t=(float)H/Image->H;
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=(float)H/Image->H;
 				surface->VertexCoords[3].x=X;
@@ -775,7 +775,7 @@
 					surface->TextureCoords[2].t=(float)H/Image->H;
 					surface->VertexCoords[2].x=x+Image->W;
 					surface->VertexCoords[2].y=Y+H;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=(float)H/Image->H;
 					surface->VertexCoords[3].x=x;
@@ -803,7 +803,7 @@
 				surface->TextureCoords[2].t=(float)H/Image->H;
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=(float)H/Image->H;
 				surface->VertexCoords[3].x=x;
@@ -837,7 +837,7 @@
 					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[2].x=X+W;
 					surface->VertexCoords[2].y=y+Image->H;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 					surface->VertexCoords[3].x=X;
@@ -865,7 +865,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[3].x=X;
@@ -899,7 +899,7 @@
 						surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 						surface->VertexCoords[2].x=x+Image->W;
 						surface->VertexCoords[2].y=cy;
-			 
+
 						surface->TextureCoords[3].s=0;
 						surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 						surface->VertexCoords[3].x=x;
@@ -927,12 +927,12 @@
 					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[2].x=X+W;
 					surface->VertexCoords[2].y=cy;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 					surface->VertexCoords[3].x=x;
 					surface->VertexCoords[3].y=cy;
-					
+
 				}
 
 				//this part is the last partial row
@@ -962,7 +962,7 @@
 					surface->TextureCoords[2].t=pty;
 					surface->VertexCoords[2].x=x+Image->W;
 					surface->VertexCoords[2].y=cy;
-		 
+
 					surface->TextureCoords[3].s=0;
 					surface->TextureCoords[3].t=pty;
 					surface->VertexCoords[3].x=x;
@@ -990,7 +990,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[2].x=X+W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
 				surface->VertexCoords[3].x=x;
@@ -1023,7 +1023,7 @@
 			surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[3].x=X;
@@ -1055,7 +1055,7 @@
 				surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[2].x=x+Image->W;
 				surface->VertexCoords[2].y=Y+H;
-	 
+
 				surface->TextureCoords[3].s=0;
 				surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[3].x=x;
@@ -1083,7 +1083,7 @@
 			surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=Image->ImageCoord[2].t;
 			surface->VertexCoords[3].x=x;
@@ -1114,46 +1114,18 @@
 			surface->TextureCoords[2].t=(float)H/Image->H;
 			surface->VertexCoords[2].x=X+W;
 			surface->VertexCoords[2].y=Y+H;
- 
+
 			surface->TextureCoords[3].s=0;
 			surface->TextureCoords[3].t=(float)H/Image->H;
 			surface->VertexCoords[3].x=X;
 			surface->VertexCoords[3].y=Y+H;
 		} else {
-				//we leave at least a portion of an image to the last part
-				//so that there will be less controls
-				int y=Y,ty=Y+H-Image->H;
-				//draw whole parts where image is texture repeated in
-				//x axis, we only need to draw multiple images for y axis
-				for(y=Y;y<ty;y+=Image->H) {
-					ColorizableSurface *surface=Surfaces.Add();
-					surface->Color.a=surface->Color.r=surface->Color.g=surface->Color.b=1;
-
-					surface->setTexture(Image);
-					surface->CreateTextureCoords();
-
-					surface->TextureCoords[0].s=0;
-					surface->TextureCoords[0].t=0;
-					surface->VertexCoords[0].x=X;
-					surface->VertexCoords[0].y=y;
-
-					surface->TextureCoords[1].s=Image->ImageCoord[1].s;
-					surface->TextureCoords[1].t=0;
-					surface->VertexCoords[1].x=X+W;
-					surface->VertexCoords[1].y=y;
-
-					surface->TextureCoords[2].s=Image->ImageCoord[2].s;
-					surface->TextureCoords[2].t=Image->ImageCoord[2].t;
-					surface->VertexCoords[2].x=X+W;
-					surface->VertexCoords[2].y=y+Image->H;
-		 
-					surface->TextureCoords[3].s=0;
-					surface->TextureCoords[3].t=Image->ImageCoord[3].t;
-					surface->VertexCoords[3].x=X;
-					surface->VertexCoords[3].y=y+Image->H;
-				}
-
-				//last image (might be partial)
+			//we leave at least a portion of an image to the last part
+			//so that there will be less controls
+			int y=Y,ty=Y+H-Image->H;
+			//draw whole parts where image is texture repeated in
+			//x axis, we only need to draw multiple images for y axis
+			for(y=Y;y<ty;y+=Image->H) {
 				ColorizableSurface *surface=Surfaces.Add();
 				surface->Color.a=surface->Color.r=surface->Color.g=surface->Color.b=1;
 
@@ -1171,18 +1143,46 @@
 				surface->VertexCoords[1].y=y;
 
 				surface->TextureCoords[2].s=Image->ImageCoord[2].s;
-				surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
+				surface->TextureCoords[2].t=Image->ImageCoord[2].t;
 				surface->VertexCoords[2].x=X+W;
-				surface->VertexCoords[2].y=Y+H;
-	 
+				surface->VertexCoords[2].y=y+Image->H;
+
 				surface->TextureCoords[3].s=0;
-				surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
+				surface->TextureCoords[3].t=Image->ImageCoord[3].t;
 				surface->VertexCoords[3].x=X;
-				surface->VertexCoords[3].y=Y+H;
+				surface->VertexCoords[3].y=y+Image->H;
+			}
+
+			//last image (might be partial)
+			ColorizableSurface *surface=Surfaces.Add();
+			surface->Color.a=surface->Color.r=surface->Color.g=surface->Color.b=1;
+
+			surface->setTexture(Image);
+			surface->CreateTextureCoords();
+
+			surface->TextureCoords[0].s=0;
+			surface->TextureCoords[0].t=0;
+			surface->VertexCoords[0].x=X;
+			surface->VertexCoords[0].y=y;
+
+			surface->TextureCoords[1].s=Image->ImageCoord[1].s;
+			surface->TextureCoords[1].t=0;
+			surface->VertexCoords[1].x=X+W;
+			surface->VertexCoords[1].y=y;
+
+			surface->TextureCoords[2].s=Image->ImageCoord[2].s;
+			surface->TextureCoords[2].t=Image->ImageCoord[2].t*((float)(H-(y-Y))/Image->H);
+			surface->VertexCoords[2].x=X+W;
+			surface->VertexCoords[2].y=Y+H;
+
+			surface->TextureCoords[3].s=0;
+			surface->TextureCoords[3].t=Image->ImageCoord[3].t*((float)(H-(y-Y))/Image->H);
+			surface->VertexCoords[3].x=X;
+			surface->VertexCoords[3].y=Y+H;
 		}
 	}
 
-	void Basic2DRawGraphicsLayer::Draw(Byte *Image, int Width, int Height, gge::ColorMode Mode, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
+	void Basic2DRawGraphicsLayer::Draw(Byte *Image, int Width, int Height, ColorMode Mode, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4) {
 		RawSurface *surface=Surfaces.Add();
 
 		surface->Data=Image;
@@ -1264,14 +1264,14 @@
 			SetTexture(surface->Data, surface->Width, surface->Height, surface->Mode);
 
 			glBegin(GL_QUADS);
-				glTexCoord2fv(surface->TextureCoords[0].vect);
-				glVertex3fv(surface->VertexCoords[0].vect);
-				glTexCoord2fv(surface->TextureCoords[1].vect);
-				glVertex3fv(surface->VertexCoords[1].vect);
-				glTexCoord2fv(surface->TextureCoords[2].vect);
-				glVertex3fv(surface->VertexCoords[2].vect);
-				glTexCoord2fv(surface->TextureCoords[3].vect);
-				glVertex3fv(surface->VertexCoords[3].vect);
+			glTexCoord2fv(surface->TextureCoords[0].vect);
+			glVertex3fv(surface->VertexCoords[0].vect);
+			glTexCoord2fv(surface->TextureCoords[1].vect);
+			glVertex3fv(surface->VertexCoords[1].vect);
+			glTexCoord2fv(surface->TextureCoords[2].vect);
+			glVertex3fv(surface->VertexCoords[2].vect);
+			glTexCoord2fv(surface->TextureCoords[3].vect);
+			glVertex3fv(surface->VertexCoords[3].vect);
 			glEnd();
 		}
 
@@ -1284,7 +1284,7 @@
 		glPopMatrix();
 		trX-=X;
 		trY-=Y;
-		
+
 		if(EnableClipping) {
 			scX=pscX;
 			scY=pscY;
@@ -1303,30 +1303,4 @@
 		isVisible=true;
 		EnableClipping=false;
 	}
-	bool WidgetLayer::PropagateMouseEvent(MouseEventType event, int x, int y, void *data) {
-		if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H) || (event&MOUSE_EVENT_UP) || (pressedObject && event&MOUSE_EVENT_MOVE)) ) {
-			if(LayerBase::PropagateMouseEvent(event, x, y, data))
-				return true;
-
-			if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H) || (event&MOUSE_EVENT_UP) || (pressedObject->parent==this && event&MOUSE_EVENT_MOVE)) )
-				return BasicPointerTarget::PropagateMouseEvent(event, x-X, y-Y, data);
-			else
-				return false;
-		}
-
-		return false;
-	}
-	bool WidgetLayer::PropagateMouseScrollEvent(int amount, MouseEventType event, int x, int y, void *data) {
-		if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H)) ) {
-			if(LayerBase::PropagateMouseScrollEvent(amount, event, x, y, data))
-				return true;
-
-			if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H)) )
-				return BasicPointerTarget::PropagateMouseScrollEvent(amount, event, x-X, y-Y, data);
-			else
-				return false;
-		}
-
-		return false;
-	}
-}
+} }
--- a/Engine/GraphicLayers.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/GraphicLayers.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include "../Utils/PAClassList.h"
 #include "Graphics.h"
 
-namespace gge {
+namespace gge { namespace graphics {
 	////_private
 	struct ColorizableSurface : public BasicSurface {
 		RGBfloat Color; 
@@ -133,18 +133,5 @@
 		////Clear the contents of the layer
 		virtual void Clear() { Surfaces.Clear(); }
 	};
-	class WidgetLayer :  public input::BasicPointerTarget, public Basic2DLayer {
-	public:
-		WidgetLayer(int X=0, int Y=0, int W=100, int H=100) : Basic2DLayer(X,Y,W,H) {
-		}
-		////Renders this layer
-		virtual void Render() { Basic2DLayer::Render(); }
 
-	protected:
-		////Processes the mouse event for the current layer, default
-		/// handling is to pass the request to the sub-layers
-		virtual bool PropagateMouseEvent(input::MouseEventType event, int x, int y, void *data);
-		virtual bool PropagateMouseScrollEvent(int amount, input::MouseEventType event, int x, int y, void *data);
-	};
-
-}
\ No newline at end of file
+} }
--- a/Engine/Graphics.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Graphics.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,13 +3,13 @@
 #include <windows.h>
 
 #endif
-namespace gge {
+namespace gge { namespace graphics {
 	Point ScreenSize;
 	extern RGBfloat CurrentLayerColor;
 	extern int scX,scY,scW,scH;
 	extern int trX,trY;
 
-	os::DeviceHandle InitializeGraphics(os::WindowHandle hWnd, int BitDepth, int Width, int Height) {
+	os::DeviceHandle Initialize(os::WindowHandle hWnd, int BitDepth, int Width, int Height) {
 		///!Platform specific
 #ifdef WIN32
 		///*Preparing device context, platform specific
@@ -196,23 +196,7 @@
 		glDeleteTextures(1, &texture->ID);
 		texture->ID=0;
 	}
-	void GLTexture::CalcuateCoordinates(int cx,int cy) {
-		W=cx;
-		H=cy;
-		TW=sl2(cx);//+0.0001
-		TH=sl2(cy);//+0.0001
-		S=(float)cx/TW;
-		T=(float)cy/TH;
 
-		ImageCoord[0].s=0;
-		ImageCoord[0].t=0;
-		ImageCoord[1].s=S;
-		ImageCoord[1].t=0;
-		ImageCoord[2].s=S;
-		ImageCoord[2].t=T;
-		ImageCoord[3].s=0;
-		ImageCoord[3].t=T;
-	}
 	GLenum getGLColorMode(ColorMode color_mode) {
 		switch(color_mode) {
 		case ALPHAONLY_8BPP:
@@ -256,4 +240,4 @@
 		///*Swapping back and front buffers
 		SwapBuffers( (HDC)hDC );
 	}
-}
+} }
--- a/Engine/Graphics.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Graphics.h	Thu Apr 21 01:53:15 2011 +0000
@@ -2,9 +2,11 @@
 
 #include "../Utils/GGE.h"
 #include "OS.h"
+
 #define WINGDIAPI	__declspec(dllimport)
 #define APIENTRY	__stdcall
 #define CALLBACK	__stdcall
+
 #include <gl/gl.h>
 #include <gl/glu.h>
 #include <assert.h>
@@ -12,13 +14,17 @@
 #include "../Utils/ManagedBuffer.h"
 
 #ifndef GL_BGR
-#define GL_BGR	0x80E0
-#define GL_BGRA	0x80E1
+#	define GL_BGR	0x80E0
+#	define GL_BGRA	0x80E1
+#endif
+
+#ifndef PI
+#	define PI	3.1415926535898f
 #endif
 
 
 ////Namespace for Gorgon Game Engine
-namespace gge {
+namespace gge { namespace graphics {
 	union TexturePosition { struct{float s,t;}; float vect[2];};
 	union VertexPosition { struct{float x,y,z;};float vect[3];};
 
@@ -38,18 +44,40 @@
 		ARGB_32BPP = RGB | ALPHA,
 		////4-byte revered RGB color with alpha
 		ABGR_32BPP = BGR | ALPHA,
-		////1-byte palletted color mode, is not available yet
+		////1-byte palleted color mode, is not available yet
 		PALLETTED_8BPP = PALLETTED,
 		////2-byte palleted color mode with alpha, is not available yet
 		APALLETTED_16BPP = PALLETTED | ALPHA,
 		////1-byte alpha only color mode, converted to AGRAYSCALE_16BPP
 		ALPHAONLY_8BPP = ALPHA,
-		////1-byte gray (luminiance) only color mode, is not available yet
+		////1-byte gray (luminance) only color mode, is not available yet
 		GRAYSCALE_8BPP = GRAY,
-		////2-byte gray (luminiance) color mode with alpha
+		////2-byte gray (luminance) color mode with alpha
 		AGRAYSCALE_16BPP = GRAY | ALPHA
 	};
 
+	////Logarithm Base 2
+	inline int log2(int num) {
+		int i=0;
+		int s=1;
+		while(num-s>0) {
+			i++;
+			s<<=1;
+		}
+
+		return i;
+	}
+
+	////Rounds the given number to the lowest 2^n (where n is integer) number 
+	/// that is higher than the given number
+	inline int sl2(int num) {
+		int s=1;
+		while(num-s>0) {
+			s<<=1;
+		}
+
+		return s;
+	}
 
 
 	////This structure contains all necessary information
@@ -79,7 +107,23 @@
 
 		////Calculates the necessary coordinates from
 		/// the give image size
-		void CalcuateCoordinates(int W,int H);
+		void CalcuateCoordinates(int W,int H) {
+			this->W=W;
+			this->H=H;
+			TW=sl2(W);//+0.0001
+			TH=sl2(H);//+0.0001
+			S=(float)W/TW;
+			T=(float)H/TH;
+
+			ImageCoord[0].s=0;
+			ImageCoord[0].t=0;
+			ImageCoord[1].s=S;
+			ImageCoord[1].t=0;
+			ImageCoord[2].s=S;
+			ImageCoord[2].t=T;
+			ImageCoord[3].s=0;
+			ImageCoord[3].t=T;
+		}
 	};
 
 	union RGBfloat {
@@ -366,27 +410,6 @@
 	inline RGBint ToRGBint(unsigned int argb) { RGBint r(argb); return r; }
 	////Converts an int color to RGBint structure
 	inline RGBint ToRGBint(int argb) { RGBint r(argb); return r; }
-	////Logarithm Base 2
-	inline int log2(int num) {
-		int i=0;
-		int s=1;
-		while(num-s>0) {
-			i++;
-			s<<=1;
-		}
-
-		return i;
-	}
-
-	////Rounds the given number to the lowest 2^n (where n is integer) number that is higher than the given number
-	inline int sl2(int num) {
-		int s=1;
-		while(num-s>0) {
-			s<<=1;
-		}
-
-		return s;
-	}
 
 	////Returns the Bytes required for a given color mode
 	inline int getBPP(ColorMode color_mode) {
@@ -405,8 +428,8 @@
 		}
 	}
 
-	///This interface defines a class that can be used
-	///as a common drawing target
+	////This interface defines a class that can be used
+	/// as a common drawing target
 	class I2DGraphicsTarget {
 	public:
 		////Draws a simple image to the screen.
@@ -441,7 +464,7 @@
 		///@Image	: image texture to be drawn, this can be obtained
 		/// using generate texture function
 		virtual void DrawHTiled(GLTexture *Image,int X,int Y,int W,int H)=0;
-		////Draws a veritically tiled image to the screen
+		////Draws a vertically tiled image to the screen
 		///@Image	: image texture to be drawn, this can be obtained
 		/// using generate texture function
 		///@W		: the width of the image to be drawn
@@ -768,7 +791,7 @@
 	/// returns created device context
 	///@hWnd		: Handle for the target window
 	///@BitDepth	: Used if fullscreen, changed bitdepth of screen
-	os::DeviceHandle InitializeGraphics(os::WindowHandle hWnd, int BitDepth, int Width, int Height);
+	os::DeviceHandle Initialize(os::WindowHandle hWnd, int BitDepth, int Width, int Height);
 	////Creates rectangle structure based on give parameters
 	//RECT makerect(int x, int y, int w, int h);
 	////Converts Alpha only image to Alpha and Luminance (grayscale) image.
@@ -800,4 +823,4 @@
 	void PostRender(os::DeviceHandle Device);
 
 	extern Point ScreenSize;
-}
+} }
--- a/Engine/Layer.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Layer.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -4,7 +4,10 @@
 using namespace gge::utils;
 
 namespace gge {
-	extern int trX,trY;
+	namespace graphics {
+		extern int trX,trY;
+	}
+	using namespace graphics;
 
 	bool InputLayer::PropagateMouseEvent(input::MouseEventType event, int x, int y, void *data) {
 		if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H) || (event&MOUSE_EVENT_UP) || (pressedObject && event&MOUSE_EVENT_MOVE)) ) {
--- a/Engine/Pointer.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Pointer.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -9,6 +9,8 @@
 #include "../Resource/GRE.h"
 #include "OS.h"
 
+using namespace gge::resource;
+
 namespace gge {
 
 	void PointerCollection::Window_Activate() {
@@ -46,7 +48,7 @@
 	}
 
 	void PointerCollection::Initialize(GGEMain &Main) {
-		PointerLayer=dynamic_cast<Basic2DLayer*>(Main.Add( new Basic2DLayer(0, 0, Main.getWidth(), Main.getHeight()) , -100 ));
+		PointerLayer=dynamic_cast<graphics::Basic2DLayer*>(Main.Add( new graphics::Basic2DLayer(0, 0, Main.getWidth(), Main.getHeight()) , -100 ));
 
 		os::window::Activated.Register(this, &PointerCollection::Window_Activate);
 		os::window::Deactivated.Register(this, &PointerCollection::Window_Deactivate);
@@ -81,7 +83,7 @@
 			BasePointer=(*this)[0];
 	}
 
-	Pointer *PointerCollection::Add(Buffered2DGraphic *pointer, Point Hotspot, Pointer::PointerTypes Type) {
+	Pointer *PointerCollection::Add(graphics::Buffered2DGraphic *pointer, Point Hotspot, Pointer::PointerTypes Type) {
 		Pointer *ret=new Pointer(pointer, Hotspot.x, Hotspot.y, Type);
 		utils::Collection<Pointer, 10>::Add( ret );
 		return ret;
--- a/Engine/Pointer.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Engine/Pointer.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,13 +4,10 @@
 #include "../Utils/LinkedList.h"
 #include "Graphics.h"
 
-namespace gre { class FolderResource; }
-
-using namespace gre;
-
 namespace gge {
 	class GGEMain;
-	class Basic2DLayer;
+	namespace graphics { class Basic2DLayer; }
+	namespace resource { class FolderResource; }
 
 
 	class Pointer {
@@ -35,14 +32,14 @@
 		};
 
 		////The image of the pointer
-		Buffered2DGraphic *Image;
+		graphics::Buffered2DGraphic *Image;
 		////Point of click
 		Point Hotspot;
 		////Type of the pointer
 		PointerTypes Type;
 
 		////Initializes a pointer
-		Pointer(Buffered2DGraphic *pointer, int HotspotX, int HotspotY, PointerTypes Type) {
+		Pointer(graphics::Buffered2DGraphic *pointer, int HotspotX, int HotspotY, PointerTypes Type) {
 			this->Image=pointer;
 			this->Hotspot.x=HotspotX;
 			this->Hotspot.y=HotspotY;
@@ -50,7 +47,7 @@
 		}
 
 		////Initializes a pointer
-		Pointer(Buffered2DGraphic &pointer, Point Hotspot, PointerTypes Type) {
+		Pointer(graphics::Buffered2DGraphic &pointer, Point Hotspot, PointerTypes Type) {
 			this->Image=&pointer;
 			this->Hotspot=Hotspot;
 			this->Type=Type;
@@ -66,12 +63,12 @@
 		/// 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(FolderResource *Folder);
-		void Fetch(FolderResource &Folder) { Fetch(&Folder); }
+		void Fetch(resource::FolderResource *Folder);
+		void Fetch(resource::FolderResource &Folder) { Fetch(&Folder); }
 		////Adds a pointer to the list of pointers
-		Pointer *Add(Buffered2DGraphic *Pointer, Point Hotspot=Point(2,2), Pointer::PointerTypes Type=Pointer::None);
+		Pointer *Add(graphics::Buffered2DGraphic *Pointer, Point Hotspot=Point(2,2), Pointer::PointerTypes Type=Pointer::None);
 		////Adds a pointer to the list of pointers
-		Pointer &Add(Buffered2DGraphic &Pointer, Point Hotspot=Point(2,2), Pointer::PointerTypes Type=Pointer::None) {
+		Pointer &Add(graphics::Buffered2DGraphic &Pointer, Point Hotspot=Point(2,2), Pointer::PointerTypes Type=Pointer::None) {
 			return *Add(&Pointer, Hotspot, Type);
 		}
 		////Sets the given pointer as current one, this operation should be revered by
@@ -99,7 +96,7 @@
 
 	protected:
 		utils::LinkedList<Pointer> ActivePointers;
-		Basic2DLayer *PointerLayer;
+		graphics::Basic2DLayer *PointerLayer;
 		Pointer *BasePointer;
 		bool PointerVisible;
 		bool OSPointerVisible;
--- a/Resource/AnimationResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/AnimationResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,7 +2,7 @@
 #include "ResourceFile.h"
 #include "ImageResource.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	ResourceBase *LoadAnimationResource(ResourceFile* File, FILE* Data, int Size) {
 		AnimationResource *anim=new AnimationResource;
 
@@ -48,7 +48,7 @@
 		else
 			Pause();
 	}
-	void ImageAnimation::DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, gge::Alignment Align) {
+	void ImageAnimation::DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, gge::Alignment Align) {
 
 		int h=this->Height(H);
 		int w=this->Width(W);
@@ -88,4 +88,4 @@
 		
 			return VerticalTiling.Calculate(parent->getHeight(), H); 
 		}
-}
+} }
--- a/Resource/AnimationResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/AnimationResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,7 @@
 #include "ImageResource.h"
 #include "../Resource/ResizableObject.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 	
 	////This function loads a text resource from the given file
@@ -15,7 +15,7 @@
 	class AnimationResource;
 
 	////This class draws an animated image
-	class ImageAnimation : public DiscreteAnimatorBase, public Buffered2DGraphic, public ResizableObject {
+	class ImageAnimation : public DiscreteAnimatorBase, public graphics::Buffered2DGraphic, public ResizableObject {
 		friend class AnimationResource;
 	public:
 	protected:
@@ -47,53 +47,53 @@
 		virtual void Pause() { DiscreteAnimatorBase::Pause(); }
 		virtual void setLoop(bool Loop) { islooping=Loop; }
 		virtual int getDuration() { return DiscreteAnimatorBase::duration; }
-		virtual void Draw(I2DGraphicsTarget *Target,int X,int Y) { 
+		virtual void Draw(graphics::I2DGraphicsTarget *Target,int X,int Y) { 
 			Draw(Target, X, Y, Texture.W, Texture.H);
 		}
-		void Draw(I2DGraphicsTarget &Target,int X,int Y) { Draw(&Target, X,Y); }
+		void Draw(graphics::I2DGraphicsTarget &Target,int X,int Y) { Draw(&Target, X,Y); }
 
-		virtual void Draw(I2DGraphicsTarget *Target,int X,int Y,int W,int H) { 
+		virtual void Draw(graphics::I2DGraphicsTarget *Target,int X,int Y,int W,int H) { 
 			if(Texture.ID)
-				Buffered2DGraphic::Draw(Target, X, Y, W, H);
+				graphics::Buffered2DGraphic::Draw(Target, X, Y, W, H);
 		}
-		void Draw(I2DGraphicsTarget &Target,int X,int Y,int W,int H) { Draw(&Target, X,Y, W,H); }
+		void Draw(graphics::I2DGraphicsTarget &Target,int X,int Y,int W,int H) { Draw(&Target, X,Y, W,H); }
 
-		virtual void Draw(I2DGraphicsTarget *Target,int X1,int Y1, int X2,int Y2, int X3,int Y3, int X4, int Y4) { 
+		virtual void Draw(graphics::I2DGraphicsTarget *Target,int X1,int Y1, int X2,int Y2, int X3,int Y3, int X4, int Y4) { 
 			if(Texture.ID)
 				Buffered2DGraphic::Draw(Target, X1, Y1, X2, Y2, X3, Y3, X4, Y4);
 		}
-		void Draw(I2DGraphicsTarget &Target,int X1,int Y1, int X2,int Y2, int X3,int Y3, int X4, int Y4) { Draw(&Target, X1,Y1, X2,Y2, X3,Y3, X4,Y4); }
+		void Draw(graphics::I2DGraphicsTarget &Target,int X1,int Y1, int X2,int Y2, int X3,int Y3, int X4, int Y4) { Draw(&Target, X1,Y1, X2,Y2, X3,Y3, X4,Y4); }
 
-		virtual void DrawTiled(I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
+		virtual void DrawTiled(graphics::I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
 			if(Texture.ID)
-				Buffered2DGraphic::DrawTiled(Target, X, Y, W, H);
+				graphics::Buffered2DGraphic::DrawTiled(Target, X, Y, W, H);
 		}
-		void DrawTiled(I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawTiled(&Target, X,Y, W,H); }
-		virtual void DrawResized(TilingDirection Tiling, I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
+		void DrawTiled(graphics::I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawTiled(&Target, X,Y, W,H); }
+		virtual void DrawResized(TilingDirection Tiling, graphics::I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
 			if(Texture.ID)
-				Buffered2DGraphic::DrawResized(Tiling, Target, X, Y, W, H);
+				graphics::Buffered2DGraphic::DrawResized(Tiling, Target, X, Y, W, H);
 		}
-		virtual void DrawResized(TilingDirection Tiling, I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawResized(Tiling, &Target, X,Y, W,H); }
+		virtual void DrawResized(TilingDirection Tiling, graphics::I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawResized(Tiling, &Target, X,Y, W,H); }
 
-		virtual void DrawHTiled(I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
+		virtual void DrawHTiled(graphics::I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
 			if(Texture.ID)
-				Buffered2DGraphic::DrawHTiled(Target, X, Y, W, H);
+				graphics::Buffered2DGraphic::DrawHTiled(Target, X, Y, W, H);
 		}
-		void DrawHTiled(I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawHTiled(&Target, X,Y, W,H); }
+		void DrawHTiled(graphics::I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawHTiled(&Target, X,Y, W,H); }
 
-		virtual void DrawVTiled(I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
+		virtual void DrawVTiled(graphics::I2DGraphicsTarget *Target,int X,int Y, int W, int H) { 
 			if(Texture.ID)
-				Buffered2DGraphic::DrawVTiled(Target, X, Y, W, H);
+				graphics::Buffered2DGraphic::DrawVTiled(Target, X, Y, W, H);
 		}
-		void DrawVTiled(I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawVTiled(&Target, X,Y, W,H); }
+		void DrawVTiled(graphics::I2DGraphicsTarget &Target,int X,int Y, int W, int H) { DrawVTiled(&Target, X,Y, W,H); }
 
 
 		virtual int  Width(int W=-1);
 		virtual int  Height(int H=-1);
 
 	public:
-		virtual void DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
-		virtual void DrawResized(I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) { DrawResized(&Target, X,Y ,W,H, Align); }
+		virtual void DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
+		virtual void DrawResized(graphics::I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) { DrawResized(&Target, X,Y ,W,H, Align); }
 
 		ResizableObject::Tiling HorizontalTiling;
 		ResizableObject::Tiling VerticalTiling;
@@ -146,4 +146,4 @@
 		////Frame durations
 		int *Durations;
 	};
-}
\ No newline at end of file
+} }
--- a/Resource/BitmapFontResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/BitmapFontResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -5,8 +5,8 @@
 #define MAX_CHAR_DETECTS	10
 #endif
 
-namespace gre {
-	ResourceBase *LoadBitmapFontResource(ResourceFile* File, FILE* Data, int Size) {
+namespace gge { namespace resource {
+	ResourceBase *LoadBitmapFontResource(resource::ResourceFile* File, FILE* Data, int Size) {
 		BitmapFontResource *font=new BitmapFontResource;
 		int chmap[256];
 		int cpos=0,i;
@@ -44,7 +44,7 @@
 
 		return font;
 	}
-	void BitmapFontResource::Print(I2DColorizableGraphicsTarget *target, int X, int Y, string text, RGBint color, ShadowParams Shadow) {
+	void BitmapFontResource::Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, string text, graphics::RGBint color, ShadowParams Shadow) {
 		if(text=="") return;
 
 		unsigned int i;
@@ -63,7 +63,7 @@
 		}
 	}
 
-	void BitmapFontResource::Print(I2DColorizableGraphicsTarget *target, int x, int y, int w, string text, RGBint color, TextAlignment align, ShadowParams Shadow) {
+	void BitmapFontResource::Print(graphics::I2DColorizableGraphicsTarget *target, int x, int y, int w, string text, graphics::RGBint color, TextAlignment align, ShadowParams Shadow) {
 		int i;
 		int l=x;
 		int lstart=0,lword=0;
@@ -144,7 +144,7 @@
 						l+=img->getWidth()+Seperator;
 					}
 				}
-				
+
 				if(text[lword+1]=='\n')
 					lword++;
 
@@ -156,7 +156,7 @@
 			}
 		}
 	}
-	void BitmapFontResource::Print(I2DColorizableGraphicsTarget *target, int x, int y, int w, string text, RGBint color, EPrintData *Data, int DataLen, TextAlignment Align, ShadowParams Shadow) {
+	void BitmapFontResource::Print(graphics::I2DColorizableGraphicsTarget *target, int x, int y, int w, string text, graphics::RGBint color, EPrintData *Data, int DataLen, TextAlignment Align, ShadowParams Shadow) {
 		if(text=="") {
 			int d;
 			int xpos=0;
@@ -167,14 +167,14 @@
 
 			for(d=0;d<DataLen;d++) {
 				switch(Data[d].Type) {
-					case EMT_PositionDetect:
-						Data[d].Out.position.x=xpos;
-						Data[d].Out.position.y=0;
-						break;
-					case EMT_Spacing:
-						Data[d].Out.position.x=xpos;
-						Data[d].Out.position.y=0;
-						break;
+				case EMT_PositionDetect:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				case EMT_Spacing:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
 				}
 			}
 			return;
@@ -197,20 +197,20 @@
 		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 EMT_Wrap:
-					nowrap=!Data[d].In.value;
-					break;
-				case EMT_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;
+			case EMT_Wrap:
+				nowrap=!Data[d].In.value;
+				break;
+			case EMT_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;
 			}
 		}
 
@@ -233,10 +233,10 @@
 			for(d=0;d<DataLen;d++) {
 				if(Data[d].CharPosition==i) {
 					switch(Data[d].Type) {
-						case EMT_Spacing:
-							llen+=Data[d].In.position.x-Seperator; 
-							y+=Data[d].In.position.y; 
-							break;
+					case EMT_Spacing:
+						llen+=Data[d].In.position.x-Seperator; 
+						y+=Data[d].In.position.y; 
+						break;
 					}
 				}
 			}
@@ -288,25 +288,25 @@
 					for(d=0;d<DataLen;d++) {
 						if(Data[d].CharPosition==j) {
 							switch(Data[d].Type) {
-								case EMT_Spacing:
-									Data[d].Out.position.x=l-sx;
-									Data[d].Out.position.y=y-sy;
+							case EMT_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 EMT_PositionDetect:
-									Data[d].Out.position.x=l-sx;
-									Data[d].Out.position.y=y-sy;
-									break;
-								case EMT_Color:
-									color=Data[d].In.color;
+								l+=Data[d].In.position.x-Seperator; 
+								y+=Data[d].In.position.y; 
+								break;
+							case EMT_PositionDetect:
+								Data[d].Out.position.x=l-sx;
+								Data[d].Out.position.y=y-sy;
+								break;
+							case EMT_Color:
+								color=Data[d].In.color;
 
-									break;
-								case EMT_ShadowColor:
-									Shadow.Color=Data[d].In.color;
+								break;
+							case EMT_ShadowColor:
+								Shadow.Color=Data[d].In.color;
 
-									break;
+								break;
 							}
 						}
 					}
@@ -333,9 +333,9 @@
 						}
 					}
 					l+=dist;
-				
+
 				}
-				
+
 				if(text[lword+1]=='\n')
 					lword++;
 
@@ -350,17 +350,17 @@
 		for(d=0;d<DataLen;d++) {
 			if(Data[d].CharPosition==i) {
 				switch(Data[d].Type) {
-					case EMT_Spacing:
-						Data[d].Out.position.x=l-sx;
-						Data[d].Out.position.y=y-sy;
+				case EMT_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 EMT_PositionDetect:
-						Data[d].Out.position.x=l-sx;
-						Data[d].Out.position.y=y-sy;
-						break;
+					l+=Data[d].In.position.x-Seperator; 
+					y+=Data[d].In.position.y; 
+					break;
+				case EMT_PositionDetect:
+					Data[d].Out.position.x=l-sx;
+					Data[d].Out.position.y=y-sy;
+					break;
 				}
 			}
 		}	}
@@ -375,14 +375,14 @@
 
 			for(d=0;d<DataLen;d++) {
 				switch(Data[d].Type) {
-					case EMT_PositionDetect:
-						Data[d].Out.position.x=xpos;
-						Data[d].Out.position.y=0;
-						break;
-					case EMT_Spacing:
-						Data[d].Out.position.x=xpos;
-						Data[d].Out.position.y=0;
-						break;
+				case EMT_PositionDetect:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
+				case EMT_Spacing:
+					Data[d].Out.position.x=xpos;
+					Data[d].Out.position.y=0;
+					break;
 				}
 			}
 			return;
@@ -405,20 +405,20 @@
 		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 EMT_Wrap:
-					nowrap=!Data[d].In.value;
-					break;
-				case EMT_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;
+			case EMT_Wrap:
+				nowrap=!Data[d].In.value;
+				break;
+			case EMT_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;
 			}
 		}
 
@@ -440,10 +440,10 @@
 			for(d=0;d<DataLen;d++) {
 				if(Data[d].CharPosition==i) {
 					switch(Data[d].Type) {
-						case EMT_Spacing:
-							llen+=Data[d].In.position.x-Seperator; 
-							y+=Data[d].In.position.y; 
-							break;
+					case EMT_Spacing:
+						llen+=Data[d].In.position.x-Seperator; 
+						y+=Data[d].In.position.y; 
+						break;
 					}
 				}
 			}
@@ -495,23 +495,23 @@
 					for(d=0;d<DataLen;d++) {
 						if(Data[d].CharPosition==j) {
 							switch(Data[d].Type) {
-								case EMT_Spacing:
-									Data[d].Out.position.x=l-sx;
-									Data[d].Out.position.y=y-sy;
+							case EMT_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 EMT_PositionDetect:
-									Data[d].Out.position.x=l-sx;
-									Data[d].Out.position.y=y-sy;
-									break;
-								case EMT_Color:
+								l+=Data[d].In.position.x-Seperator; 
+								y+=Data[d].In.position.y; 
+								break;
+							case EMT_PositionDetect:
+								Data[d].Out.position.x=l-sx;
+								Data[d].Out.position.y=y-sy;
+								break;
+							case EMT_Color:
 
-									break;
-								case EMT_ShadowColor:
+								break;
+							case EMT_ShadowColor:
 
-									break;
+								break;
 							}
 						}
 					}
@@ -533,9 +533,9 @@
 						}
 					}
 					l+=dist;
-				
+
 				}
-				
+
 				if(text[lword+1]=='\n')
 					lword++;
 
@@ -550,18 +550,19 @@
 		for(d=0;d<DataLen;d++) {
 			if(Data[d].CharPosition==i) {
 				switch(Data[d].Type) {
-					case EMT_Spacing:
-						Data[d].Out.position.x=l-sx;
-						Data[d].Out.position.y=y-sy;
+				case EMT_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 EMT_PositionDetect:
-						Data[d].Out.position.x=l-sx;
-						Data[d].Out.position.y=y-sy;
-						break;
+					l+=Data[d].In.position.x-Seperator; 
+					y+=Data[d].In.position.y; 
+					break;
+				case EMT_PositionDetect:
+					Data[d].Out.position.x=l-sx;
+					Data[d].Out.position.y=y-sy;
+					break;
 				}
 			}
-		}	}
-}
+		}	
+	}
+} }
--- a/Resource/BitmapFontResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/BitmapFontResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include "ImageResource.h"
 #include "../Engine/FontRenderer.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 
 
@@ -35,7 +35,7 @@
 		/// An image might be used in more than one character.
 		ImageResource *Characters[256];
 
-		////Horizontal seperation distance between two characters
+		////Horizontal separation distance between two characters
 		short Seperator;
 		////Vertical spacing of this font, this value is multiplicative
 		/// where 1 is 100% of the character height.
@@ -43,22 +43,22 @@
 
 	//protected:
 		////Prints the given text to the target using given color.
-		virtual void Print(I2DColorizableGraphicsTarget *target, int X, int Y, string Text, RGBint Color, ShadowParams Shadow=ShadowParams());
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, 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(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams());
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, graphics::RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams());
 		////This method is extended to cover meta functionality for advanced text rendering
-		virtual void Print(I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams());
+		virtual void Print(graphics::I2DColorizableGraphicsTarget *target, int X, int Y, int W, string Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_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, string Text, EPrintData *Data, int DataLen, TextAlignment Align);
 
 
 
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, string Text, RGBint Color, ShadowParams Shadow=ShadowParams()) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, string Text, graphics::RGBint Color, ShadowParams Shadow=ShadowParams()) 
 		{ Print(&target, X, Y, Text, Color, Shadow); }
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams()) 
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, graphics::RGBint Color, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams()) 
 		{ Print(&target, X, Y, W, Text, Color, Align, Shadow); }
-		void Print(I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_LEFT, ShadowParams Shadow=ShadowParams())
+		void Print(graphics::I2DColorizableGraphicsTarget &target, int X, int Y, int W, string Text, graphics::RGBint Color, EPrintData *Data, int DataLen, TextAlignment Align=TEXTALIGN_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
@@ -73,4 +73,4 @@
 			return w; 
 		}
 	};
-}
\ No newline at end of file
+} }
\ No newline at end of file
--- a/Resource/DataResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/DataResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,7 +1,7 @@
 #include "DataResource.h"
 #include "ResourceFile.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	ResourceBase *LoadDataResource(ResourceFile* File, FILE* Data, int Size) {
 		DataResource *dat=new DataResource;
 		dat->file=File;
@@ -77,4 +77,4 @@
 		value=File->Root().FindObject(guid);
 	}
 
-}
+} }
--- a/Resource/DataResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/DataResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,9 @@
 #include "../Utils/Size2D.h"
 #include "../Engine/Font.h"
 
-namespace gre {
+#include <stdexcept>
+
+namespace gge { namespace resource {
 	class ResourceFile;
 	
 	////This function loads a text resource from the given file
@@ -111,8 +113,8 @@
 
 		LinkData(Guid *guid) : value(NULL) { this->guid=new Guid(*guid); }
 		operator ResourceBase *() { return value; }
-		operator ResourceBase &() { if(!value) throw runtime_error("Target is not set"); return *value; }
-		ResourceBase &Get() { if(!value) throw runtime_error("Target is not set"); 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(ResourceFile *File);
 	};
@@ -199,4 +201,4 @@
 	protected:
 		ResourceFile *file;
 	};
-}
\ No newline at end of file
+} }
--- a/Resource/FolderResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/FolderResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -13,7 +13,7 @@
 
 
 
-namespace gre {
+namespace gge { namespace resource {
 
 	ResourceBase *LoadFolderResource(ResourceFile* File, FILE* Data, int Size) {
 		int tpos=ftell(Data)+Size;
@@ -152,4 +152,4 @@
 			return dynamic_cast<BitmapFontResource*>(Subitems[Index]); 
 		}
 
-}
\ No newline at end of file
+} }
--- a/Resource/FolderResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/FolderResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,7 +3,7 @@
 #include "GRE.h"
 #include "ResourceBase.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 	class FolderResource;
 	class TextResource;
@@ -63,4 +63,4 @@
 			EntryPoint=-1;
 		}
 	};
-}
\ No newline at end of file
+} }
--- a/Resource/FontTheme.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/FontTheme.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,7 +1,7 @@
 #include "FontTheme.h"
 #include "ResourceFile.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	ResourceBase *LoadFontTheme(ResourceFile* File, FILE* Data, int Size) {
 		FontTheme *ft=new FontTheme;
 
@@ -46,4 +46,4 @@
 		H2Font		= dynamic_cast<FontRenderer*>(file->FindObject(guid_h2));
 		H3Font		= dynamic_cast<FontRenderer*>(file->FindObject(guid_h3));
 	}
-}
\ No newline at end of file
+} }
--- a/Resource/FontTheme.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/FontTheme.h	Thu Apr 21 01:53:15 2011 +0000
@@ -11,7 +11,7 @@
 #define		GID_FONTTHEME		0x03300000
 #define		GID_FONTTHEME_PROPS	0x03300804
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 
 	ResourceBase *LoadFontTheme(ResourceFile* File, FILE* Data, int Size);
@@ -169,4 +169,4 @@
 		ResourceFile *file;
 
 	};
-};
\ No newline at end of file
+} }
--- a/Resource/GRE.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/GRE.h	Thu Apr 21 01:53:15 2011 +0000
@@ -8,11 +8,8 @@
 #include <assert.h>
 #endif
 
-using namespace std;
-using namespace gge;
-
 ////This namespace contains Gorgon Resource System.
-namespace gre {
+namespace gge { 
 
 	////The Guid class is used for Guid operations
 	class Guid {
@@ -129,6 +126,8 @@
 		}
 	};
 
-	class ResourceFile;
-	class ResourceBase;
-}
\ No newline at end of file
+	namespace resource {
+		class ResourceFile;
+		class ResourceBase;
+	}
+}
--- a/Resource/ImageResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ImageResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,10 @@
 #include "../External/PNG/png.h"
 #include "../Engine/GGEMain.h"
 
-namespace gre {
+using namespace gge::resource;
+using namespace gge::graphics;
+
+namespace gge { namespace resource {
 	ResourceBase *LoadImageResource(ResourceFile* File, FILE* Data, int Size) {
 		int i;
 		ImageResource *img=new ImageResource;
@@ -14,7 +17,7 @@
 		int tpos=ftell(Data)+Size;
 		bool lateloading=0;
 		//BYTE *compressionprops;
-		gge::ColorMode m;
+		graphics::ColorMode m;
 
 		while(ftell(Data)<tpos) {
 			int gid,size,tmpint;
@@ -112,11 +115,11 @@
 						int channels=cinfo->num_components;
 
 						if(channels==3)
-							m=BGR;
+							m=graphics::BGR;
 						else if(channels==4)
-							m=ABGR_32BPP;
+							m=graphics::ABGR_32BPP;
 						else if(channels=1)
-							m=ALPHAONLY_8BPP;
+							m=graphics::ALPHAONLY_8BPP;
 
 						if(img->getMode()!=m)
 							throw std::runtime_error("Image data size mismatch!");
@@ -203,11 +206,11 @@
 			int channels=cinfo->num_components;
 
 			if(channels==3)
-				Mode=BGR;
+				Mode=graphics::BGR;
 			else if(channels==4)
-				Mode=ABGR_32BPP;
+				Mode=graphics::ABGR_32BPP;
 			else if(channels=1)
-				Mode=ALPHAONLY_8BPP;
+				Mode=graphics::ALPHAONLY_8BPP;
 
 			Data.Resize(getWidth()*getHeight()*channels);
 
@@ -247,7 +250,7 @@
 		if(Texture.ID>0)
 			DestroyTexture(&Texture);
 
-		Texture = gge::GenerateTexture(Data, getWidth(), getHeight(), getMode());
+		Texture = graphics::GenerateTexture(Data, getWidth(), getHeight(), getMode());
 	}
 
 	bool ImageResource::PNGExport(string filename) {
@@ -382,7 +385,7 @@
 		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
 
 
-		Resize(width,height,ColorMode::ARGB_32BPP);
+		Resize(width,height,graphics::ColorMode::ARGB_32BPP);
 
 		//currently only RGB is supported
 		if(pChannels!=3)
@@ -390,10 +393,10 @@
 
 		for(int y=0;y<height;y++) {
 			for(int x=0;x<width;x++) {
-				Raw2DGraphic::Data.operator []((x+y*width)*4+2)=row_pointers[y][x*3];
-				Raw2DGraphic::Data.operator []((x+y*width)*4+1)=row_pointers[y][x*3+1];
-				Raw2DGraphic::Data.operator []((x+y*width)*4+0)=row_pointers[y][x*3+2];
-				Raw2DGraphic::Data.operator []((x+y*width)*4+3)=0xff;
+				Raw2DGraphic::Data[(x+y*width)*4+2]=row_pointers[y][x*3];
+				Raw2DGraphic::Data[(x+y*width)*4+1]=row_pointers[y][x*3+1];
+				Raw2DGraphic::Data[(x+y*width)*4+0]=row_pointers[y][x*3+2];
+				Raw2DGraphic::Data[(x+y*width)*4+3]=0xff;
 			}
 		}
 		
@@ -438,4 +441,4 @@
 		}
 	}
 
-}
+} }
--- a/Resource/ImageResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ImageResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include "../Engine/Graphics.h"
 #include "ResizableObject.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 	
 	////This function loads a text resource from the given file
@@ -22,26 +22,27 @@
 
 	////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, public Colorizable2DGraphic, public Raw2DGraphic, public ResizableObject {
+	class ImageResource : public ResourceBase, public graphics::Colorizable2DGraphic, public graphics::Raw2DGraphic, public ResizableObject {
 		friend ResourceBase *LoadImageResource(ResourceFile* File, FILE* Data, int Size);
 	public:
 		////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 retrived by
+		/// 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() { 
-			Raw2DGraphic::Width=Raw2DGraphic::Height=0; 
-			isLoaded=LeaveData=false; Palette=NULL; Mode=ARGB_32BPP; 
+		ImageResource() {
+			graphics::Raw2DGraphic::Width=graphics::Raw2DGraphic::Height=0; 
+			isLoaded=LeaveData=false; Palette=NULL; 
+			Mode=graphics::ARGB_32BPP; 
 			SetResizingOptions(ResizableObject::Single,ResizableObject::Single);
 		}
 
-		ImageResource(int Width, int Height, ColorMode Mode=ARGB_32BPP) {
+		ImageResource(int Width, int Height, graphics::ColorMode Mode=graphics::ARGB_32BPP) {
 			isLoaded=LeaveData=true;
 			Palette=NULL;
 			this->Resize(Width, Height, Mode);
@@ -73,7 +74,7 @@
 		PNGReadError ImportPNG(string filename);
 
 		////Returns Bytes/Pixel information
-		int getBPP() { return gge::getBPP(Mode); }
+		int getBPP() { return graphics::getBPP(Mode); }
  
 		////Returns the width of the first image
 		int getWidth() { return Raw2DGraphic::Width; }
@@ -99,8 +100,8 @@
 			this->VerticalTiling=Vertical;
 		}
 
-		virtual void DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
-		virtual void DrawResized(I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) {
+		virtual void DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
+		virtual void DrawResized(graphics::I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) {
 			DrawResized(&Target, X,Y,W,H,Align);
 		}
 		virtual int  Width(int W=-1) { 
@@ -133,4 +134,4 @@
 		////Location of image data within the file, used for late loading
 		long DataLocation;
 	};
-}
\ No newline at end of file
+} }
--- a/Resource/LinkNode.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/LinkNode.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,7 +3,7 @@
 
 using namespace gge;
 
-namespace gre {
+namespace gge { namespace resource {
 	void LinkNodeResource::Resolve() {
 		ResourceBase *parent=File->Root().FindParent(guid);
 		File->Redirects.Add(new Redirect(*this->guid, target));
@@ -46,4 +46,4 @@
 		return link;
 	}
 
-}
\ No newline at end of file
+} }
--- a/Resource/LinkNode.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/LinkNode.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,7 +4,7 @@
 #include "ResourceBase.h"
 
 
-namespace gre {
+namespace gge { namespace resource {
 	class LinkNodeResource : public ResourceBase {
 		friend ResourceBase *LoadLinkNodeResource(ResourceFile* File, FILE* Data, int Size);
 	public:
@@ -24,4 +24,4 @@
 		ResourceFile* File;
 	};
 
-}
\ No newline at end of file
+} }
--- a/Resource/ResizableObject.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ResizableObject.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,7 @@
 #include "../Engine/Graphics.h"
 #include "../Resource/ResourceBase.h"
 
-namespace gre {
+namespace gge { namespace resource {
 
 	class ResourceFile;
 
@@ -144,10 +144,10 @@
 			return is;
 		}
 
-		virtual void DrawResized(gge::I2DGraphicsTarget *Target, int X, int Y, int W, int H, gge::Alignment Align=ALIGN_CENTER) =0;
-		virtual void DrawResized(gge::I2DGraphicsTarget &Target, int X, int Y, int W, int H, gge::Alignment Align=ALIGN_CENTER) { DrawResized(&Target, X, Y, W, H, Align); }
-		virtual void DrawResized(gge::I2DGraphicsTarget *Target, int X=0, int Y=0, gge::Alignment Align=ALIGN_CENTER) { DrawResized(Target, X, Y, Target->Width(), Target->Height(), Align); }
-		virtual void DrawResized(gge::I2DGraphicsTarget &Target, int X=0, int Y=0, gge::Alignment Align=ALIGN_CENTER) { DrawResized(&Target, X, Y, Target.Width(), Target.Height(), Align); }
+		virtual void DrawResized(gge::graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, gge::Alignment Align=ALIGN_CENTER) =0;
+		virtual void DrawResized(gge::graphics::I2DGraphicsTarget &Target, int X, int Y, int W, int H, gge::Alignment Align=ALIGN_CENTER) { DrawResized(&Target, X, Y, W, H, Align); }
+		virtual void DrawResized(gge::graphics::I2DGraphicsTarget *Target, int X=0, int Y=0, gge::Alignment Align=ALIGN_CENTER) { DrawResized(Target, X, Y, Target->Width(), Target->Height(), Align); }
+		virtual void DrawResized(gge::graphics::I2DGraphicsTarget &Target, int X=0, int Y=0, gge::Alignment Align=ALIGN_CENTER) { DrawResized(&Target, X, Y, Target.Width(), Target.Height(), Align); }
 		virtual int  Width(int W=-1)=0;
 		virtual int  Height(int H=-1)=0;
 		virtual void Reset(bool Reverse=false) {}
@@ -161,4 +161,4 @@
 		virtual ~ResizableObject() {}
 	};
 
-}
+} }
--- a/Resource/ResourceBase.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ResourceBase.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,6 +1,6 @@
 #include "ResourceBase.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	void ResourceBase::Prepare(GGEMain *main) {
 		utils::LinkedListIterator<ResourceBase>it=Subitems;
 		ResourceBase *resource;
@@ -64,4 +64,4 @@
 		Subitems.Destroy();
 	}
 
-}
\ No newline at end of file
+} }
--- a/Resource/ResourceBase.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ResourceBase.h	Thu Apr 21 01:53:15 2011 +0000
@@ -7,7 +7,7 @@
 
 using namespace gge;
 
-namespace gre {
+namespace gge { namespace resource {
 
 	////This class is the base for all Gorgon Resources
 	class ResourceBase {
@@ -47,4 +47,4 @@
 		////Searches the public children of this resource object
 		virtual ResourceBase *FindParent(Guid *guid);
 	};
-}
+} }
--- a/Resource/ResourceFile.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ResourceFile.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -9,7 +9,7 @@
 #include "LinkNode.h"
 #include "FontTheme.h"
 
-namespace gre {
+namespace gge { namespace resource {
 
 	bool ResourceFile::LoadFile(string filename) {
 		char sgn[7];
@@ -109,4 +109,4 @@
 		Loaders.Add(new ResourceLoader(GID_FONTTHEME, LoadFontTheme)); 
 		Loaders.Add(new ResourceLoader(GID_FONTTHEME, LoadFontTheme)); 
 	}
-}
\ No newline at end of file
+} }
--- a/Resource/ResourceFile.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/ResourceFile.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include "Definitions.h"
 #include "FolderResource.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	////This is Resource loader function prototype
 	typedef ResourceBase* (*ResourceLoaderFunction)(ResourceFile* File, FILE* Data, int Size);
 
@@ -101,4 +101,4 @@
 	};
 
 	inline void EatChunk(FILE *Data, int Size) { fseek(Data, Size, SEEK_CUR); }
-}
\ No newline at end of file
+} }
--- a/Resource/SoundResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/SoundResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,7 +2,7 @@
 #include "ResourceFile.h"
 #include "../External/LZMA/LzmaDecode.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	ResourceBase *LoadSoundResource(ResourceFile* File, FILE* Data, int Size) {
 		SoundResource *snd=new SoundResource;
 
@@ -61,4 +61,4 @@
 
 		return snd;
 	}
-}
+} }
--- a/Resource/SoundResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/SoundResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include "../Engine/Sound.h"
 #include "../Engine/Wave.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 	
 	////This function loads a sound resource from the given file
@@ -40,4 +40,4 @@
 
 		gge::sound::Wave *CreateWave() { return new gge::sound::Wave(Buffer); }
 	};
-}
\ No newline at end of file
+} }
--- a/Resource/TextResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/TextResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,7 +1,7 @@
 #include "TextResource.h"
 #include "ResourceFile.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	ResourceBase *LoadTextResource(ResourceFile* File, FILE* Data, int Size) {
 		char *tmpstr=new char[Size+1];
 
@@ -14,4 +14,4 @@
 
 		return txt;
 	}
-}
+} }
--- a/Resource/TextResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Resource/TextResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,7 +3,7 @@
 #include "GRE.h"
 #include "ResourceBase.h"
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
 	
 	////This function loads a text resource from the given file
@@ -23,4 +23,4 @@
 		////Currently does nothing
 		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
 	};
-}
\ No newline at end of file
+} }
\ No newline at end of file
--- a/Utils/BasicGraphics.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/BasicGraphics.h	Thu Apr 21 01:53:15 2011 +0000
@@ -1,23 +1,19 @@
 #pragma once
 
 #ifdef GRAPH_USEDOUBLE
-	#define graphtype double
-	#define sinfn	sin
-	#define cosfn	cos
-	#define tanfn	tan
-	#define atanfn	atan
+namespace gge {
+#	define graphtype double
+}
 
-	#ifndef PI
-		#define PI	3.1415926535898
-	#endif
+#	ifndef PI
+#		define PI	3.1415926535898
+#	endif
 #else
-	#define graphtype float
-	#define sinfn	sinf
-	#define cosfn	cosf
-	#define tanfn	tanf
-	#define atanfn	atanf
+namespace gge {
+#	define graphtype float
+}
 
-	#ifndef PI
-		#define PI	3.1415926535898f
-	#endif
+#	ifndef PI
+#		define PI	3.1415926535898f
+#	endif
 #endif
--- a/Utils/Binary.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/Binary.h	Thu Apr 21 01:53:15 2011 +0000
@@ -1,16 +1,28 @@
+//DESCRIPTION
+//	This file allows programmers to use binary numbers. These numbers
+//	are parsed at compile time
+
+//REQUIRES:
+//	---
+
+//LICENSE
+//	Public Domain
+//
+//	This program is distributed in the hope that it will be useful,
+//	but WITHOUT ANY WARRANTY; without even the implied warranty of
+//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+//AUTHOR
+//	Tom Torfs
 #pragma once
 
 
-/* Binary constant generator macro
-By Tom Torfs - donated to the public domain
-*/
-
 /* All macro's evaluate to compile-time constants */
 
 /* *** helper macros *** /
 
 /* turn a numeric literal into a hex constant
-(avoids problems with leading zeroes)
+(avoids problems with leading zeros)
 8-bit constants max value 0x11111111, always fits in unsigned long
 */
 #define HEX__(n) 0x##n##LU
@@ -27,14 +39,14 @@
 
 /* *** user macros *** /
 
-/* for upto 8-bit binary constants */
+/* for up to 8-bit binary constants */
 #define B8(d) ((unsigned char)B8__(HEX__(d)))
 
-/* for upto 16-bit binary constants, MSB first */
+/* for up to 16-bit binary constants, MSB first */
 #define B16(dmsb,dlsb) (((unsigned short)B8(dmsb)<<8) \
 + B8(dlsb))
 
-/* for upto 32-bit binary constants, MSB first */
+/* for up to 32-bit binary constants, MSB first */
 #define B32(dmsb,db2,db3,dlsb) (((unsigned long)B8(dmsb)<<24) \
 + ((unsigned long)B8(db2)<<16) \
 + ((unsigned long)B8(db3)<<8) \
--- a/Utils/Bounds2D.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/Bounds2D.h	Thu Apr 21 01:53:15 2011 +0000
@@ -1,3 +1,27 @@
+//DESCRIPTION
+//	This file contains the class Bounds2D which defines bounds of an object
+//	with left,top ; right,bottom coordinates. This class can be converted
+//	to rectangle class (top,left ; width,height)
+
+//REQUIRES:
+//	---
+
+//LICENSE
+//	This program is free software: you can redistribute it and/or modify
+//	it under the terms of the Lesser GNU General Public License as published by
+//	the Free Software Foundation, either version 3 of the License, or
+//	(at your option) any later version.
+//
+//	This program is distributed in the hope that it will be useful,
+//	but WITHOUT ANY WARRANTY; without even the implied warranty of
+//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//	Lesser GNU General Public License for more details.
+//
+//	You should have received a copy of the Lesser GNU General Public License
+//	along with this program. If not, see < http://www.gnu.org/licenses/ >.
+
+//COPYRIGHT
+//	Cem Kalyoncu, DarkGaze.Org (cemkalyoncu[at]gmail[dot]com)
 #pragma once
 
 #include <iostream>
@@ -26,42 +50,42 @@
 
 namespace gge {
 #ifndef RECTANGLE2D_EXISTS
-	template <class _T> class basic_Rectangle2D;
+	template <class T_> class basic_Rectangle2D;
 #endif
 
-	template <class _T>
+	template <class T_>
 	class basic_Bounds2D {
 	public:
-		_T Left,Top , Right,Bottom;
+		T_ Left,Top , Right,Bottom;
 		
 		basic_Bounds2D() {}
-		basic_Bounds2D(_T Left, _T Top, _T Right, _T Bottom) {
+		basic_Bounds2D(T_ Left, T_ Top, T_ Right, T_ Bottom) {
 			this->Left=Left;
 			this->Right=Right;
 			this->Top=Top;
 			this->Bottom=Bottom;
 		}
-		basic_Bounds2D(basic_Point2D<_T> TopLeft, basic_Point2D<_T> BottomRight) {
+		basic_Bounds2D(basic_Point2D<T_> TopLeft, basic_Point2D<T_> BottomRight) {
 			this->Left=TopLeft.x;
 			this->Top=TopLeft.y;
 			this->Right=BottomRight.x;
 			this->Bottom=BottomRight.y;
 		}
-		basic_Bounds2D(basic_Point2D<_T> TopLeft, basic_Size2D<_T> HeightWidth) {
+		basic_Bounds2D(basic_Point2D<T_> TopLeft, basic_Size2D<T_> HeightWidth) {
 			this->Left=TopLeft.x;
 			this->Top=TopLeft.y;
 			this->Right=TopLeft.x+HeightWidth.x;
 			this->Bottom=TopLeft.y+HeightWidth.y;
 		}
-		basic_Bounds2D(basic_Point2D<_T> TopLeft, int Width, int Height) {
+		basic_Bounds2D(basic_Point2D<T_> TopLeft, int Width, int Height) {
 			this->Left=TopLeft.x;
 			this->Top=TopLeft.y;
 			this->Right=TopLeft.x+Width;
 			this->Bottom=TopLeft.y+Height;
 		}
-		basic_Bounds2D(const basic_Rectangle2D<_T> &bounds);
+		basic_Bounds2D(const basic_Rectangle2D<T_> &bounds);
 
-		operator basic_Rectangle2D<_T>();
+		operator basic_Rectangle2D<T_>();
 
 		operator std::string() {
 			std::ostringstream str;
@@ -70,20 +94,20 @@
 			return str.str();
 		}
 
-		basic_Bounds2D& operator =(const basic_Rectangle2D<_T> &bounds);
+		basic_Bounds2D& operator =(const basic_Rectangle2D<T_> &rect);
 
 		////Calculates and returns the width of the region
-		_T Width() const  { return Right -Left; }
+		T_ Width() const  { return Right -Left; }
 		////Calculates and returns the height of the region
-		_T Height() const { return Bottom-Top;  }
+		T_ Height() const { return Bottom-Top;  }
 
 		//scale, translate, rotate?, +, +=, -, -=, &&, ||
 	};
 
 	////Allows streaming of point. It converts point to string,
 	/// every row is printed on a line enclosed in braces.
-	template <class _T>
-	std::ostream &operator << (std::ostream &out, basic_Bounds2D<_T> &bounds) {
+	template <class T_>
+	std::ostream &operator << (std::ostream &out, basic_Bounds2D<T_> &bounds) {
 		out<<"< "<<bounds.Left<<"-"<<bounds.Right<<" , "<<bounds.Top<<"-"<<bounds.Bottom<<" >";
 
 		return out;
@@ -91,8 +115,8 @@
 
 
 	////Adds the textual form of the point to another string.
-	template <class _T>
-	std::string &operator + (std::string &out, basic_Bounds2D<_T> &bounds) {
+	template <class T_>
+	std::string &operator + (std::string &out, basic_Bounds2D<T_> &bounds) {
 		return string+(string)bounds;
 	}
 
--- a/Utils/BufferList.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/BufferList.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,7 +4,7 @@
 #include <memory.h>
 
 ////This class holds a list of buffers managing them as required
-template <typename _T> 
+template <typename T_> 
 class BufferList {
 public:
 	////Growth amount
@@ -33,17 +33,17 @@
 	}
 
 	////Add a new buffer and sets buffer data and size
-	void Add(_T *Data,int size) {
+	void Add(T_ *Data,int size) {
 		if(count==alloc)
 			grow();
 		
-		list[count]=(_T*)malloc(size*sizeof(_T));
+		list[count]=(T_*)malloc(size*sizeof(T_));
 		buffersizes[count]=size;
 		memcpy(list[count++],Data,size);
 	}
 	
 	////Returns the requested item
-	const _T* operator [] (int Index) {
+	const T_* operator [] (int Index) {
 		if(Index<0 || Index>count)
 			return NULL;
 		
@@ -70,17 +70,17 @@
 	////Allocates memory for the given amount of items
 	void AllocateFor(int amount) {
 		alloc+=amount;
-		list=(_T**)realloc(list,sizeof(_T*)*alloc);
+		list=(T_**)realloc(list,sizeof(T_*)*alloc);
 		buffersizes=(int*)realloc(buffersizes,sizeof(int)*alloc);
 	}
 	
 private:
-	_T **list;
+	T_ **list;
 	int *buffersizes;
 	int alloc,count;
 	
 	void init() {
-		list=(_T**)malloc(sizeof(_T*)*growth);
+		list=(T_**)malloc(sizeof(T_*)*growth);
 		buffersizes=(int*)malloc(sizeof(int)*growth);
 		alloc=growth;
 		count=0;
@@ -88,7 +88,7 @@
 	
 	void grow() {
 		alloc+=growth;
-		list=(_T**)realloc(list,sizeof(_T*)*alloc);
+		list=(T_**)realloc(list,sizeof(T_*)*alloc);
 		buffersizes=(int*)realloc(buffersizes,sizeof(int)*alloc);
 	}
 	
--- a/Utils/GGE.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/GGE.h	Thu Apr 21 01:53:15 2011 +0000
@@ -21,18 +21,18 @@
 ////Gorgon Game Engine
 namespace gge {
 
-	template <class _T>
-	inline basic_Rectangle2D<_T>::basic_Rectangle2D(const basic_Bounds2D<_T> &bounds) :
+	template <class T_>
+	inline basic_Rectangle2D<T_>::basic_Rectangle2D(const basic_Bounds2D<T_> &bounds) :
 		Left(bounds.Left), Top(bounds.Top), Width(bounds.Width()), Height(bounds.Height())
 	{ }
 
-	template <class _T>
-	inline basic_Rectangle2D<_T>::operator basic_Bounds2D<_T>() {
-		return basic_Bounds2D<_T>(*this);
+	template <class T_>
+	inline basic_Rectangle2D<T_>::operator basic_Bounds2D<T_>() {
+		return basic_Bounds2D<T_>(*this);
 	}
 
-	template <class _T>
-	inline basic_Rectangle2D<_T>& basic_Rectangle2D<_T>::operator =(const basic_Bounds2D<_T> &bounds) {
+	template <class T_>
+	inline basic_Rectangle2D<T_>& basic_Rectangle2D<T_>::operator =(const basic_Bounds2D<T_> &bounds) {
 		Left=bounds.Left;
 		Top=bounds.Top;
 		Width=bounds.Width();
@@ -41,18 +41,18 @@
 		return *this;
 	}
 
-	template <class _T>
-	inline basic_Bounds2D<_T>::basic_Bounds2D(const basic_Rectangle2D<_T> &rectangle) :
+	template <class T_>
+	inline basic_Bounds2D<T_>::basic_Bounds2D(const basic_Rectangle2D<T_> &rectangle) :
 		Left(rectangle.Left), Top(rectangle.Top), Right(rectangle.Right()), Bottom(rectangle.Bottom())
 	{ }
 
-	template <class _T>
-	inline basic_Bounds2D<_T>::operator basic_Rectangle2D<_T>() {
-		return basic_Rectangle2D<_T>(*this);
+	template <class T_>
+	inline basic_Bounds2D<T_>::operator basic_Rectangle2D<T_>() {
+		return basic_Rectangle2D<T_>(*this);
 	}
 
-	template <class _T>
-	inline basic_Bounds2D<_T>& basic_Bounds2D<_T>::operator =(const basic_Rectangle2D<_T> &rect) {
+	template <class T_>
+	inline basic_Bounds2D<T_>& basic_Bounds2D<T_>::operator =(const basic_Rectangle2D<T_> &rect) {
 		Left=rect.Left;
 		Top=rect.Top;
 		Right=rect.Right();
--- a/Utils/Iterator.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/Iterator.h	Thu Apr 21 01:53:15 2011 +0000
@@ -7,27 +7,27 @@
 #endif
 
 ////Generic iterator interface. 
-template <class _T>
+template <class T_>
 class IIterator {
 public:
 	////This method resets the iterator
 	virtual void reset()=0;
 	////This method gets the next item and moves item pointer to the next one
-	virtual _T* get()=0;
-	virtual _T* peek()=0;
+	virtual T_* get()=0;
+	virtual T_* peek()=0;
 
 	////This method returns whether iterator is at the last item
 	virtual bool eof()=0;
 
-	virtual _T& getReference() { return *get(); }
+	virtual T_& getReference() { return *get(); }
 
 	////This method gets the next item and moves item pointer to the next one
-	virtual operator _T*() {
+	virtual operator T_*() {
 		return get();
 	}
 
 	////This method gets the next item and moves item pointer to the next one
-	virtual operator _T&() {
+	virtual operator T_&() {
 		return *get();
 	}
 	////This method returns whether iterator is at the last item
--- a/Utils/PAClassList.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/PAClassList.h	Thu Apr 21 01:53:15 2011 +0000
@@ -12,7 +12,7 @@
 /// is cleared and built again. Should be used with care. This
 /// list does not have support for item removal, it can only be
 /// cleared.
-template <class _T>
+template <class T_>
 class PAClassList {
 public:
 	////Amount of growth when this object runs out of space
@@ -44,7 +44,7 @@
 	/// does not make any initialization unless a growth is 
 	/// required. The returned object should be considered
 	/// dirty.
-	_T* Add() {
+	T_* Add() {
 		if(count==alloc)
 			grow();
 		
@@ -52,7 +52,7 @@
 	}
 	
 	////Indexes an item, does not do bound check
-	_T* operator [] (int Index) {
+	T_* operator [] (int Index) {
 		return list[Index];
 	}
 	
@@ -76,30 +76,30 @@
 	/// amount of items. It also initializes the newly
 	/// created objects
 	void AllocateFor(int amount) {
-		list=(_T**)realloc(list,sizeof(_T*)*(alloc+amount));
+		list=(T_**)realloc(list,sizeof(T_*)*(alloc+amount));
 		for(int i=alloc;i<alloc+growth;i++)
-			list[i]=new _T;
+			list[i]=new T_;
 
 		alloc+=amount;
 	}
 
 private:
-	_T **list;
+	T_ **list;
 	int alloc,count;
 	
 	void init() {
-		list=(_T**)malloc(sizeof(_T*)*growth);
+		list=(T_**)malloc(sizeof(T_*)*growth);
 		alloc=growth;
 		for(int i=0;i<alloc;i++)
-			list[i]=new _T;
+			list[i]=new T_;
 
 		count=0;
 	}
 	
 	void grow() {
-		list=(_T**)realloc(list,sizeof(_T*)*(alloc+growth));
+		list=(T_**)realloc(list,sizeof(T_*)*(alloc+growth));
 		for(int i=alloc;i<alloc+growth;i++)
-			list[i]=new _T;
+			list[i]=new T_;
 
 		alloc+=growth;
 	}
--- a/Utils/Point2D.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/Point2D.h	Thu Apr 21 01:53:15 2011 +0000
@@ -1,3 +1,27 @@
+//DESCRIPTION
+//	This file contains class Point which is compatible with 2 variable
+//	point structures but offers extra functionality
+
+//REQUIRES:
+//	---
+
+//LICENSE
+//	This program is free software: you can redistribute it and/or modify
+//	it under the terms of the Lesser GNU General Public License as published by
+//	the Free Software Foundation, either version 3 of the License, or
+//	(at your option) any later version.
+//
+//	This program is distributed in the hope that it will be useful,
+//	but WITHOUT ANY WARRANTY; without even the implied warranty of
+//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//	Lesser GNU General Public License for more details.
+//
+//	You should have received a copy of the Lesser GNU General Public License
+//	along with this program. If not, see < http://www.gnu.org/licenses/ >.
+
+//COPYRIGHT
+//	Cem Kalyoncu, DarkGaze.Org (cemkalyoncu[at]gmail[dot]com)
+
 #pragma once
 
 #include <iostream>
@@ -24,31 +48,31 @@
 #define POINT2D_EXISTS
 
 #ifdef VECTOR_EXISTS
-#error "Include Point2D before including Vector header to obtain extra functionality"
+#	error "Include Point2D before including Vector header to obtain extra functionality"
 #endif
 
 
 
 namespace gge {
 
-	template <class _T>
+	template <class T_>
 	class basic_Point2D {
 	public:
-		_T x,y;
+		T_ x,y;
 
 		basic_Point2D() {}
-		basic_Point2D(_T X, _T Y) : x(X), y(Y) {  }
-		template <class _U>
-		basic_Point2D(const basic_Point2D<_U> &point) : x(point.x), y(point.y) { }
+		basic_Point2D(T_ X, T_ Y) : x(X), y(Y) {  }
+		template <class U_>
+		basic_Point2D(const basic_Point2D<U_> &point) : x(point.x), y(point.y) { }
 
-		template <class _U>
-		basic_Point2D& operator =(const basic_Point2D<_U> &point) { x=point.x; y=point.y; return *this; }
+		template <class U_>
+		basic_Point2D& operator =(const basic_Point2D<U_> &point) { x=point.x; y=point.y; return *this; }
 
-		graphtype Distance(basic_Point2D &point) {
+		graphtype Distance(const basic_Point2D &point) {
 			return std::sqrt( (graphtype)(x-point.x)*(x-point.x) + (y-point.y)*(y-point.y) );
 		}
 
-		graphtype Distance() {
+		graphtype Distance() const {
 			return std::sqrt( (graphtype)(x*x) + (y*y) );
 		}
 
@@ -56,118 +80,108 @@
 			return basic_Point2D(x-point.x, y-point.y);
 		}
 
-		basic_Point2D operator - (_T value) {
+		basic_Point2D operator - (T_ value) const {
 			return basic_Point2D(x-value, y-value);
 		}
 
-		basic_Point2D operator + (basic_Point2D &point) {
+		basic_Point2D operator + (const basic_Point2D &point) const {
 			return basic_Point2D(x+point.x, y+point.y);
 		}
 
-		basic_Point2D operator + (_T value) {
+		basic_Point2D operator + (T_ value) const {
 			return basic_Point2D(x+value, y+value);
 		}
 
-		template <class _U>
-		basic_Point2D operator * (_U value) {
+		template <class U_>
+		basic_Point2D operator * (U_ value) const {
 			return basic_Point2D(x*value, y*value);
 		}
 
-		graphtype operator *(basic_Point2D<_T> &value) {
+		graphtype operator *(const basic_Point2D<T_> &value) const {
 			return x*value.x+y*value.y;
 		}
 
-		template <class _U>
-		basic_Point2D operator / (_U value) {
+		template <class U_>
+		basic_Point2D operator / (U_ value) const {
 			return basic_Point2D(x/value, y/value);
 		}
 
-		basic_Point2D &operator -= (basic_Point2D &point) {
+		basic_Point2D &operator -= (const basic_Point2D &point) {
 			x-=point.x;
 			y-=point.y;
 			return *this;
 		}
 
-		basic_Point2D &operator -= (_T value) {
+		basic_Point2D &operator -= (T_ value) {
 			x-=value;
 			y-=value;
 			return *this;
 		}
 
-		basic_Point2D &operator += (basic_Point2D &point) {
+		basic_Point2D &operator += (const basic_Point2D &point) {
 			x+=point.x;
 			y+=point.y;
 			return *this;
 		}
 
-		basic_Point2D &operator += (_T value) {
+		basic_Point2D &operator += (T_ value) {
 			x+=value;
 			y+=value;
 			return *this;
 		}
 
-		template <class _U>
-		basic_Point2D &operator *= (_U value) {
+		template <class U_>
+		basic_Point2D &operator *= (U_ value) {
 			x*=value;
 			y*=value;
 			return *this;
 		}
 
-		template <class _U>
-		basic_Point2D &operator /= (_U value) {
+		template <class U_>
+		basic_Point2D &operator /= (U_ value) {
 			x/=value;
 			y/=value;
 			return *this;
 		}
 
-		graphtype Angle(basic_Point2D &point) {
-			graphtype slope=Slope(point);
-			if(x<point.x)
-				return std::atan(slope)+PI;
-			else if(y<point.y)
-				return std::atan(slope)+PI*2;
-			else
-				return std::atan(slope);
+		graphtype Angle(const basic_Point2D &origin) const {
+			return atan2(y-origin.y, x-origin.x);
 		}
 
-		graphtype Angle() {
-			graphtype slope=Slope();
-			if(x<0)
-				return std::atan(slope)+PI;
-			else if(y<0)
-				return std::atan(slope)+PI*2;
-			else
-				return std::atan(slope);
+		graphtype Angle() const {
+			return atan2(y, x);
 		}
 
-		graphtype Slope(basic_Point2D &point) {
+		graphtype Slope(const basic_Point2D &point) const {
 			return (graphtype)(y-point.y)/(x-point.x);
 		}
 
-		graphtype Slope() {
+		graphtype Slope() const {
 			return (graphtype)y/x;
 		}
 
-		bool Compare(basic_Point2D &point) {
-			_T v=std::numeric_limits<_T>::epsilon();
+		///!!!Do i have to change this
+		bool Compare(const basic_Point2D &point) const {
+			T_ v=std::numeric_limits<T_>::epsilon();
 			if(v<1)
 				v*=5;
 
 			//for double and float operations
-			_T dist1=x-point.x;
-			_T dist2=y-point.y;
+			T_ dist1=x-point.x;
+			T_ dist2=y-point.y;
 			return  dist1<=v && dist1>=-v && dist2<=v && dist2>=-v;
 		}
 
-		bool operator == (basic_Point2D &point) {
+		//or at least this one
+		bool operator == (const basic_Point2D &point) const {
 			return Compare(point);
 		}
 
-		bool operator !=(basic_Point2D &point) {
+		bool operator !=(const basic_Point2D &point) const {
 			return !Compare(point);
 		}
 
-		basic_Point2D &operator = (basic_Point2D &point) {
+		basic_Point2D &operator = (const basic_Point2D &point) {
 			x=point.x;
 			y=point.y;
 
@@ -176,7 +190,7 @@
 
 #ifdef GRAPH_XMLSERVICES
 		//only supported for scalar values
-		std::string toXMLAttributes() {
+		std::string toXMLAttributes() const {
 			std::ostringstream str;
 			
 			str.precision(Point2D_DecimalPoints);
@@ -186,7 +200,7 @@
 		}
 
 		//only supported for scalar values
-		std::string toXMLTag() {
+		std::string toXMLTag() const {
 			std::ostringstream str;
 			
 			str.precision(Point2D_DecimalPoints);
@@ -204,33 +218,33 @@
 		}
 #endif
 
-		void Translate(_T x, _T y) {
+		void Translate(T_ x, T_ y) {
 			this->x+=x;
 			this->y+=y;
 		}
-		template <class _U>
-		void Scale(_U size) {
+		template <class U_>
+		void Scale(U_ size) {
 			x *= size;
 			y *= size;
 		}
-		template <class _U>
-		void Scale(_U sizex, _U sizey) {
+		template <class U_>
+		void Scale(U_ sizex, U_ sizey) {
 			x *= sizex;
 			y *= sizey;
 		}
-		template <class _U>
-		void Scale(_U size, basic_Point2D origin) {
+		template <class U_>
+		void Scale(U_ size, basic_Point2D origin) {
 			x = (x-origin.x)*size+origin.x;
 			y = (y-origin.y)*size+origin.y;
 		}
-		template <class _U>
-		void Scale(_U sizex, _U sizey, basic_Point2D origin) {
+		template <class U_>
+		void Scale(U_ sizex, U_ sizey, basic_Point2D origin) {
 			x = (x-origin.x)*sizex+origin.x;
 			y = (y-origin.y)*sizey+origin.y;
 		}
 		////no template on this since cos and cosf cannot be used as such
 		void Rotate(graphtype angle) {
-			_T new_x;
+			T_ new_x;
 			graphtype cosa=cosfn(angle), sina=sinfn(angle);
 			new_x = x*cosa - y*sina;
 			y     = x*sina + y*cosa;
@@ -238,7 +252,7 @@
 			x     = new_x;
 		}
 		void Rotate(graphtype angle, basic_Point2D origin) {
-			graphtype cosa=cosfn(angle), sina=sinfn(angle);
+			graphtype cosa=std::cos(angle), sina=std::sin(angle);
 
 			basic_Point2D temp=*this-origin;
 
@@ -247,27 +261,27 @@
 
 			*this += origin;
 		}
-		template <class _U>
-		void SkewX(_U rate) {
+		template <class U_>
+		void SkewX(U_ rate) {
 			x += y*rate;
 		}
-		template <class _U>
-		void SkewY(_U rate) {
+		template <class U_>
+		void SkewY(U_ rate) {
 			y += x*rate;
 		}
-		template <class _U>
-		void SkewX(_U rate, basic_Point2D origin) {
+		template <class U_>
+		void SkewX(U_ rate, basic_Point2D origin) {
 			x += (y-origin.y)*rate;
 		}
-		template <class _U>
-		void SkewY(_U rate, basic_Point2D origin) {
+		template <class U_>
+		void SkewY(U_ rate, basic_Point2D origin) {
 			y += (x-origin.x)*rate;
 		}
 		void ReflectX() {
-			y = -y;
+			x = -x;
 		}
 		void ReflectY() {
-			x = -x;
+			y = -y;
 		}
 		void HorizontalMirror() {
 			ReflectY();
@@ -276,10 +290,10 @@
 			ReflectX();
 		}
 		void ReflectX(basic_Point2D origin) {
-			y = -y+origin.y*2;
+			x = -x+origin.x*2;
 		}
 		void ReflectY(basic_Point2D origin) {
-			x = -x+origin.x*2;
+			y = -y+origin.y*2;
 		}
 		void HorizontalMirror(basic_Point2D origin) {
 			ReflectY(origin);
@@ -292,11 +306,11 @@
 		}*/
 
 		template <class U_>
-		static basic_Point2D CreateFrom(basic_Point2D point, U_ magnitute, graphtype angle) {
+		static basic_Point2D CreateFrom(const basic_Point2D &point, U_ magnitute, graphtype angle) {
 			return point+basic_Point2D(magnitute*std::cos(angle), magnitute*std::sin(angle));
 		}
 
-		operator std::string() {
+		operator std::string() const {
 			std::ostringstream str;
 
 			str.precision(Point2D_DecimalPoints);
@@ -310,8 +324,8 @@
 
 	////Allows streaming of point. It converts point to string,
 	/// every row is printed on a line enclosed in braces.
-	template <class _T>
-	std::ostream &operator << (std::ostream &out, basic_Point2D<_T> &point) {
+	template <class T_>
+	std::ostream &operator << (std::ostream &out, const basic_Point2D<T_> &point) {
 		out<<"("<<point.x<<", "<<point.y<<")";
 
 		return out;
@@ -319,8 +333,8 @@
 
 
 	////Adds the textual form of the point to another string.
-	template <class _T>
-	std::string &operator + (std::string &out, basic_Point2D<_T> &point) {
+	template <class T_>
+	std::string &operator + (std::string &out, const basic_Point2D<T_> &point) {
 		return string+(string)point;
 	}
 
@@ -329,4 +343,4 @@
 
 	typedef basic_Point2D<int> Point;
 
-}
\ No newline at end of file
+}
--- a/Utils/Rectangle2D.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/Rectangle2D.h	Thu Apr 21 01:53:15 2011 +0000
@@ -26,28 +26,28 @@
 
 namespace gge {
 #ifndef BOUNDS2D_EXISTS
-	template <class _T> class basic_Bounds2D;
+	template <class T_> class basic_Bounds2D;
 #endif
 
-	template <class _T>
+	template <class T_>
 	class basic_Rectangle2D {
 	public:
-		_T Left,Top , Width,Height;
+		T_ Left,Top , Width,Height;
 		
 		basic_Rectangle2D() {}
-		basic_Rectangle2D(_T Left, _T Top, _T Width, _T Height) : 
+		basic_Rectangle2D(T_ Left, T_ Top, T_ Width, T_ Height) : 
 			Left(Left), Top(Top), Width(Width),Height(Height)
 		{ }
 			
-		basic_Rectangle2D(basic_Point2D<_T> TopLeft, basic_Size2D<_T> HeightWidth) : 
+		basic_Rectangle2D(basic_Point2D<T_> TopLeft, basic_Size2D<T_> HeightWidth) : 
 			Left(TopLeft.x), Top(TopLeft.y), Width(HeightWidth.Width), Height(HeightWidth.Height)
 		{ }
 			
-		basic_Rectangle2D(basic_Point2D<_T> TopLeft, int Width, int Height) : 
+		basic_Rectangle2D(basic_Point2D<T_> TopLeft, int Width, int Height) : 
 			Left(TopLeft.x), Top(TopLeft.y), Width(Width), Height(Height)
 		{ }
 		
-		basic_Rectangle2D(basic_Point2D<_T> TopLeft, basic_Point2D<_T> BottomRight) :
+		basic_Rectangle2D(basic_Point2D<T_> TopLeft, basic_Point2D<T_> BottomRight) :
 			Left(TopLeft.x), Top(TopLeft.y),
 			Width(BottomRight.x-TopLeft.x),	Height(BottomRight.y-TopLeft.y)
 		{ }
@@ -57,24 +57,24 @@
 			Left(rect.Left), Top(rect.Top), Width(rect.Width), Height(rect.Height)
 		{ }
 
-		basic_Rectangle2D(const basic_Bounds2D<_T> &bounds);
+		basic_Rectangle2D(const basic_Bounds2D<T_> &bounds);
 
-		operator basic_Bounds2D<_T>();
+		operator basic_Bounds2D<T_>();
 
-		basic_Rectangle2D& operator =(const basic_Bounds2D<_T> &bounds);
+		basic_Rectangle2D& operator =(const basic_Bounds2D<T_> &bounds);
 
 		////Calculates and returns the width of the region
-		_T Right() const { return Width +Left; }
+		T_ Right() const { return Width +Left; }
 		////Calculates and returns the height of the region
-		_T Bottom() const { return Height+Top;  }
+		T_ Bottom() const { return Height+Top;  }
 
 		//scale, translate, rotate?, +, +=, -, -=, &&, ||
 	};
 
 	////Allows streaming of point. It converts point to string,
 	/// every row is printed on a line enclosed in braces.
-	template <class _T>
-	std::ostream &operator << (std::ostream &out, basic_Rectangle2D<_T> &Rectangle) {
+	template <class T_>
+	std::ostream &operator << (std::ostream &out, basic_Rectangle2D<T_> &Rectangle) {
 		out<<"< "<<Rectangle.Left<<"-"<<Rectangle.Width<<" , "<<Rectangle.Top<<"-"<<Rectangle.Height<<" >";
 
 		return out;
@@ -82,8 +82,8 @@
 
 
 	////Adds the textual form of the point to another string.
-	template <class _T>
-	std::string &operator + (std::string &out, basic_Rectangle2D<_T> &Rectangle) {
+	template <class T_>
+	std::string &operator + (std::string &out, basic_Rectangle2D<T_> &Rectangle) {
 		return string+(string)Rectangle;
 	}
 
--- a/Utils/ValueList.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Utils/ValueList.h	Thu Apr 21 01:53:15 2011 +0000
@@ -5,7 +5,7 @@
 #include <cstring>
 #include "ManagedBuffer.h"
 
-template <class _T>
+template <class T_>
 class ValueList
 {
 public:
@@ -32,7 +32,7 @@
 		return *count;
 	}
 	
-	void Add(_T data)
+	void Add(T_ data)
 	{
 		if(*count==buffer.GetSize())
 			grow();
@@ -45,10 +45,10 @@
 		if(*count<0) *count=0;
 	}
 	
-	_T &operator [] (int Index)
+	T_ &operator [] (int Index)
 	{
 #ifdef _DEBUG
-		_T t;
+		T_ t;
 		if(Index<0 || Index>*count)
 			return t;
 #endif
@@ -80,12 +80,12 @@
 		buffer.Resize(buffer.GetSize()+amount);
 	}
 
-	_T *getList() {
+	T_ *getList() {
 		return buffer.GetBuffer();
 	}
 
 private:
-	ManagedBuffer<_T> buffer;
+	ManagedBuffer<T_> buffer;
 	int *count;
 	
 	void grow()
--- a/Widgets/Button.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Button.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,6 +3,8 @@
 #include <cstring>
 #include "../Engine/GGEMain.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	Button::Button(ButtonBP *BluePrint,IWidgetContainer &container) : 
 		IWidgetObject(container),
--- a/Widgets/Button.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Button.h	Thu Apr 21 01:53:15 2011 +0000
@@ -61,10 +61,10 @@
 		Button	&SetCancel();
 		Button	&SetNormal();
 
-		ImageResource *Icon;
-		ImageResource *HoverIcon;
-		ImageResource *PressedIcon;
-		ImageResource *DisabledIcon;
+		resource::ImageResource *Icon;
+		resource::ImageResource *HoverIcon;
+		resource::ImageResource *PressedIcon;
+		resource::ImageResource *DisabledIcon;
 
 		virtual bool mouse(input::MouseEventType event,int x,int y);
 
@@ -80,7 +80,7 @@
 		unsigned int currentanimstart;
 		unsigned int currentanimend;
 		bool temporalstate;
-		Colorizable2DLayer textlayer,iconlayer;
+		graphics::Colorizable2DLayer textlayer,iconlayer;
 		ButtonBP *BluePrint;
 		ButtonElement *et[4][4];
 		ButtonElement *DetermineElement(ButtonStates currentstate,ButtonStates nextstate);
--- a/Widgets/ButtonBP.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ButtonBP.h	Thu Apr 21 01:53:15 2011 +0000
@@ -7,8 +7,6 @@
 #include "Button.h"
 #include <math.h>
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_BUTTON			0x05840000
@@ -16,15 +14,15 @@
 #define GID_BUTTON_NAMES	0x05840102
 #define GID_BUTTON_NAME		0x05840103
 
-	class ButtonBP : public ResourceBase, public IWidgetBluePrint
+	class ButtonBP : public resource::ResourceBase, public IWidgetBluePrint
 	{
-		friend ResourceBase *LoadButton(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase *LoadButton(resource::ResourceFile*,FILE*,int);
 		friend class Button;
 	public:
 		ButtonBP(void);
 		virtual int getGID() { return GID_BUTTON; }
 		virtual IWidgetObject *Create(IWidgetContainer &Container,int X,int Y,int Cx,int Cy);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 	protected:
 		utils::Collection<ButtonStyleGroup> StyleGroups;
--- a/Widgets/ButtonElement.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ButtonElement.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,5 +1,7 @@
 #include "ButtonElement.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	ButtonElement::ButtonElement(void) {
 		font_guid=NULL;
@@ -50,7 +52,7 @@
 	}
 
 
-	ButtonElement &ButtonElement::Draw(WidgetLayer &Target,Colorizable2DLayer &TextTarget,Colorizable2DLayer &IconTarget,string Caption,Buffered2DGraphic *Icon) {
+	ButtonElement &ButtonElement::Draw(WidgetLayer &Target,graphics::Colorizable2DLayer &TextTarget,graphics::Colorizable2DLayer &IconTarget,string Caption,graphics::Buffered2DGraphic *Icon) {
 		int X=Offset.x;
 		int Y=Offset.y;
 		int Width=Visual->Width(Target.W);
--- a/Widgets/ButtonElement.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ButtonElement.h	Thu Apr 21 01:53:15 2011 +0000
@@ -11,27 +11,23 @@
 #include "Rectangle.h"
 #include <string>
 
-using namespace gre;
-using namespace gge;
-using namespace std;
-
 namespace gge { namespace widgets {
 
 #define GID_BUTTON_ELEMENT			0x5240000
 #define GID_BUTTON_ELEMENT_PROPS	0x5240101
 
-	class ButtonElement : public ResourceBase
+	class ButtonElement : public resource::ResourceBase
 	{
-		friend ResourceBase *LoadButtonElement(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase *LoadButtonElement(resource::ResourceFile*,FILE*,int);
 		friend class ButtonStyleGroup;
 	public:
 		ButtonElement(void);
 
 		virtual int getGID() { return GID_BUTTON_ELEMENT; }
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 		virtual void Prepare(gge::GGEMain *main);
 
-		ButtonElement &Draw(WidgetLayer &Target,Colorizable2DLayer &TextTarget,Colorizable2DLayer &IconTarget,string Caption,Buffered2DGraphic *Icon);
+		ButtonElement &Draw(WidgetLayer &Target,graphics::Colorizable2DLayer &TextTarget,graphics::Colorizable2DLayer &IconTarget,string Caption,graphics::Buffered2DGraphic *Icon);
 		ButtonElement &ReadyAnimation(bool Backwards);
 		ButtonElement &setLoop(bool loop) { Visual->setLoop(loop); return *this; }
 		ButtonElement &Reverse();
@@ -40,22 +36,22 @@
 
 		int getAnimationDuration() { return this->Visual->getDuration(); }
 
-		BitmapFontResource *Font;
-		SoundResource *Sound;
-		RGBint ForeColor,ShadowColor;
+		resource::BitmapFontResource *Font;
+		resource::SoundResource *Sound;
+		graphics::RGBint ForeColor,ShadowColor;
 		Alignment TextAlign;
 		Alignment IconAlign;
 		int Duration;
 		Bounds TextMargins;
 		Bounds IconMargins;
-		RGBint IconColor;
+		graphics::RGBint IconColor;
 		Point Offset;
 		Point ShadowOffset;
 
 	protected:
 		Guid *font_guid;
 		Guid *sound_guid;
-		ResourceFile *file;
-		ResizableObject *Visual;
+		resource::ResourceFile *file;
+		resource::ResizableObject *Visual;
 	};
 } }
--- a/Widgets/ButtonLoader.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ButtonLoader.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -8,6 +8,8 @@
 #include "ButtonElement.h"
 #include "ButtonStyleGroup.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	void eatchunk(FILE* f,int size);
 
--- a/Widgets/ButtonStyleGroup.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ButtonStyleGroup.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,21 +3,19 @@
 #include "../Resource/ResourceBase.h"
 #include "ButtonElement.h"
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_BUTTON_GRP			0x5340000
 #define GID_BUTTON_GRP_PROPS	0x5340101
 
-	class ButtonStyleGroup : public ResourceBase
+	class ButtonStyleGroup : public resource::ResourceBase
 	{
-		friend ResourceBase* LoadButtonStyleGroup(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase* LoadButtonStyleGroup(resource::ResourceFile*,FILE*,int);
 	public:
 		ButtonStyleGroup(void);
 		virtual int getGID() { return GID_BUTTON_GRP; }
 		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 		enum {
 			SIZE_RESIZABLE,
@@ -45,7 +43,7 @@
 
 	protected:
 
-		ResourceFile* file;
+		resource::ResourceFile* file;
 
 		Guid *guid_normalstyle		,
 			 *guid_hoverstyle		,
--- a/Widgets/CheckboxBP.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxBP.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,7 +6,6 @@
 #include "IWidgetContainer.h"
 #include <math.h>
 
-using namespace gre;
 
 namespace gge { namespace widgets {
 
@@ -15,15 +14,15 @@
 #define GID_CHECKBOX_NAMES		0x05850102
 #define GID_CHECKBOX_NAME		0x05850103
 
-	class CheckboxBP : public ResourceBase, public IWidgetBluePrint {
-		friend ResourceBase *LoadCheckbox(ResourceFile*,FILE*,int);
+	class CheckboxBP : public resource::ResourceBase, public IWidgetBluePrint {
+		friend resource::ResourceBase *LoadCheckbox(resource::ResourceFile*,FILE*,int);
 		friend class CheckboxBase;
 
 	public:
 		CheckboxBP(void);
 		virtual int getGID() { return GID_CHECKBOX; }
 		virtual IWidgetObject *Create(IWidgetContainer &Container,int X,int Y,int Cx,int Cy);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 	protected:
 		utils::Collection<CheckboxStyleGroup> StyleGroups;
--- a/Widgets/CheckboxBase.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxBase.h	Thu Apr 21 01:53:15 2011 +0000
@@ -104,9 +104,9 @@
 		bool statetransition;
 		bool statetransitiontarget;
 		bool mover;
-		Colorizable2DLayer textlayer;
+		graphics::Colorizable2DLayer textlayer;
 
-		ImageAnimation *icon;
+		resource::ImageAnimation *icon;
 
 		CheckboxBP *BluePrint;
 		CheckboxElement *et[4][4];
--- a/Widgets/CheckboxElement.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxElement.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,6 +3,8 @@
 #include "Rectangle.h"
 #include "CheckboxBase.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	CheckboxElement::CheckboxElement(void) : symbol(NULL), border(NULL), bordertemplate(NULL), Lines(1), base(NULL) {
 	}
@@ -38,7 +40,7 @@
 		return *this;
 	}
 
-	CheckboxElement &CheckboxElement::Draw(WidgetLayer &layer,Colorizable2DLayer &textlayer,string &caption) {
+	CheckboxElement &CheckboxElement::Draw(WidgetLayer &layer,graphics::Colorizable2DLayer &textlayer,string &caption) {
 		SymbolIconOrderConstants symboliconorder=SymbolIconOrder;
 		Margins cm; //current margin
 		
--- a/Widgets/CheckboxElement.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxElement.h	Thu Apr 21 01:53:15 2011 +0000
@@ -10,9 +10,6 @@
 #include "../Utils/Margins.h"
 #include <string>
 
-using namespace gre;
-using namespace gge;
-using namespace std;
 
 namespace gge { namespace widgets {
 
@@ -22,8 +19,8 @@
 #define GID_CHECKBOX_ELEMENT_PROPS		0x5250101
 #define GID_CHECKBOX_ELEMENT_PROPS2		0x5250102
 
-	class CheckboxElement : public ResourceBase {
-		friend ResourceBase *LoadCheckboxElement(ResourceFile*,FILE*,int);
+	class CheckboxElement : public resource::ResourceBase {
+		friend resource::ResourceBase *LoadCheckboxElement(resource::ResourceFile*,FILE*,int);
 		friend class CheckboxStyleGroup;
 	public:
 
@@ -40,17 +37,17 @@
 
 		virtual int getGID() { return GID_CHECKBOX_ELEMENT; }
 		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
-		CheckboxElement &Draw(WidgetLayer &layer,Colorizable2DLayer &textlayer,string &caption);
+		CheckboxElement &Draw(WidgetLayer &layer,graphics::Colorizable2DLayer &textlayer,string &caption);
 		CheckboxElement &ReadyAnimation(bool Backwards);
 		CheckboxElement &Reverse();
 
 		Font Font;
-		SoundResource *Sound;
+		resource::SoundResource *Sound;
 		int Duration;
-		RGBint ForeColor;
-		RGBint ShadowColor;
+		graphics::RGBint ForeColor;
+		graphics::RGBint ShadowColor;
 		Point ShadowOffset;
 
 		int Lines;
@@ -74,9 +71,9 @@
 	protected:
 		FontInitiator temp_font;
 		Guid *sound_guid;
-		ResourceFile *file;
-		ImageAnimation *symbol;
-		ResizableObject *border;
-		ResourceBase *bordertemplate;
+		resource::ResourceFile *file;
+		resource::ImageAnimation *symbol;
+		resource::ResizableObject *border;
+		resource::ResourceBase *bordertemplate;
 	};
 } }
--- a/Widgets/CheckboxLoader.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxLoader.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -5,6 +5,8 @@
 #include "Line.h"
 #include "Rectangle.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 
 	ResourceBase* LoadCheckbox(ResourceFile* file,FILE* gfile,int sz) {
--- a/Widgets/CheckboxStyleGroup.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxStyleGroup.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,5 +1,7 @@
 #include "CheckboxStyleGroup.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 
 	CheckboxStyleGroup::CheckboxStyleGroup(void) {
--- a/Widgets/CheckboxStyleGroup.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/CheckboxStyleGroup.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,8 +3,6 @@
 #include "../Resource/ResourceBase.h"
 #include "CheckboxElement.h"
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_CHECKBOX_GRP			0x5350000
@@ -15,14 +13,14 @@
 		CT_RadioButton
 	};
 
-	class CheckboxStyleGroup : public ResourceBase
+	class CheckboxStyleGroup : public resource::ResourceBase
 	{
-		friend ResourceBase* LoadCheckboxStyleGroup(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase* LoadCheckboxStyleGroup(resource::ResourceFile*,FILE*,int);
 	public:
 		CheckboxStyleGroup(void);
 		virtual int getGID() { return GID_CHECKBOX_GRP; }
 		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 		CheckboxTypes CheckboxType;
 
@@ -63,7 +61,7 @@
 						cRevToNextStyle;
 
 	protected:
-		ResourceFile* file;
+		resource::ResourceFile* file;
 
 		Guid *guid_normalstyle	,
 			 *guid_hoverstyle	,
--- a/Widgets/Frame.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Frame.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,9 +3,11 @@
 #include "WidgetRegistry.h"
 
 #ifndef FRAME_SCROLL
-#define FRAME_SCROLL	3
+#	define FRAME_SCROLL	3
 #endif
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	bool frame_scroll(int amount, input::MouseEventType event, int x, int y, void *data) {
 		Frame* frame=(Frame*)data;
--- a/Widgets/Frame.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Frame.h	Thu Apr 21 01:53:15 2011 +0000
@@ -176,7 +176,7 @@
 		bool verticlescrollbardisplayed;
 		
 		WidgetLayer		BoxLayer;
-		Basic2DLayer	ScrollingLayer;
+		graphics::Basic2DLayer	ScrollingLayer;
 
 		Margins outerborderwidth;
 		Margins scrollbarmargin;
--- a/Widgets/FrameBP.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/FrameBP.h	Thu Apr 21 01:53:15 2011 +0000
@@ -10,10 +10,10 @@
 
 namespace gge { namespace widgets {
 	class SliderBP;
-	ResourceBase *LoadFrame(ResourceFile*,FILE*,int);
+	resource::ResourceBase *LoadFrame(resource::ResourceFile*,FILE*,int);
 
-	class FrameBP : public ResourceBase, public IWidgetBluePrint {
-		friend ResourceBase *LoadFrame(ResourceFile*,FILE*,int);
+	class FrameBP : public resource::ResourceBase, public IWidgetBluePrint {
+		friend resource::ResourceBase *LoadFrame(resource::ResourceFile*,FILE*,int);
 	public:
 
 		FrameBP(RectangleResource *normal=NULL, SliderBP *scroller=NULL, Pointer::PointerTypes pointer=Pointer::None) 
@@ -34,7 +34,7 @@
 		}
 
 		virtual int getGID() { return GID_FRAME; }
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 		RectangleResource *Normal;
 		RectangleResource *Active;
@@ -68,7 +68,7 @@
 		Guid *guid_scrollingactive;
 
 		Guid *guid_scroller;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 
 	};
 
--- a/Widgets/IWidgetContainer.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/IWidgetContainer.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,7 +4,7 @@
 #include "../Engine/Input.h"
 #include "../Engine/GraphicLayers.h"
 
-#include "IWidgetContainer.h"
+#include "WidgetMain.h"
 
 
 namespace gge { namespace widgets {
@@ -65,8 +65,8 @@
 		virtual void				SetLayer(gge::LayerBase &layer) { SetLayer(&layer); }
 
 
-		virtual gge::Basic2DLayer	&GetBackgroundLayer() { return BackgroundLayer; }
-		virtual void				RedrawBackground() { BackgroundLayer.Clear(); BackgroundRedrawEvent(); }
+		virtual graphics::Basic2DLayer	&GetBackgroundLayer()	{ return BackgroundLayer; }
+		virtual void					RedrawBackground()		{ BackgroundLayer.Clear(); BackgroundRedrawEvent(); }
 
 		virtual bool keyboard_event(gge::input::KeyboardEvent::Type event,int keycode);
 
@@ -76,7 +76,7 @@
 
 		WidgetLayer &getBaseLayer() { return BaseLayer; }
 		WidgetLayer &getObjectLayer() { return ObjectLayer; }
-		Basic2DLayer &getBackgroundLayer() { return BackgroundLayer; }
+		graphics::Basic2DLayer &getBackgroundLayer() { return BackgroundLayer; }
 
 	protected:
 
@@ -86,7 +86,7 @@
 		WidgetLayer  BaseLayer;
 		WidgetLayer  ExtenderLayer;
 		WidgetLayer  ObjectLayer;
-		gge::Basic2DLayer BackgroundLayer;
+		graphics::Basic2DLayer BackgroundLayer;
 
 		utils::LinkedList<IWidgetObject> Subobjects;
 		IWidgetObject* Focussed;
--- a/Widgets/Label.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Label.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,21 +4,18 @@
 #include "../Resource/BitmapFontResource.h"
 #include "../Engine/GraphicLayers.h"
 
-using namespace gge;
-using namespace gre;
-
 namespace gge { namespace widgets {
 	class Label : public IWidgetObject {
 	public:
-		BitmapFontResource *Font;
-		RGBint Color;
+		resource::BitmapFontResource *Font;
+		graphics::RGBint Color;
 		ShadowParams Shadow;
-		Colorizable2DLayer textlayer;
+		graphics::Colorizable2DLayer textlayer;
 		TextAlignment Align;
 		bool Ghost;
 
-		Label(IWidgetContainer &container, BitmapFontResource *font, string text, int X=0, int Y=0, bool autosize=true, int W=100, 
-		TextAlignment align=TEXTALIGN_LEFT, RGBint color=0xff000000, ShadowParams shadow=ShadowParams()) : 
+		Label(IWidgetContainer &container, resource::BitmapFontResource *font, string text, int X=0, int Y=0, bool autosize=true, int W=100, 
+		TextAlignment align=TEXTALIGN_LEFT, graphics::RGBint color=0xff000000, ShadowParams shadow=ShadowParams()) : 
 			IWidgetObject(container),autosize(autosize),
 			Font(font), Color(color), Shadow(shadow),
 			Align(align), textlayer(0,0, INT_MAX,INT_MAX), Ghost(true)
@@ -36,8 +33,8 @@
 			nofocus=true;
 		}
 
-		Label(BitmapFontResource *font, string text, int X=0, int Y=0, bool autosize=true, int W=100, 
-		TextAlignment align=TEXTALIGN_LEFT, RGBint color=0xff000000, ShadowParams shadow=ShadowParams()) : 
+		Label(resource::BitmapFontResource *font, string text, int X=0, int Y=0, bool autosize=true, int W=100, 
+		TextAlignment align=TEXTALIGN_LEFT, graphics::RGBint color=0xff000000, ShadowParams shadow=ShadowParams()) : 
 			IWidgetObject(),autosize(autosize),
 			Font(font), Color(color), Shadow(shadow),
 			Align(align), textlayer(0,0, INT_MAX,INT_MAX), Ghost(true)
--- a/Widgets/Line.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Line.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,6 +2,10 @@
 #include "../Resource/ResourceFile.h"
 #include <stdexcept>
 
+using namespace gge::resource;
+using std::max;
+
+
 namespace gge { namespace widgets {
 
 	LineResource::LineResource(void) {
@@ -29,7 +33,7 @@
 	}
 
 
-	void Line::DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align) {
+	void Line::DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align) {
 
 	//Vertical
 		if(isVertical) { 
@@ -195,7 +199,7 @@
 		}
 	}
 
-	ResourceBase* LoadLineResource(ResourceFile* file,FILE* gfile,int sz) {
+	resource::ResourceBase* LoadLineResource(resource::ResourceFile* file,FILE* gfile,int sz) {
 		LineResource *line =new LineResource();
 
 		int gid,size,cnt=0;
--- a/Widgets/Line.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Line.h	Thu Apr 21 01:53:15 2011 +0000
@@ -9,9 +9,6 @@
 #include "../Utils/Margins.h"
 #include "WidgetMain.h"
 
-using namespace gre;
-using namespace gge;
-
 namespace gge { namespace widgets {
 
 #define GID_LINE		0x05110000
@@ -20,18 +17,18 @@
 	class Line;
 
 
-	ResourceBase *LoadLineResource(ResourceFile* File, FILE* Data, int Size);
-	class LineResource : public ResourceBase {
-		friend ResourceBase *LoadLineResource(ResourceFile* File, FILE* Data, int Size);
+	resource::ResourceBase *LoadLineResource(resource::ResourceFile* File, FILE* Data, int Size);
+	class LineResource : public resource::ResourceBase {
+		friend ResourceBase *LoadLineResource(resource::ResourceFile* File, FILE* Data, int Size);
 	public:
 		LineResource();
 		virtual int getGID() { return GID_LINE; }
-		virtual bool Save(gre::ResourceFile * File, FILE * Data) { return true; }
+		virtual bool Save(resource::ResourceFile * File, FILE * Data) { return true; }
 
 
-		AnimationResource *animStart;
-		AnimationResource *animLoop;
-		AnimationResource *animEnd;
+		resource::AnimationResource *animStart;
+		resource::AnimationResource *animLoop;
+		resource::AnimationResource *animEnd;
 
 
 		bool isTiled;
@@ -42,35 +39,35 @@
 	};
 
 
-	class Line : public ResizableObject {
+	class Line : public resource::ResizableObject {
 	public:
 		LineResource *Parent;
 		bool isVertical;
 		bool isTiled;
 		bool DrawStart, DrawEnd;
 
-		ResizableObject::Tiling Tiling;
-		ResizableObject::IntegralSize IntegralSize;
+		resource::ResizableObject::Tiling Tiling;
+		resource::ResizableObject::IntegralSize IntegralSize;
 
 
-		ImageAnimation *Start, *Loop, *End;
+		resource::ImageAnimation *Start, *Loop, *End;
 
-		Line(LineResource *parent) : Tiling(ResizableObject::Single) { SetParent(parent); }
-		Line(LineResource &parent) : Tiling(ResizableObject::Single) { SetParent(parent); }
+		Line(LineResource *parent) : Tiling(resource::ResizableObject::Single) { SetParent(parent); }
+		Line(LineResource &parent) : Tiling(resource::ResizableObject::Single) { SetParent(parent); }
 
-		Line(LineResource *parent, ResizableObject::Tiling Tiling, ResizableObject::IntegralSize IntegralSize ) 
+		Line(LineResource *parent, resource::ResizableObject::Tiling Tiling, resource::ResizableObject::IntegralSize IntegralSize ) 
 		{ SetParent(parent);  SetResizingOptions(Tiling, IntegralSize); }
 
 		void SetParent(LineResource *parent)  ;
 		void SetParent(LineResource &parent)  { SetParent(&parent); }
 
-		void SetResizingOptions( ResizableObject::Tiling Tiling, ResizableObject::IntegralSize IntegralSize ) {
+		void SetResizingOptions( resource::ResizableObject::Tiling Tiling, resource::ResizableObject::IntegralSize IntegralSize ) {
 			this->Tiling=Tiling;
 			this->IntegralSize=IntegralSize;
 		}
 
-		virtual void DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
-		virtual void DrawResized(I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER)
+		virtual void DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
+		virtual void DrawResized(graphics::I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER)
 		{ DrawResized(&Target, X,Y, W,H, Align); }
 		virtual void Reset(bool Reverse=false);
 		virtual void Reverse();
--- a/Widgets/Rectangle.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Rectangle.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,6 +2,9 @@
 #include "../Resource/ResourceFile.h"
 #include <stdexcept>
 
+using namespace gge::resource;
+using std::max;
+
 namespace gge { namespace widgets {
 	ResourceBase* LoadRectangleResource(ResourceFile* file,FILE* gfile,int sz) {
 		RectangleResource *Rect =new RectangleResource();
@@ -136,18 +139,18 @@
 		CenterOnly=parent->centeronly;
 	}
 
-	void ResizableRect::DrawAround(I2DGraphicsTarget *Target, int X, int Y, int W, int H) {
+	void ResizableRect::DrawAround(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H) {
 		DrawResized(Target, X-Parent->leftwidth, Y-Parent->topheight, W+Parent->leftwidth+Parent->rightwidth, H+Parent->topheight+Parent->bottomheight, ALIGN_MIDDLE_CENTER);
 	}
 
-	void ResizableRect::DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align) {
+	void ResizableRect::DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align) {
 
 
 		if(CenterOnly) {
 			int w=HSizing.Calculate(W, 0, animC->Width());
 			int h=VSizing.Calculate(H, 0, animC->Height());
 			
-			animC->DrawResized(Buffered2DGraphic::Tiling(TileCH,TileCV), Target, X,Y, w,h);
+			animC->DrawResized(graphics::Buffered2DGraphic::Tiling(TileCH,TileCV), Target, X,Y, w,h);
 
 			return;
 		}
--- a/Widgets/Rectangle.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Rectangle.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,35 +6,32 @@
 #include "../Resource/ResizableObject.h"
 #include "../Utils/Margins.h"
 
-using namespace gre;
-using namespace gge;
-
 namespace gge { namespace widgets {
 
 #define GID_RECT		0x05120000
 #define	GID_RECT_PROPS	0x05120101
 
-	ResourceBase *LoadRectangleResource(ResourceFile* File, FILE* Data, int Size);
+	resource::ResourceBase *LoadRectangleResource(resource::ResourceFile* File, FILE* Data, int Size);
 
-	class RectangleResource : public ResourceBase
+	class RectangleResource : public resource::ResourceBase
 	{
-		friend ResourceBase *LoadRectangleResource(ResourceFile* File, FILE* Data, int Size);
+		friend resource::ResourceBase *LoadRectangleResource(resource::ResourceFile* File, FILE* Data, int Size);
 		friend class ResizableRect;
 	public:
 		virtual int getGID() { return GID_RECT; }
 		RectangleResource();
 
-		virtual bool Save(gre::ResourceFile * File, FILE * Data) { return true; }
+		virtual bool Save(resource::ResourceFile * File, FILE * Data) { return true; }
 
-		AnimationResource *animTL;
-		AnimationResource *animT;
-		AnimationResource *animTR;
-		AnimationResource *animL;
-		AnimationResource *animC;
-		AnimationResource *animR;
-		AnimationResource *animBL;
-		AnimationResource *animB;
-		AnimationResource *animBR;
+		resource::AnimationResource *animTL;
+		resource::AnimationResource *animT;
+		resource::AnimationResource *animTR;
+		resource::AnimationResource *animL;
+		resource::AnimationResource *animC;
+		resource::AnimationResource *animR;
+		resource::AnimationResource *animBL;
+		resource::AnimationResource *animB;
+		resource::AnimationResource *animBR;
 
 		bool TileT,
 			 TileB,
@@ -67,7 +64,7 @@
 		bool centeronly;
 	};
 
-	class ResizableRect : public ResizableObject {
+	class ResizableRect : public resource::ResizableObject {
 	public:
 		RectangleResource *Parent;
 		bool TileT,
@@ -77,15 +74,15 @@
 			 TileCH,
 			 TileCV;
 
-		ImageAnimation *animTL;
-		ImageAnimation *animT;
-		ImageAnimation *animTR;
-		ImageAnimation *animL;
-		ImageAnimation *animC;
-		ImageAnimation *animR;
-		ImageAnimation *animBL;
-		ImageAnimation *animB;
-		ImageAnimation *animBR;
+		resource::ImageAnimation *animTL;
+		resource::ImageAnimation *animT;
+		resource::ImageAnimation *animTR;
+		resource::ImageAnimation *animL;
+		resource::ImageAnimation *animC;
+		resource::ImageAnimation *animR;
+		resource::ImageAnimation *animBL;
+		resource::ImageAnimation *animB;
+		resource::ImageAnimation *animBR;
 
 		ResizableRect(RectangleResource *parent) { init(parent); }
 		ResizableRect(RectangleResource &parent) { init(&parent); }
@@ -99,9 +96,9 @@
 			SetResizingOptions(HSizing,VSizing);
 		}
 
-		virtual void DrawResized(I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
-		virtual void DrawResized(I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) { DrawResized(&Target, X,Y, W,H, Align); }
-		virtual void DrawAround(I2DGraphicsTarget *Target, int X, int Y, int W, int H);
+		virtual void DrawResized(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER);
+		virtual void DrawResized(graphics::I2DGraphicsTarget &Target, int X, int Y, int W, int H, Alignment Align=ALIGN_MIDDLE_CENTER) { DrawResized(&Target, X,Y, W,H, Align); }
+		virtual void DrawAround(graphics::I2DGraphicsTarget *Target, int X, int Y, int W, int H);
 		virtual void Reset(bool Reverse=false);
 		virtual void Reverse();
 		virtual void Play();
--- a/Widgets/ResizableObjectResource.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ResizableObjectResource.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,6 +3,11 @@
 #include "Rectangle.h"
 #include <stdexcept>
 
+using namespace gge::resource;
+
+using std::runtime_error;
+
+
 namespace gge { namespace widgets {
 	ResourceBase *LoadResizableObject(ResourceFile* File, FILE* Data, int Size) {
 		ResizableObjectResource *r=new ResizableObjectResource();
--- a/Widgets/ResizableObjectResource.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/ResizableObjectResource.h	Thu Apr 21 01:53:15 2011 +0000
@@ -9,34 +9,34 @@
 #define GID_RESIZABLEOBJECT_PROPS	0x05130101
 
 namespace gge { namespace widgets {
-	class ResizableObjectResource : public gre::ResourceBase {
-		friend ResourceBase *LoadResizableObject(ResourceFile* File, FILE* Data, int Size);
+	class ResizableObjectResource : public resource::ResourceBase {
+		friend resource::ResourceBase *LoadResizableObject(resource::ResourceFile* File, FILE* Data, int Size);
 
 	public:
 		Guid *guid_target;
-		ResourceBase *target;
-		gre::ResizableObject::TileOption		HTile, VTile;
-		gre::ResizableObject::IntegralSize	HIntegral, VIntegral;
+		resource::ResourceBase *target;
+		resource::ResizableObject::TileOption		HTile, VTile;
+		resource::ResizableObject::IntegralSize	HIntegral, VIntegral;
 
 		ResizableObjectResource() : guid_target(NULL), target(NULL) { }
 
 		virtual int getGID() { return GID_RESIZABLEOBJECT; }
 
 		////Currently does nothing
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
-		operator gre::ResizableObject *();
+		operator resource::ResizableObject *();
 
-		operator gre::ResizableObject &() { return Generate(); }
+		operator resource::ResizableObject &() { return Generate(); }
 
-		gre::ResizableObject &Generate();
+		resource::ResizableObject &Generate();
 
 		virtual void Prepare(GGEMain *main);
 
 	protected:
-		ResourceFile *file;
+		resource::ResourceFile *file;
 
 	};
 
-	ResourceBase *LoadResizableObject(ResourceFile* File, FILE* Data, int Size);
+	resource::ResourceBase *LoadResizableObject(resource::ResourceFile* File, FILE* Data, int Size);
 } }
--- a/Widgets/SliderBP.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderBP.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -21,7 +21,7 @@
 	void SliderBP::Prepare(gge::GGEMain *main) {
 		ResourceBase::Prepare(main);
 
-		TickSound=(SoundResource*)file->FindObject(guid_ticksound);
+		TickSound=dynamic_cast<resource::SoundResource*>(file->FindObject(guid_ticksound));
 	}
 } }
 
--- a/Widgets/SliderBP.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderBP.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,8 +6,6 @@
 #include "IWidgetContainer.h"
 #include <math.h>
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_SLIDER			0x05860000
@@ -15,23 +13,23 @@
 #define GID_SLIDER_NAMES	0x05860102
 #define GID_SLIDER_NAME		0x05860103
 
-	class SliderBP : public ResourceBase, public IWidgetBluePrint
+	class SliderBP : public resource::ResourceBase, public IWidgetBluePrint
 	{
-		friend ResourceBase *LoadSlider(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase *LoadSlider(resource::ResourceFile*,FILE*,int);
 		friend class SliderBase;
 	public:
-		SoundResource *TickSound;
+		resource::SoundResource *TickSound;
 
 		SliderBP();
 		virtual int getGID() { return GID_SLIDER; }
 		virtual IWidgetObject *Create(IWidgetContainer &Container,int X,int Y,int Cx,int Cy);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 		void Prepare(gge::GGEMain *main);
 
 
 	protected:
 		utils::Collection<SliderStyleGroup> StyleGroups;
 		Guid *guid_ticksound;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 	};
 } }
--- a/Widgets/SliderBase.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderBase.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,10 +1,14 @@
 #include "SliderBase.h"
 #include "../Engine/Wave.h"
 #include "WidgetRegistry.h"
+#include "../Engine/GGEMain.h"
+
+
 #ifndef SLIDER_TIMEOUT
-#define SLIDER_TIMEOUT	250
+#	define SLIDER_TIMEOUT	250
 #endif
-#include "../Engine/GGEMain.h"
+
+using namespace gge::resource;
 
 
 namespace gge { namespace widgets {
@@ -155,7 +159,7 @@
 
 		symbollayer.EnableClipping=false;
 		layer.Add(symbollayer, 1);
-		symbolmover=new LayerMover(symbollayer);
+		symbolmover=new effects::LayerMover(symbollayer);
 		symbolmover->Setup(Point(0,0), Point(0,0), 0);
 
 		layer.Add(rulelayer,3);
@@ -164,7 +168,7 @@
 		overlayer.isVisible=false;
 		layer.Add(overlayer,2);
 
-		overlayresizer=new LayerResizer(overlayer);
+		overlayresizer=new effects::LayerResizer(overlayer);
 		overlayresizer->Setup(gge::Rectangle(0,0,100,100),gge::Rectangle(0,0,100,100),0);
 
 
@@ -1482,9 +1486,9 @@
 		if(goup) return;
 		int time=SLIDER_TIMEOUT;
 		if(golarge)
-			intervaltimeout=(FastMoveTime/(maximum-minimum))*largeincrement;
+			intervaltimeout=(int)(FastMoveTime/(maximum-minimum))*largeincrement;
 		else
-			intervaltimeout=(ButtonMoveTime/(maximum-minimum))*buttonincrement;
+			intervaltimeout=(int)(ButtonMoveTime/(maximum-minimum))*buttonincrement;
 
 		if(!delayclicks)
 			time=intervaltimeout;
--- a/Widgets/SliderBase.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderBase.h	Thu Apr 21 01:53:15 2011 +0000
@@ -13,10 +13,6 @@
 #include "SliderBP.h"
 #include "Frame.h"
 
-using namespace gge;
-using namespace gre;
-using namespace geffects;
-
 #define SLIDER_CLICK_DOWNDURATION	100
 
 namespace gge { namespace widgets {
@@ -205,15 +201,15 @@
 		
 		utils::Collection<SliderLocationName> ticknames;
 
-		Colorizable2DLayer textlayer;
+		graphics::Colorizable2DLayer textlayer;
 		WidgetLayer textwlayer;
 		WidgetLayer ticklayer;
 		WidgetLayer	symbollayer;
 		WidgetLayer	rulelayer;
-		Basic2DLayer	overlayer;
+		graphics::Basic2DLayer	overlayer;
 
-		LayerMover *symbolmover;
-		LayerResizer *overlayresizer;
+		effects::LayerMover *symbolmover;
+		effects::LayerResizer *overlayresizer;
 
 		IntervalObject *goup;
 		IntervalObject *godown;
@@ -265,4 +261,3 @@
 		float prevrat;
 	};
 } }
-
--- a/Widgets/SliderElement.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderElement.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -1,6 +1,8 @@
 #include "SliderElement.h"
 #include "Slider.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	SliderElement::SliderElement() {
 		font_guid=NULL;
@@ -74,7 +76,7 @@
 
 		return *this;
 	}
-	SliderElement &SliderElement::DrawOverlay(Basic2DLayer &Target) {
+	SliderElement &SliderElement::DrawOverlay(graphics::Basic2DLayer &Target) {
 		int h,w;
 		int y;
 
@@ -192,7 +194,7 @@
 
 		return *this;
 	}
-	SliderElement &SliderElement::DrawTickNumbers(Colorizable2DLayer &Target, float Distance, float Start, float Increment, float End, string Format) {
+	SliderElement &SliderElement::DrawTickNumbers(graphics::Colorizable2DLayer &Target, float Distance, float Start, float Increment, float End, string Format) {
 		float v, y, x;
 		char temp[40];
 
@@ -240,7 +242,7 @@
 
 		return *this;
 	}
-	SliderElement &SliderElement::DrawTickNames(Colorizable2DLayer &Target, float Distance, utils::Collection<SliderLocationName> &Texts, bool useLocations, float min, float max) {
+	SliderElement &SliderElement::DrawTickNames(graphics::Colorizable2DLayer &Target, float Distance, utils::Collection<SliderLocationName> &Texts, bool useLocations, float min, float max) {
 		float x, y;
 
 		if(useLocations) {
--- a/Widgets/SliderElement.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderElement.h	Thu Apr 21 01:53:15 2011 +0000
@@ -11,10 +11,6 @@
 #include "Rectangle.h"
 #include <string>
 
-using namespace gre;
-using namespace gge;
-using namespace std;
-
 #define GID_SLIDER_ELEMENT			0x05260000
 #define GID_SLIDER_ELEMENT_PROPS	0x05260101
 
@@ -48,25 +44,25 @@
 		}
 	};
 
-	class SliderElement : public ResourceBase
+	class SliderElement : public resource::ResourceBase
 	{
-		friend ResourceBase *LoadSliderElement(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase *LoadSliderElement(resource::ResourceFile*,FILE*,int);
 		friend class SliderStyleGroup;
 		friend class SliderBase;
 	public:
 		SliderElement(void);
 
 		virtual int getGID() { return GID_SLIDER_ELEMENT; }
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 		virtual void Prepare(gge::GGEMain *main);
 
 		SliderElement &DrawRule(WidgetLayer &Target);
 		SliderElement &DrawTickMarks(WidgetLayer &Target, float Distance);
-		SliderElement &DrawTickNumbers(Colorizable2DLayer &Target, float Distance, float Start, float Increment, float End, string Format);
-		SliderElement &DrawTickNames(Colorizable2DLayer &Target, float Distance, utils::Collection<SliderLocationName> &Texts,bool useLocations, float min, float max);
+		SliderElement &DrawTickNumbers(graphics::Colorizable2DLayer &Target, float Distance, float Start, float Increment, float End, string Format);
+		SliderElement &DrawTickNames(graphics::Colorizable2DLayer &Target, float Distance, utils::Collection<SliderLocationName> &Texts,bool useLocations, float min, float max);
 		SliderElement &DrawLocatedTicks(WidgetLayer &Target, float Distance, utils::Collection<SliderLocationName> &Texts, float min, float max);
 		SliderElement &DrawSymbol(WidgetLayer &Target);
-		SliderElement &DrawOverlay(Basic2DLayer &Target);
+		SliderElement &DrawOverlay(graphics::Basic2DLayer &Target);
 		SliderElement &ReadyAnimation(bool Backwards);
 		SliderElement &Reverse();
 
@@ -74,9 +70,9 @@
 
 		int Duration;
 
-		BitmapFontResource *Font;
-		SoundResource *Sound;
-		RGBint ForeColor,ShadowColor;
+		resource::BitmapFontResource *Font;
+		resource::SoundResource *Sound;
+		graphics::RGBint ForeColor,ShadowColor;
 		Point Offset;
 		Point ShadowOffset;
 		Point TextOffset;
@@ -96,13 +92,13 @@
 	protected:
 		Guid *font_guid;
 		Guid *sound_guid;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 
 		SliderStyles style;
 
-		ResizableObject *Rule;
-		ResizableObject *Overlay;
-		ResizableObject *Symbol;
-		Buffered2DGraphic *Tick;
+		resource::ResizableObject *Rule;
+		resource::ResizableObject *Overlay;
+		resource::ResizableObject *Symbol;
+		graphics::Buffered2DGraphic *Tick;
 	};
 } }
--- a/Widgets/SliderLoader.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderLoader.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -8,6 +8,8 @@
 #include "SliderElement.h"
 #include "SliderStyleGroup.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 
 	ResourceBase* LoadSlider(ResourceFile* file,FILE* gfile,int sz) {
--- a/Widgets/SliderStyleGroup.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/SliderStyleGroup.h	Thu Apr 21 01:53:15 2011 +0000
@@ -4,21 +4,20 @@
 #include "SliderElement.h"
 #include "Button.h"
 
-using namespace gre;
 
 namespace gge { namespace widgets {
 
 #define GID_SLIDER_GRP			0x5360000
 #define GID_SLIDER_GRP_PROPS	0x5360101
 
-	class SliderStyleGroup : public ResourceBase
+	class SliderStyleGroup : public resource::ResourceBase
 	{
-		friend ResourceBase* LoadSliderStyleGroup(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase* LoadSliderStyleGroup(resource::ResourceFile*,FILE*,int);
 	public:
 		SliderStyleGroup(void);
 		virtual int getGID() { return GID_SLIDER_GRP; }
-		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual void Prepare(GGEMain *main);
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 		int PreferredWidth;
 		int PreferredHeight;
@@ -49,7 +48,7 @@
 
 	protected:
 
-		ResourceFile* file;
+		resource::ResourceFile* file;
 
 		Guid *guid_normalstyle		,
 			 *guid_hoverstyle		,
--- a/Widgets/Textbox.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Textbox.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,6 +3,8 @@
 #include "../Resource/SoundResource.h"
 #include "../Engine/GGEMain.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	Textbox::Textbox(TextboxBP *BluePrint,IWidgetContainer &container) : 
 		IWidgetObject(container),
--- a/Widgets/Textbox.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/Textbox.h	Thu Apr 21 01:53:15 2011 +0000
@@ -61,7 +61,7 @@
 		Textbox &SelectAll();
 
 		TextboxStates	currentState();
-		ImageAnimation *Caret;
+		resource::ImageAnimation *Caret;
 
 		virtual	void	SetText(string text);
 
@@ -78,7 +78,7 @@
 		TextboxStates nextstate;
 		unsigned int currentanimstart;
 		unsigned int currentanimend;
-		Colorizable2DLayer textlayer;
+		graphics::Colorizable2DLayer textlayer;
 
 		TextboxBP *BluePrint;
 		unsigned int caretposition;
--- a/Widgets/TextboxBP.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxBP.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -20,6 +20,6 @@
 		if(!Caret->Subitems.getCount())
 			Caret=NULL;
 
-		TypingSound=(SoundResource*)file->FindObject(guid_typingsound);
+		TypingSound=(resource::SoundResource*)file->FindObject(guid_typingsound);
 	}
 } }
--- a/Widgets/TextboxBP.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxBP.h	Thu Apr 21 01:53:15 2011 +0000
@@ -7,8 +7,6 @@
 #include "Textbox.h"
 #include <math.h>
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_TEXTBOX			0x05830000
@@ -16,22 +14,22 @@
 #define GID_TEXTBOX_NAMES	0x05830102
 #define GID_TEXTBOX_NAME	0x05830103
 
-	class TextboxBP : public ResourceBase, public IWidgetBluePrint
+	class TextboxBP : public resource::ResourceBase, public IWidgetBluePrint
 	{
-		friend ResourceBase *LoadTextbox(ResourceFile*,FILE*,int);
+		friend ResourceBase *LoadTextbox(resource::ResourceFile*,FILE*,int);
 		friend class Textbox;
 	public:
 		TextboxBP(void);
 		virtual int getGID() { return GID_TEXTBOX; }
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 		virtual IWidgetObject *Create(IWidgetContainer &Container,int X,int Y,int Cx,int Cy);
-		SoundResource *TypingSound;
-		AnimationResource *Caret;
-		void Prepare(gge::GGEMain *main);
+		resource::SoundResource *TypingSound;
+		resource::AnimationResource *Caret;
+		void Prepare(GGEMain *main);
 
 	protected:
 		utils::Collection<TextboxStyleGroup> StyleGroups;
 		Guid *guid_typingsound;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 	};
 } }
--- a/Widgets/TextboxElement.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxElement.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -3,6 +3,8 @@
 #include "Line.h"
 #include "WidgetRegistry.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	TextboxElement::TextboxElement(void) {
 		Visual=NULL;
@@ -44,7 +46,7 @@
 		return *this;
 	}
 
-	TextboxElement &TextboxElement::Draw(WidgetLayer &layer,Colorizable2DLayer &textlayer,string Caption) {
+	TextboxElement &TextboxElement::Draw(WidgetLayer &layer,graphics::Colorizable2DLayer &textlayer,string Caption) {
 		int x=Offset.x;
 		int y=Offset.y;
 		
--- a/Widgets/TextboxElement.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxElement.h	Thu Apr 21 01:53:15 2011 +0000
@@ -9,10 +9,6 @@
 #include "../Resource/ResizableObject.h"
 #include <string>
 
-using namespace gre;
-using namespace gge;
-using namespace std;
-
 namespace gge { namespace widgets {
 
 #define GID_TEXTBOX_ELEMENT			0x5230000
@@ -20,25 +16,25 @@
 
 	class Textbox;
 
-	class TextboxElement : public ResourceBase
+	class TextboxElement : public resource::ResourceBase
 	{
-		friend ResourceBase *LoadTextboxElement(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase *LoadTextboxElement(resource::ResourceFile*,FILE*,int);
 		friend class TextboxStyleGroup;
 		friend class Textbox;
 	public:
 		TextboxElement(void);
 
 		virtual int getGID() { return GID_TEXTBOX_ELEMENT; }
-		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual void Prepare(GGEMain *main);
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
-		TextboxElement &Draw(WidgetLayer &layer,Colorizable2DLayer &textlayer,string Caption);
+		TextboxElement &Draw(WidgetLayer &layer,graphics::Colorizable2DLayer &textlayer,string Caption);
 		TextboxElement &ReadyAnimation(bool Backwards);
 		TextboxElement &Reverse();
 
-		BitmapFontResource *Font;
-		SoundResource *Sound;
-		RGBint ForeColor,ShadowColor,SelectionColor,SelectionHighlight,SelectionShadow;
+		resource::BitmapFontResource *Font;
+		resource::SoundResource *Sound;
+		graphics::RGBint ForeColor,ShadowColor,SelectionColor,SelectionHighlight,SelectionShadow;
 		Alignment TextAlign;
 		int Duration;
 		Bounds TextMargins;
@@ -47,18 +43,18 @@
 		int detectChar(int x);
 		Textbox *Parent;
 
-		ImageAnimation *Caret;
+		resource::ImageAnimation *Caret;
 
 
 	protected:
 		Guid *font_guid;
 		Guid *sound_guid;
-		ResourceFile *file;
+		resource::ResourceFile *file;
 		int lx;
 		TextAlignment calign;
 
-		ResizableObject *Visual;
-		ResizableObject *SelectionRect;
+		resource::ResizableObject *Visual;
+		resource::ResizableObject *SelectionRect;
 		Bounds SelectionOffset;
 	};
 } }
--- a/Widgets/TextboxLoader.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxLoader.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -4,6 +4,8 @@
 #include "TextboxElement.h"
 #include "Line.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	void eatchunk(FILE* f,int size);
 
--- a/Widgets/TextboxStyleGroup.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/TextboxStyleGroup.h	Thu Apr 21 01:53:15 2011 +0000
@@ -3,21 +3,19 @@
 #include "../Resource/ResourceBase.h"
 #include "TextboxElement.h"
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 #define GID_TEXTBOX_GRP			0x5330000
 #define GID_TEXTBOX_GRP_PROPS	0x5330101
 
-	class TextboxStyleGroup : public ResourceBase
+	class TextboxStyleGroup : public resource::ResourceBase
 	{
-		friend ResourceBase* LoadTextboxStyleGroup(ResourceFile*,FILE*,int);
+		friend resource::ResourceBase* LoadTextboxStyleGroup(resource::ResourceFile*,FILE*,int);
 	public:
 		TextboxStyleGroup(void);
 		virtual int getGID() { return GID_TEXTBOX_GRP; }
 		virtual void Prepare(gge::GGEMain *main);
-		virtual bool Save(ResourceFile *File, FILE *Data) { return false; }
+		virtual bool Save(resource::ResourceFile *File, FILE *Data) { return false; }
 
 		enum {
 			SIZE_RESIZABLE,
@@ -44,7 +42,7 @@
 						RevActive2NormalState;
 
 	protected:
-		ResourceFile* file;
+		resource::ResourceFile* file;
 
 		Guid *guid_normalstyle	,
 			 *guid_hoverstyle	,
--- a/Widgets/VirtualFrame.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/VirtualFrame.h	Thu Apr 21 01:53:15 2011 +0000
@@ -6,9 +6,6 @@
 #include "IWidgetObject.h"
 #include "IWidgetContainer.h"
 
-using namespace gre;
-using namespace gge;
-
 namespace gge { namespace widgets {
 	class VirtualFrame;
 
--- a/Widgets/WidgetMain.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/WidgetMain.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -18,6 +18,8 @@
 #include "FrameBP.h"
 #include "ResizableObjectResource.h"
 
+using namespace gge::resource;
+
 #define DIALOG_LAYER_ZORDER		-10
 
 namespace gge { namespace widgets {
@@ -53,4 +55,31 @@
 
 		File->Loaders.Add(new ResourceLoader(GID_RESIZABLEOBJECT, LoadResizableObject)); 
 	}
+	
+	bool WidgetLayer::PropagateMouseEvent(input::MouseEventType event, int x, int y, void *data) {
+		if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H) || (event&input::MOUSE_EVENT_UP) || (input::pressedObject && event&input::MOUSE_EVENT_MOVE)) ) {
+			if(LayerBase::PropagateMouseEvent(event, x, y, data))
+				return true;
+
+			if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H) || (event&input::MOUSE_EVENT_UP) || (input::pressedObject->parent==this && event&input::MOUSE_EVENT_MOVE)) )
+				return BasicPointerTarget::PropagateMouseEvent(event, x-X, y-Y, data);
+			else
+				return false;
+		}
+
+		return false;
+	}
+	bool WidgetLayer::PropagateMouseScrollEvent(int amount, input::MouseEventType event, int x, int y, void *data) {
+		if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H)) ) {
+			if(LayerBase::PropagateMouseScrollEvent(amount, event, x, y, data))
+				return true;
+
+			if( isVisible && ((x>X && y>Y && x<X+W && y<Y+H)) )
+				return BasicPointerTarget::PropagateMouseScrollEvent(amount, event, x-X, y-Y, data);
+			else
+				return false;
+		}
+
+		return false;
+	}
 } }
--- a/Widgets/WidgetMain.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/WidgetMain.h	Thu Apr 21 01:53:15 2011 +0000
@@ -8,19 +8,28 @@
 	class GGEMain;
 }
 
-namespace gre {
+namespace gge { namespace resource {
 	class ResourceFile;
-}
-
-using namespace gge;
-using namespace gre;
-
+} }
 
 namespace gge { namespace widgets {
-	void RegisterWidgetLoaders(ResourceFile *File);
-	inline void RegisterWidgetLoaders(ResourceFile &File) { RegisterWidgetLoaders(&File); }
+	void RegisterWidgetLoaders(resource::ResourceFile *File);
+	inline void RegisterWidgetLoaders(resource::ResourceFile &File) { RegisterWidgetLoaders(&File); }
 	void InitializeWidgets(GGEMain *Main);
 
+	class WidgetLayer :  public input::BasicPointerTarget, public graphics::Basic2DLayer {
+	public:
+		WidgetLayer(int X=0, int Y=0, int W=100, int H=100) : graphics::Basic2DLayer(X,Y,W,H) {
+		}
+		////Renders this layer
+		virtual void Render() { graphics::Basic2DLayer::Render(); }
+
+	protected:
+		////Processes the mouse event for the current layer, default
+		/// handling is to pass the request to the sub-layers
+		virtual bool PropagateMouseEvent(input::MouseEventType event, int x, int y, void *data);
+		virtual bool PropagateMouseScrollEvent(int amount, input::MouseEventType event, int x, int y, void *data);
+	};
+
 	extern WidgetLayer *DialogLayer;
 } }
-
--- a/Widgets/WidgetRegistry.cpp	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/WidgetRegistry.cpp	Thu Apr 21 01:53:15 2011 +0000
@@ -2,6 +2,8 @@
 #include "LinearOrganizer.h"
 #include "../Resource/DataResource.h"
 
+using namespace gge::resource;
+
 namespace gge { namespace widgets {
 	
 	void WidgetRegistry::DiscoverWidgets(ResourceFile *file) {
@@ -15,7 +17,7 @@
 		Pointers.Fetch(file->Root().asFolder(1));
 		
 		FolderResource *fonts=file->Root().asFolder(2);
-		fonttheme=dynamic_cast<gre::FontTheme *>(fonts->getItem(0));
+		fonttheme=dynamic_cast<resource::FontTheme *>(fonts->getItem(0));
 		normal=fonts->asBitmapFont(1);
 		if(fonts->getCount()>2)
 			small=fonts->asBitmapFont(2);
--- a/Widgets/WidgetRegistry.h	Sun Apr 10 10:29:50 2011 +0000
+++ b/Widgets/WidgetRegistry.h	Thu Apr 21 01:53:15 2011 +0000
@@ -19,8 +19,6 @@
 #include "../Engine/Font.h"
 #undef small
 
-using namespace gre;
-
 namespace gge { namespace widgets {
 
 	class LinearOrganizer;
@@ -58,7 +56,7 @@
 					*tabButton
 		;
 
-		BitmapFontResource *small,
+		resource::BitmapFontResource *small,
 						   *normal,
 						   *bold,
 						   *italic,
@@ -67,7 +65,7 @@
 						   *h3
 		;
 
-		FontTheme *fonttheme;
+		resource::FontTheme *fonttheme;
 
 		LineResource *hSeparator,
 					 *vSeparator,
@@ -109,7 +107,7 @@
 
 		FrameBP		*DialogBP;
 
-		ImageResource* background;
+		resource::ImageResource* background;
 
 		Button &createButton(IWidgetContainer &container, string text="", int x=0, int y=0, int w=-1, int h=-1);
 		Button &createButton(string text="", int w=-1, int h=-1, int x=0, int y=0);
@@ -179,8 +177,8 @@
 			Widgets.Delete(object);
 		}
 
-		void DiscoverWidgets(ResourceFile *file);
-		void DiscoverWidgets(ResourceFile &file) { DiscoverWidgets(&file); }
+		void DiscoverWidgets(resource::ResourceFile *file);
+		void DiscoverWidgets(resource::ResourceFile &file) { DiscoverWidgets(&file); }
 
 		FrameBP &DialogFrameBP(bool hasScroll=false);
 		FrameBP &PictureFrameBP(bool hasScroll=false);
@@ -191,11 +189,11 @@
 		LinearOrganizer &createDialogLinearOrganizer(int w, int h, int x=0, int y=0, ScrollbarDisplayStates scroll=SDS_WhenNeeded);
 		LinearOrganizer &createDialogLinearOrganizer(int w, int h, ScrollbarDisplayStates scroll=SDS_WhenNeeded) { return createDialogLinearOrganizer(w, h, 0, 0, scroll); }
 
-		FontTheme &FontTheme() { return *fonttheme; }
+		resource::FontTheme &FontTheme() { return *fonttheme; }
 
-		RGBint titleColor;
-		RGBint textColor;
-		RGBint hintColor;
+		graphics::RGBint titleColor;
+		graphics::RGBint textColor;
+		graphics::RGBint hintColor;
 
 		utils::Collection<IWidgetObject> Widgets;
 		utils::Collection<ResizableRect> Rectangles;

mercurial