diff --git a/Makefile b/Makefile index c71a38d96..d8c099bd5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ STRLOWERCASE = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) OS = $(strip $(call STRLOWERCASE, $(shell uname) ) ) + SDLVERSION = $(shell sdl-config --version) export CFLAGS = -Wall -Wno-unknown-pragmas $(FINALFLAGS) $(BUILDFLAGS) $(BACKENDFLAGS) @@ -71,7 +72,12 @@ ifeq ($(BACKEND_SDL), yes) SDL_BACKEND_LINK = libs/$(OS)/libSDL.a SDL_BACKEND_SRC = $(wildcard ./src/window/backend/SDL13/*.cpp) else + ifeq ($(OS), darwin) + SDL_BACKEND_LINK = -framework Cocoa -lSDL -lSDLmain + else SDL_BACKEND_LINK = -lSDL + endif + SDL_BACKEND_SRC = $(wildcard ./src/window/backend/SDL/*.cpp) endif @@ -83,7 +89,13 @@ else endif ifeq ($(BACKEND_ALLEGRO), yes) + + ifeq ($(OS), darwin) + ALLEGRO_BACKEND_LINK = -lallegro -lallegro_main + else ALLEGRO_BACKEND_LINK = -lallegro + endif + ALLEGRO_BACKEND_SRC = $(wildcard ./src/window/backend/allegro5/*.cpp) ALLEGRO_DEFINE = -DEE_BACKEND_ALLEGRO_ACTIVE else @@ -121,8 +133,8 @@ PLATFORMSRC = $(wildcard ./src/window/platform/x11/*.cpp) else ifeq ($(OS), darwin) -LIBS = -lfreetype -lSDL -lSDLmain -framework OpenGL -framework OpenAL -framework Cocoa -framework CoreFoundation -framework AGL $(LIBSNDFILE) -OTHERINC = -I/usr/include/freetype2 +LIBS = -lfreetype -framework OpenGL -framework OpenAL -framework CoreFoundation -framework AGL $(LIBSNDFILE) $(SDL_BACKEND_LINK) $(ALLEGRO_BACKEND_LINK) +OTHERINC = -I/usr/include/freetype2 -I/usr/local/include/freetype2 PLATFORMSRC = $(wildcard ./src/window/platform/osx/*.cpp) else diff --git a/src/gaming/cisomap.cpp b/src/gaming/cisomap.cpp index ef637d3fb..28484ab35 100755 --- a/src/gaming/cisomap.cpp +++ b/src/gaming/cisomap.cpp @@ -2,7 +2,7 @@ namespace EE { namespace Gaming { -cIsoMap::cIsoMap( cWindow * window ) : +cIsoMap::cIsoMap( Window::cWindow * window ) : mWindow( window ), mOffsetX(0), mOffsetY(0), diff --git a/src/gaming/cisomap.hpp b/src/gaming/cisomap.hpp index 15ba99ac3..7192fa6bc 100755 --- a/src/gaming/cisomap.hpp +++ b/src/gaming/cisomap.hpp @@ -31,7 +31,7 @@ class EE_API cIsoTile { class EE_API cIsoMap { public: - cIsoMap( cWindow * window = NULL ); + cIsoMap( Window::cWindow * window = NULL ); ~cIsoMap(); @@ -81,7 +81,7 @@ class EE_API cIsoMap { protected: std::vector Map; - cWindow * mWindow; + Window::cWindow * mWindow; eeColor mMapAmbientColor; eeUint mMapWidth; eeUint mMapHeight; diff --git a/src/gaming/cmap.cpp b/src/gaming/cmap.cpp index aa7df1532..889257b1a 100644 --- a/src/gaming/cmap.cpp +++ b/src/gaming/cmap.cpp @@ -47,7 +47,7 @@ void cMap::DeleteLayers() { mLayerCount = 0; } -void cMap::Create( eeSize Size, Uint32 MaxLayers, eeSize TileSize, Uint32 Flags, eeSize viewSize, cWindow * Window ) { +void cMap::Create( eeSize Size, Uint32 MaxLayers, eeSize TileSize, Uint32 Flags, eeSize viewSize, Window::cWindow * Window ) { Reset(); mWindow = Window; diff --git a/src/gaming/cmap.hpp b/src/gaming/cmap.hpp index 8cd524417..a1b1a4904 100644 --- a/src/gaming/cmap.hpp +++ b/src/gaming/cmap.hpp @@ -26,7 +26,7 @@ class cMap { virtual ~cMap(); - virtual void Create( eeSize Size, Uint32 MaxLayers, eeSize TileSize, Uint32 Flags = 0, eeSize viewSize = eeSize( 800, 600 ), cWindow * Window = NULL ); + virtual void Create( eeSize Size, Uint32 MaxLayers, eeSize TileSize, Uint32 Flags = 0, eeSize viewSize = eeSize( 800, 600 ), Window::cWindow * Window = NULL ); virtual cLayer * AddLayer( Uint32 Type, Uint32 flags, std::string name ); @@ -122,7 +122,7 @@ class cMap { void SetCreateGameObjectCallback( const CreateGOCb& Cb ); protected: - cWindow * mWindow; + Window::cWindow * mWindow; cLayer** mLayers; Uint32 mFlags; Uint32 mMaxLayers; diff --git a/src/graphics/base.hpp b/src/graphics/base.hpp index c55d9e63b..386246b91 100644 --- a/src/graphics/base.hpp +++ b/src/graphics/base.hpp @@ -3,6 +3,12 @@ #include "../base.hpp" +#ifdef EE_64BIT +#define GL_FP GL_DOUBLE +#else +#define GL_FP GL_FLOAT +#endif + #if ( defined( EE_GLES2 ) || defined( EE_GLES1 ) ) && !defined( EE_GLES ) #define EE_GLES #endif diff --git a/src/graphics/cbatchrenderer.cpp b/src/graphics/cbatchrenderer.cpp index 6fbe40968..b8dd4f755 100755 --- a/src/graphics/cbatchrenderer.cpp +++ b/src/graphics/cbatchrenderer.cpp @@ -120,12 +120,12 @@ void cBatchRenderer::Flush() { Uint32 alloc = sizeof(eeVertex) * NumVertex; - GLi->VertexPointer ( 2, GL_FLOAT , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) , alloc ); + GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) , alloc ); GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) + sizeof(eeTexCoord) , alloc ); if ( NULL != mTexture ) { cTextureFactory::instance()->Bind( mTexture ); - GLi->TexCoordPointer( 2, GL_FLOAT , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) , alloc ); + GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) , alloc ); } else { GLi->Disable( GL_TEXTURE_2D ); GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY ); diff --git a/src/graphics/cconsole.cpp b/src/graphics/cconsole.cpp index 397ed0656..88a999366 100755 --- a/src/graphics/cconsole.cpp +++ b/src/graphics/cconsole.cpp @@ -9,7 +9,7 @@ using namespace EE::Window; namespace EE { namespace Graphics { -cConsole::cConsole( cWindow * window ) : +cConsole::cConsole( Window::cWindow * window ) : mWindow( window ), mConColor(35, 47, 73, 230), mConLineColor(55, 67, 93, 230), diff --git a/src/graphics/cconsole.hpp b/src/graphics/cconsole.hpp index d396d67e9..8364bd4e8 100755 --- a/src/graphics/cconsole.hpp +++ b/src/graphics/cconsole.hpp @@ -16,7 +16,7 @@ class EE_API cConsole{ //! The Console Callback return a vector of parameters ( String ) typedef cb::Callback1& > ConsoleCallback; - cConsole( cWindow * window = NULL ); + cConsole( Window::cWindow * window = NULL ); ~cConsole(); @@ -123,7 +123,7 @@ class EE_API cConsole{ std::deque < String > mCmdLog; std::deque < String > mLastCommands; - cWindow * mWindow; + Window::cWindow * mWindow; eeColorA mConColor; eeColorA mConLineColor; diff --git a/src/graphics/cfont.cpp b/src/graphics/cfont.cpp index ae2119dee..5abec6f4e 100644 --- a/src/graphics/cfont.cpp +++ b/src/graphics/cfont.cpp @@ -293,8 +293,8 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con Uint32 alloc = numvert * sizeof(eeVertexCoords); GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast( &Colors[0] ) , alloc ); - GLi->TexCoordPointer( 2, GL_FLOAT , sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) , alloc ); - GLi->VertexPointer ( 2, GL_FLOAT , sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc ); + GLi->TexCoordPointer( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) , alloc ); + GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc ); #ifndef EE_GLES GLi->DrawArrays( GL_QUADS, 0, numvert ); @@ -464,8 +464,8 @@ void cFont::SubDraw( const String& Text, const eeFloat& X, const eeFloat& Y, con Uint32 alloc = numvert * sizeof(eeVertexCoords); GLi->ColorPointer ( 4, GL_UNSIGNED_BYTE , 0 , reinterpret_cast( &mColors[0] ) , alloc ); - GLi->TexCoordPointer ( 2, GL_FLOAT , sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) , alloc ); - GLi->VertexPointer ( 2, GL_FLOAT , sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc ); + GLi->TexCoordPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) , alloc ); + GLi->VertexPointer ( 2, GL_FP , sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) + sizeof(eeFloat) * 2 , alloc ); #ifndef EE_GLES GLi->DrawArrays( GL_QUADS, 0, numvert ); diff --git a/src/graphics/cframebuffer.cpp b/src/graphics/cframebuffer.cpp index 7bddfa207..707cc067e 100644 --- a/src/graphics/cframebuffer.cpp +++ b/src/graphics/cframebuffer.cpp @@ -9,7 +9,7 @@ using namespace EE::Graphics::Private; namespace EE { namespace Graphics { -cFrameBuffer * cFrameBuffer::CreateNew( const Uint32& Width, const Uint32& Height, bool DepthBuffer, cWindow * window ) { +cFrameBuffer * cFrameBuffer::CreateNew( const Uint32& Width, const Uint32& Height, bool DepthBuffer, Window::cWindow * window ) { if ( cFrameBufferFBO::IsSupported() ) return eeNew( cFrameBufferFBO, ( Width, Height, DepthBuffer, window ) ); @@ -19,7 +19,7 @@ cFrameBuffer * cFrameBuffer::CreateNew( const Uint32& Width, const Uint32& Heigh return NULL; } -cFrameBuffer::cFrameBuffer( cWindow * window ) : +cFrameBuffer::cFrameBuffer( Window::cWindow * window ) : mWindow( window ), mWidth(0), mHeight(0), diff --git a/src/graphics/cframebuffer.hpp b/src/graphics/cframebuffer.hpp index 115a80f74..854600e02 100644 --- a/src/graphics/cframebuffer.hpp +++ b/src/graphics/cframebuffer.hpp @@ -12,9 +12,9 @@ namespace EE { namespace Graphics { class EE_API cFrameBuffer { public: - static cFrameBuffer * CreateNew( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, cWindow * window = NULL ); + static cFrameBuffer * CreateNew( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, Window::cWindow * window = NULL ); - cFrameBuffer( cWindow * window ); + cFrameBuffer( Window::cWindow * window ); virtual ~cFrameBuffer(); @@ -40,7 +40,7 @@ class EE_API cFrameBuffer { const bool& HasDepthBuffer() const; protected: - cWindow * mWindow; + Window::cWindow * mWindow; Int32 mWidth; Int32 mHeight; bool mHasDepthBuffer; diff --git a/src/graphics/cframebufferfbo.cpp b/src/graphics/cframebufferfbo.cpp index 27e470b46..a6525a703 100644 --- a/src/graphics/cframebufferfbo.cpp +++ b/src/graphics/cframebufferfbo.cpp @@ -9,13 +9,13 @@ bool cFrameBufferFBO::IsSupported() { return 0 != GLi->IsExtension( EEGL_EXT_framebuffer_object ); } -cFrameBufferFBO::cFrameBufferFBO( cWindow * window ) : +cFrameBufferFBO::cFrameBufferFBO( Window::cWindow * window ) : cFrameBuffer( window ), mFrameBuffer(0), mDepthBuffer(0) {} -cFrameBufferFBO::cFrameBufferFBO( const Uint32& Width, const Uint32& Height, bool DepthBuffer, cWindow * window ) : +cFrameBufferFBO::cFrameBufferFBO( const Uint32& Width, const Uint32& Height, bool DepthBuffer, Window::cWindow * window ) : cFrameBuffer( window ), mFrameBuffer(0), mDepthBuffer(0) diff --git a/src/graphics/cframebufferfbo.hpp b/src/graphics/cframebufferfbo.hpp index f4f28c681..ee7d508ae 100644 --- a/src/graphics/cframebufferfbo.hpp +++ b/src/graphics/cframebufferfbo.hpp @@ -9,11 +9,11 @@ namespace EE { namespace Graphics { class EE_API cFrameBufferFBO : public cFrameBuffer { public: - cFrameBufferFBO( cWindow * window = NULL ); + cFrameBufferFBO( Window::cWindow * window = NULL ); ~cFrameBufferFBO(); - cFrameBufferFBO( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, cWindow * window = NULL ); + cFrameBufferFBO( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, Window::cWindow * window = NULL ); bool Create( const Uint32& Width, const Uint32& Height ); diff --git a/src/graphics/cframebufferpbuffer.cpp b/src/graphics/cframebufferpbuffer.cpp index 25ce9492f..abe419e02 100644 --- a/src/graphics/cframebufferpbuffer.cpp +++ b/src/graphics/cframebufferpbuffer.cpp @@ -4,7 +4,7 @@ namespace EE { namespace Graphics { -cFrameBufferPBuffer::cFrameBufferPBuffer( cWindow * window ) +cFrameBufferPBuffer::cFrameBufferPBuffer( Window::cWindow * window ) #if EE_PLATFORM == EE_PLATFORM_WIN : cFrameBuffer( window ), mDeviceContext( NULL ), @@ -24,7 +24,7 @@ cFrameBufferPBuffer::cFrameBufferPBuffer( cWindow * window ) #endif } -cFrameBufferPBuffer::cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer, cWindow * window ) +cFrameBufferPBuffer::cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer, Window::cWindow * window ) #if EE_PLATFORM == EE_PLATFORM_WIN : cFrameBuffer( window ), mDeviceContext( NULL ), diff --git a/src/graphics/cframebufferpbuffer.hpp b/src/graphics/cframebufferpbuffer.hpp index f6b4b4316..1d8479eb1 100644 --- a/src/graphics/cframebufferpbuffer.hpp +++ b/src/graphics/cframebufferpbuffer.hpp @@ -38,7 +38,7 @@ #include #elif EE_PLATFORM == EE_PLATFORM_MACOSX //#include -#warning No PBuffer implemented on MAC +//#warning No PBuffer implemented on MAC #else #warning No PBuffer implemented on this platform #endif @@ -49,11 +49,11 @@ namespace EE { namespace Graphics { class EE_API cFrameBufferPBuffer : public cFrameBuffer { public: - cFrameBufferPBuffer( cWindow * window = NULL ); + cFrameBufferPBuffer( Window::cWindow * window = NULL ); ~cFrameBufferPBuffer(); - cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, cWindow * window = NULL ); + cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer = false, Window::cWindow * window = NULL ); bool Create( const Uint32& Width, const Uint32& Height ); diff --git a/src/graphics/cparticlesystem.cpp b/src/graphics/cparticlesystem.cpp index d27446fba..7f44bcd73 100755 --- a/src/graphics/cparticlesystem.cpp +++ b/src/graphics/cparticlesystem.cpp @@ -271,8 +271,8 @@ void cParticleSystem::Draw() { Uint32 alloc = mPCount * sizeof(cParticle); - GLi->ColorPointer ( 4, GL_FLOAT, sizeof(cParticle), reinterpret_cast( &mParticle[0] ) + sizeof(eeFloat) * 2 , alloc ); - GLi->VertexPointer ( 2, GL_FLOAT, sizeof(cParticle), reinterpret_cast( &mParticle[0] ) , alloc ); + GLi->ColorPointer ( 4, GL_FP, sizeof(cParticle), reinterpret_cast( &mParticle[0] ) + sizeof(eeFloat) * 2 , alloc ); + GLi->VertexPointer ( 2, GL_FP, sizeof(cParticle), reinterpret_cast( &mParticle[0] ) , alloc ); GLi->DrawArrays( GL_POINTS, 0, (GLsizei)mPCount ); diff --git a/src/graphics/cscrollparallax.cpp b/src/graphics/cscrollparallax.cpp index 992cbe18d..a20e555a1 100755 --- a/src/graphics/cscrollparallax.cpp +++ b/src/graphics/cscrollparallax.cpp @@ -81,7 +81,7 @@ const eeVector2f& cScrollParallax::Position() const { void cScrollParallax::Draw() { if ( NULL != mShape && mAABB.Left != mAABB.Right && mAABB.Top != mAABB.Bottom && 0 != mColor.Alpha ) { - mPos += ( ( mSpeed * (eeFloat)mElapsed.Elapsed() ) / 1000.f ); + mPos += ( ( mSpeed * (eeFloat)mElapsed.Elapsed() ) / (eeFloat)1000 ); if ( mPos.x > mAABB.Left + mRealSize.Width() || mPos.x < mAABB.Left - mRealSize.Width() ) mPos.x = mAABB.Left; diff --git a/src/graphics/cvertexbufferogl.cpp b/src/graphics/cvertexbufferogl.cpp index ef2eca059..35ca097a0 100644 --- a/src/graphics/cvertexbufferogl.cpp +++ b/src/graphics/cvertexbufferogl.cpp @@ -39,7 +39,7 @@ void cVertexBufferOGL::SetVertexStates() { /// POSITION if( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_POSITION ) ) { GLi->EnableClientState( GL_VERTEX_ARRAY ); - GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0], alloc ); + GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_POSITION ], &mVertexArray[ VERTEX_FLAG_POSITION ][0], alloc ); } else { GLi->DisableClientState( GL_VERTEX_ARRAY ); } @@ -59,7 +59,7 @@ void cVertexBufferOGL::SetVertexStates() { GLi->ClientActiveTexture( GL_TEXTURE0 + i ); GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY ); - GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0], alloc ); + GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 + i ][0], alloc ); } else { GLi->Disable( GL_TEXTURE_2D ); GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY ); @@ -68,7 +68,7 @@ void cVertexBufferOGL::SetVertexStates() { } else { if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_TEXTURE0 ) ) { GLi->EnableClientState( GL_TEXTURE_COORD_ARRAY ); - GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, sizeof(float) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0], alloc ); + GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, sizeof(eeFloat) * eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], &mVertexArray[ VERTEX_FLAG_TEXTURE0 ][0], alloc ); } else { GLi->Disable( GL_TEXTURE_2D ); GLi->DisableClientState( GL_TEXTURE_COORD_ARRAY ); diff --git a/src/graphics/cvertexbuffervbo.cpp b/src/graphics/cvertexbuffervbo.cpp index e1fab7d9e..3036baa3b 100644 --- a/src/graphics/cvertexbuffervbo.cpp +++ b/src/graphics/cvertexbuffervbo.cpp @@ -153,13 +153,13 @@ void cVertexBufferVBO::SetVertexStates() { index = GLi->GetRendererGL3()->GetStateIndex( EEGL_VERTEX_ARRAY ); if ( -1 != index ) { - glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FLOAT, GL_FALSE, 0, 0 ); + glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, GL_FALSE, 0, 0 ); } } else #endif { - GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FLOAT, 0, (char*)NULL, 0 ); + GLi->VertexPointer( eeVertexElements[ VERTEX_FLAG_POSITION ], GL_FP, 0, (char*)NULL, 0 ); } } else { GLi->DisableClientState( GL_VERTEX_ARRAY ); @@ -200,12 +200,12 @@ void cVertexBufferVBO::SetVertexStates() { index = GLi->GetRendererGL3()->GetStateIndex( EEGL_TEXTURE_COORD_ARRAY ); if ( -1 != index && 0 == i ) - glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FLOAT, GL_FALSE, 0, 0 ); + glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, GL_FALSE, 0, 0 ); } else #endif { - GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FLOAT, 0, (char*)NULL, 0 ); + GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 + i ], GL_FP, 0, (char*)NULL, 0 ); } mTextured = true; @@ -228,12 +228,12 @@ void cVertexBufferVBO::SetVertexStates() { index = GLi->GetRendererGL3()->GetStateIndex( EEGL_TEXTURE_COORD_ARRAY ); if ( -1 != index ) - glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, GL_FALSE, 0, 0 ); + glVertexAttribPointerARB( index, eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, GL_FALSE, 0, 0 ); } else #endif { - GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FLOAT, 0, (char*)NULL, 0 ); + GLi->TexCoordPointer( eeVertexElements[ VERTEX_FLAG_TEXTURE0 ], GL_FP, 0, (char*)NULL, 0 ); } mTextured = true; diff --git a/src/helper/chipmunk/chipmunk_types.h b/src/helper/chipmunk/chipmunk_types.h index 6c2d091d7..4f5d4d798 100644 --- a/src/helper/chipmunk/chipmunk_types.h +++ b/src/helper/chipmunk/chipmunk_types.h @@ -130,7 +130,12 @@ cpflerpconst(cpFloat f1, cpFloat f2, cpFloat d) } /// Hash value type. -typedef unsigned int cpHashValue; +#include "../sophist/sophist.h" +#if 1 == SOPHIST_pointer64 +typedef SOPHIST_uint64 cpHashValue; +#else +typedef SOPHIST_uint32 cpHashValue; +#endif /// Chipmunk's boolean type. /// Oh C, how we love to define our own boolean types to get compiler compatibility diff --git a/src/math/math.cpp b/src/math/math.cpp index 2c8b8e42f..fc29ad1f3 100755 --- a/src/math/math.cpp +++ b/src/math/math.cpp @@ -16,9 +16,11 @@ eeInt eeRandi( const eeInt& fMin, const eeInt& fMax ) { return (eeInt)(fMin + (fMax - fMin + 1) * ( rand() / ( (eeFloat) RAND_MAX + 1) ) ); } +#ifndef EE_64BIT eeDouble eeRound( eeDouble r ) { return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5); } +#endif eeFloat eeRound( eeFloat r ) { return (r > 0.0f) ? floor(r + 0.5f) : ceil(r - 0.5f); diff --git a/src/math/math.hpp b/src/math/math.hpp index ae666f972..7b25261aa 100755 --- a/src/math/math.hpp +++ b/src/math/math.hpp @@ -57,7 +57,9 @@ T LineAngle( const T& X1, const T& Y1, const T& X2, const T& Y2 ) { return eeatan2( (eeFloat)(Y2 - Y1), (eeFloat)(X2 - X1) ) * EE_180_PI; } +#ifndef EE_64BIT eeDouble EE_API eeRound( eeDouble r ); +#endif eeFloat EE_API eeRound( eeFloat r ); diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 837651b14..de5639230 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -27,6 +27,7 @@ void cEETest::Init() { mAxisX = 0; mAxisY = 0; + mCurDemo = 0xFFFFFF; MyPath = GetProcessPath(); @@ -125,7 +126,7 @@ void cEETest::Init() { if ( NULL != mFBO ) mFBO->ClearColor( eeColorAf( 0, 0, 0, 0.5f ) ); - eePolygon2f Poly = CreateRoundedPolygon( 0.f, 0.f, 256.f, 50.f ); + eePolygon2f Poly = CreateRoundedPolygon( 0, 0, 256, 50 ); mVBO = cVertexBuffer::Create( VERTEX_FLAG_GET( VERTEX_FLAG_POSITION ) | VERTEX_FLAG_GET( VERTEX_FLAG_COLOR ), DM_POLYGON ); @@ -852,24 +853,6 @@ void cEETest::LoadTextures() { CreateTiling(Wireframe); Log->Writef( "Map creation time: %f", te.Elapsed() ); - - cMTRand Rand( 0xFF00FF00 ); - /*mMap = eeNew( cMap, () ); - mMap->Create( eeSize(25,25), 8, eeSize(32,32), MAP_FLAG_CLAMP_BODERS | MAP_FLAG_CLIP_AREA ); - mMap->AddLayer( MAP_LAYER_TILED, 0, "ground" ); - mMap->Position( eeVector2i( mWindow->GetWidth() / 2 - mMap->ViewSize().Width() / 2, mWindow->GetHeight() / 2 - mMap->ViewSize().Height() / 2 ) ); - - cTileLayer * TLayer = reinterpret_cast ( mMap->GetLayer(0) ); - - for ( x = 0; x < mMap->Size().Width(); x++ ) { - for ( y = 0; y < mMap->Size().Height(); y++ ) { - TLayer->AddGameObject( - eeNew( - cGameObjectShape, ( GObjFlags::GAMEOBJECT_STATIC, Tiles[ Rand.RandRange( 0, 5 ) ] ) - ), eeVector2i( x, y ) - ); - } - }*/ } void cEETest::RandomizeHeights() { @@ -999,7 +982,7 @@ void cEETest::Screen2() { if ( mUseShaders ) { mBlurFactor = ( 1.5f * 0.01f ) - ( scale * 0.01f ); mShaderProgram->Bind(); - mShaderProgram->SetUniform( "blurfactor" , mBlurFactor ); + mShaderProgram->SetUniform( "blurfactor" , (float)mBlurFactor ); } TNP[6]->DrawFast( PlanetX, PlanetY, ang, scale); @@ -1135,11 +1118,6 @@ void cEETest::Screen4() { } void cEETest::Screen5() { - /*mMap->Update(); - mMap->Draw(); - - cPrimitives p; - p.DrawRectangle( mMap->Position().x, mMap->Position().y, mMap->ViewSize().Width(), mMap->ViewSize().Height(), 0, 1, EE_DRAW_LINE );*/ } void cEETest::Render() { @@ -1471,24 +1449,6 @@ void cEETest::Input() { ShowParticles = !ShowParticles; } - break; - case 5: - if ( KM->IsKeyDown(KEY_LEFT) ) { - mMap->Move( mWindow->Elapsed() * 0.2f, 0 ); - } - - if ( KM->IsKeyDown(KEY_RIGHT) ) { - mMap->Move( -mWindow->Elapsed() * 0.2f, 0 ); - } - - if ( KM->IsKeyDown(KEY_UP) ) { - mMap->Move( 0, mWindow->Elapsed() * 0.2f ); - } - - if ( KM->IsKeyDown(KEY_DOWN) ) { - mMap->Move( 0, -mWindow->Elapsed() * 0.2f ); - } - break; } } @@ -1527,7 +1487,6 @@ void cEETest::End() { eeSAFE_DELETE( mVBO ); eeSAFE_DELETE( mBoxSprite ); eeSAFE_DELETE( mCircleSprite ); - eeSAFE_DELETE( mMap ); cLog::instance()->Save(); @@ -1739,7 +1698,8 @@ void cEETest::Demo2Destroy() { void cEETest::ChangeDemo( Uint32 num ) { if ( num < mDemo.size() ) { - mDemo[ mCurDemo ].destroy(); + if ( 0xFFFFFF != mCurDemo ) + mDemo[ mCurDemo ].destroy(); mCurDemo = num; @@ -1810,6 +1770,11 @@ void cEETest::PhysicsDestroy() { mDemo[ mCurDemo ].destroy(); } +#if EE_PLATFORM == EE_PLATFORM_MACOSX +#include +#include +#endif + int main (int argc, char * argv []) { cEETest * Test = eeNew( cEETest, () ); @@ -1818,7 +1783,8 @@ int main (int argc, char * argv []) { eeDelete( Test ); EE::MemoryManager::LogResults(); -/* + +/** cTexturePacker tp( 512, 512, true, 2 ); tp.AddTexturesPath( GetProcessPath() + "data/tetg" ); tp.PackTextures(); diff --git a/src/test/eetest.hpp b/src/test/eetest.hpp index 31334b18a..d75e1d935 100644 --- a/src/test/eetest.hpp +++ b/src/test/eetest.hpp @@ -87,7 +87,7 @@ class cEETest : private cThread { eeFloat PSElapsed; private: cEngine * EE; - cWindow * mWindow; + Window::cWindow * mWindow; cTextureFactory* TF; cLog* Log; cInput* KM; @@ -271,7 +271,6 @@ class cEETest : private cThread { cSprite * mBoxSprite; cSprite * mCircleSprite; - cMap * mMap; cUITheme * mTheme; }; diff --git a/src/ui/cuimanager.cpp b/src/ui/cuimanager.cpp index fed8ddd32..4c33998ee 100644 --- a/src/ui/cuimanager.cpp +++ b/src/ui/cuimanager.cpp @@ -24,7 +24,7 @@ cUIManager::~cUIManager() { Shutdown(); } -void cUIManager::Init( Uint32 Flags, cWindow * window ) { +void cUIManager::Init( Uint32 Flags, Window::cWindow * window ) { if ( mInit ) Shutdown(); @@ -305,7 +305,7 @@ void cUIManager::SendMouseDown( cUIControl * ToCtrl, const eeVector2i& Pos, cons ToCtrl->OnMouseDown( Pos, Flags ); } -cWindow * cUIManager::GetWindow() const { +Window::cWindow * cUIManager::GetWindow() const { return mWindow; } diff --git a/src/ui/cuimanager.hpp b/src/ui/cuimanager.hpp index 7919136bd..e4c8a218d 100644 --- a/src/ui/cuimanager.hpp +++ b/src/ui/cuimanager.hpp @@ -25,7 +25,7 @@ class EE_API cUIManager : public tSingleton { void OverControl( cUIControl * Ctrl ); - void Init( Uint32 Flags = 0, cWindow * window = NULL ); + void Init( Uint32 Flags = 0, Window::cWindow * window = NULL ); void Shutdown(); @@ -69,14 +69,14 @@ class EE_API cUIManager : public tSingleton { void SendMouseDown( cUIControl * ToCtrl, const eeVector2i& Pos, const Uint32 Flags ); - cWindow * GetWindow() const; + Window::cWindow * GetWindow() const; /** Control where the mouse click started to be down */ cUIControl * DownControl() const; cUIControl * LossFocusControl() const; protected: - cWindow * mWindow; + Window::cWindow * mWindow; cInput * mKM; cUIWindow * mControl; cUIControl * mFocusControl; diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index a86d6449d..d00fd72e6 100755 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -185,7 +185,7 @@ static LARGE_INTEGER hires_ticks_per_second; #endif -#if EE_PLATFORM == EE_PLATFORM_LINUX || EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD +#if EE_PLATFORM == EE_PLATFORM_LINUX || EE_PLATFORM == EE_PLATFORM_BSD #define HAVE_CLOCK_GETTIME #endif @@ -249,7 +249,6 @@ static void eeStartTicks() { clock_gettime(CLOCK_MONOTONIC, &start); #else gettimeofday(&start, NULL); - #warning eeStartTicks implemented with gettimeofday. Probably the platform is not fully supported. #endif #endif @@ -603,9 +602,13 @@ bool IsDirectory( const String& path ) { bool IsDirectory( const std::string& path ) { #ifndef EE_COMPILER_MSVC - DIR *dp; + DIR *dp = NULL; + bool isdir = !( ( dp = opendir( path.c_str() ) ) == NULL); - closedir(dp); + + if ( NULL != dp ) + closedir(dp); + return isdir; #else return GetFileAttributes( (LPCTSTR) path.c_str() ) != INVALID_FILE_ATTRIBUTES; diff --git a/src/window/backend/SDL/cclipboardsdl.hpp b/src/window/backend/SDL/cclipboardsdl.hpp index 1697e59d5..9b03c98e6 100644 --- a/src/window/backend/SDL/cclipboardsdl.hpp +++ b/src/window/backend/SDL/cclipboardsdl.hpp @@ -27,7 +27,7 @@ class EE_API cClipboardSDL : public cClipboard { protected: friend class cWindowSDL; - cClipboardSDL( cWindow * window ); + cClipboardSDL( Window::cWindow * window ); void Init(); diff --git a/src/window/backend/SDL/ccursormanagersdl.hpp b/src/window/backend/SDL/ccursormanagersdl.hpp index a21fa6cb7..5790fb263 100644 --- a/src/window/backend/SDL/ccursormanagersdl.hpp +++ b/src/window/backend/SDL/ccursormanagersdl.hpp @@ -13,7 +13,7 @@ namespace EE { namespace Window { namespace Backend { namespace SDL { class cCursorManagerSDL : public cCursorManager { public: - cCursorManagerSDL( cWindow * window ); + cCursorManagerSDL( Window::cWindow * window ); cCursor * Create( cTexture * tex, const eeVector2i& hotspot, const std::string& name ); @@ -29,8 +29,8 @@ class cCursorManagerSDL : public cCursorManager { void Hide(); - void Visible( bool visible ); - + void Visible( bool visible ); + void Remove( cCursor * cursor, bool Delete = false ); void Reload(); diff --git a/src/window/backend/SDL/ccursorsdl.cpp b/src/window/backend/SDL/ccursorsdl.cpp index 2f5ed8a94..fc1526323 100644 --- a/src/window/backend/SDL/ccursorsdl.cpp +++ b/src/window/backend/SDL/ccursorsdl.cpp @@ -4,17 +4,17 @@ namespace EE { namespace Window { namespace Backend { namespace SDL { -cCursorSDL::cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( tex, hotspot, name, window ) { } -cCursorSDL::cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( img, hotspot, name, window ) { } -cCursorSDL::cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( path, hotspot, name, window ) { } diff --git a/src/window/backend/SDL/ccursorsdl.hpp b/src/window/backend/SDL/ccursorsdl.hpp index c40c49b1b..98eca41c9 100644 --- a/src/window/backend/SDL/ccursorsdl.hpp +++ b/src/window/backend/SDL/ccursorsdl.hpp @@ -13,11 +13,11 @@ class cCursorSDL : public cCursor { protected: friend class cCursorManagerSDL; - cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); void Create(); }; diff --git a/src/window/backend/SDL/cinputsdl.hpp b/src/window/backend/SDL/cinputsdl.hpp index 77b67c748..5cd52d7b7 100644 --- a/src/window/backend/SDL/cinputsdl.hpp +++ b/src/window/backend/SDL/cinputsdl.hpp @@ -27,7 +27,7 @@ class EE_API cInputSDL : public cInput { protected: friend class cWindowSDL; - cInputSDL( cWindow * window ); + cInputSDL( Window::cWindow * window ); virtual void Init(); }; diff --git a/src/window/backend/SDL/cwindowsdl.cpp b/src/window/backend/SDL/cwindowsdl.cpp index bc0dc503a..e64cfa34d 100644 --- a/src/window/backend/SDL/cwindowsdl.cpp +++ b/src/window/backend/SDL/cwindowsdl.cpp @@ -357,9 +357,9 @@ std::vector< std::pair > cWindowSDL::GetPossibleReso } void cWindowSDL::SetGamma( eeFloat Red, eeFloat Green, eeFloat Blue ) { - eeclamp( &Red , 0.1f, 10.0f ); - eeclamp( &Green , 0.1f, 10.0f ); - eeclamp( &Blue , 0.1f, 10.0f ); + eeclamp( &Red , 0.1f, 10.0f ); + eeclamp( &Green , 0.1f, 10.0f ); + eeclamp( &Blue , 0.1f, 10.0f ); SDL_SetGamma( Red, Green, Blue ); } @@ -369,7 +369,8 @@ eeWindowHandler cWindowSDL::GetWindowHandler() { #elif defined( EE_X11_PLATFORM ) return mWMinfo.info.x11.display; #elif EE_PLATFORM == EE_PLATFORM_MACOSX - return mWMinfo.cocoa.window; + //return mWMinfo.cocoa.window; + return mWMinfo.info.x11.display; #else return 0; #endif diff --git a/src/window/backend/SDL13/cclipboardsdl.hpp b/src/window/backend/SDL13/cclipboardsdl.hpp index aecabbe46..1f47f4fef 100644 --- a/src/window/backend/SDL13/cclipboardsdl.hpp +++ b/src/window/backend/SDL13/cclipboardsdl.hpp @@ -23,7 +23,7 @@ class EE_API cClipboardSDL : public cClipboard { protected: friend class cWindowSDL; - cClipboardSDL( cWindow * window ); + cClipboardSDL( Window::cWindow * window ); void Init(); }; diff --git a/src/window/backend/SDL13/ccursormanagersdl.hpp b/src/window/backend/SDL13/ccursormanagersdl.hpp index 769bddc0c..432541db7 100644 --- a/src/window/backend/SDL13/ccursormanagersdl.hpp +++ b/src/window/backend/SDL13/ccursormanagersdl.hpp @@ -12,7 +12,7 @@ namespace EE { namespace Window { namespace Backend { namespace SDL13 { class cCursorManagerSDL : public cCursorManager { public: - cCursorManagerSDL( cWindow * window ); + cCursorManagerSDL( Window::cWindow * window ); cCursor * Create( cTexture * tex, const eeVector2i& hotspot, const std::string& name ); diff --git a/src/window/backend/SDL13/ccursorsdl.cpp b/src/window/backend/SDL13/ccursorsdl.cpp index f197b2520..15e095b30 100644 --- a/src/window/backend/SDL13/ccursorsdl.cpp +++ b/src/window/backend/SDL13/ccursorsdl.cpp @@ -4,21 +4,21 @@ namespace EE { namespace Window { namespace Backend { namespace SDL13 { -cCursorSDL::cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( tex, hotspot, name, window ), mCursor( NULL ) { Create(); } -cCursorSDL::cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( img, hotspot, name, window ), mCursor( NULL ) { Create(); } -cCursorSDL::cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorSDL::cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( path, hotspot, name, window ), mCursor( NULL ) { diff --git a/src/window/backend/SDL13/ccursorsdl.hpp b/src/window/backend/SDL13/ccursorsdl.hpp index 649bec489..e3883fb67 100644 --- a/src/window/backend/SDL13/ccursorsdl.hpp +++ b/src/window/backend/SDL13/ccursorsdl.hpp @@ -18,11 +18,11 @@ class cCursorSDL : public cCursor { SDL_Cursor * mCursor; - cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorSDL( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); virtual ~cCursorSDL(); diff --git a/src/window/backend/SDL13/cinputsdl.hpp b/src/window/backend/SDL13/cinputsdl.hpp index 3313dc190..2d881496b 100644 --- a/src/window/backend/SDL13/cinputsdl.hpp +++ b/src/window/backend/SDL13/cinputsdl.hpp @@ -24,7 +24,7 @@ class EE_API cInputSDL : public cInput { protected: friend class cWindowSDL; - cInputSDL( cWindow * window ); + cInputSDL( Window::cWindow * window ); virtual void Init(); diff --git a/src/window/backend/allegro5/cclipboardal.hpp b/src/window/backend/allegro5/cclipboardal.hpp index 543bb2348..bbae02f99 100644 --- a/src/window/backend/allegro5/cclipboardal.hpp +++ b/src/window/backend/allegro5/cclipboardal.hpp @@ -22,7 +22,7 @@ class EE_API cClipboardAl : public cClipboard { protected: friend class cWindowAl; - cClipboardAl( cWindow * window ); + cClipboardAl( Window::cWindow * window ); void Init(); }; diff --git a/src/window/backend/allegro5/ccursoral.cpp b/src/window/backend/allegro5/ccursoral.cpp index 6e5ffe138..e1ddd5a62 100644 --- a/src/window/backend/allegro5/ccursoral.cpp +++ b/src/window/backend/allegro5/ccursoral.cpp @@ -5,21 +5,21 @@ namespace EE { namespace Window { namespace Backend { namespace Al { -cCursorAl::cCursorAl( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorAl::cCursorAl( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( tex, hotspot, name, window ), mCursor( NULL ) { Create(); } -cCursorAl::cCursorAl( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorAl::cCursorAl( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( img, hotspot, name, window ), mCursor( NULL ) { Create(); } -cCursorAl::cCursorAl( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorAl::cCursorAl( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( path, hotspot, name, window ), mCursor( NULL ) { diff --git a/src/window/backend/allegro5/ccursoral.hpp b/src/window/backend/allegro5/ccursoral.hpp index d4eb3c28e..5bf0386a8 100644 --- a/src/window/backend/allegro5/ccursoral.hpp +++ b/src/window/backend/allegro5/ccursoral.hpp @@ -19,11 +19,11 @@ class cCursorAl : public cCursor { ALLEGRO_MOUSE_CURSOR * mCursor; - cCursorAl( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorAl( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorAl( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorAl( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorAl( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorAl( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); ~cCursorAl(); diff --git a/src/window/backend/allegro5/ccursormanageral.hpp b/src/window/backend/allegro5/ccursormanageral.hpp index b97c2574d..edfd60a71 100644 --- a/src/window/backend/allegro5/ccursormanageral.hpp +++ b/src/window/backend/allegro5/ccursormanageral.hpp @@ -11,7 +11,7 @@ namespace EE { namespace Window { namespace Backend { namespace Al { class cCursorManagerAl : public cCursorManager { public: - cCursorManagerAl( cWindow * window ); + cCursorManagerAl( Window::cWindow * window ); cCursor * Create( cTexture * tex, const eeVector2i& hotspot, const std::string& name ); @@ -27,8 +27,8 @@ class cCursorManagerAl : public cCursorManager { void Hide(); - void Visible( bool visible ); - + void Visible( bool visible ); + void Remove( cCursor * cursor, bool Delete = false ); void Reload(); diff --git a/src/window/backend/allegro5/cinputal.cpp b/src/window/backend/allegro5/cinputal.cpp index 032f4f62f..101f939cc 100644 --- a/src/window/backend/allegro5/cinputal.cpp +++ b/src/window/backend/allegro5/cinputal.cpp @@ -217,7 +217,7 @@ void cInputAl::GrabInput( const bool& Grab ) { } void cInputAl::InjectMousePos( const Uint16& x, const Uint16& y ) { - if ( x >= 0 && x <= GetWindowAl()->GetWidth() && y >= 0 && y <= GetWindowAl()->GetHeight() ) { + if ( x <= GetWindowAl()->GetWidth() && y <= GetWindowAl()->GetHeight() ) { al_set_mouse_xy( GetDisplay(), x, y ); mMousePos.x = x; mMousePos.y = y; diff --git a/src/window/backend/allegro5/cinputal.hpp b/src/window/backend/allegro5/cinputal.hpp index 55fe0c623..837956100 100644 --- a/src/window/backend/allegro5/cinputal.hpp +++ b/src/window/backend/allegro5/cinputal.hpp @@ -29,7 +29,7 @@ class EE_API cInputAl : public cInput { ALLEGRO_EVENT_QUEUE * mQueue; bool mGrab; - cInputAl( cWindow * window ); + cInputAl( Window::cWindow * window ); virtual void Init(); diff --git a/src/window/backend/null/cclipboardnull.hpp b/src/window/backend/null/cclipboardnull.hpp index 4fdbdedf7..23c794d20 100644 --- a/src/window/backend/null/cclipboardnull.hpp +++ b/src/window/backend/null/cclipboardnull.hpp @@ -18,7 +18,7 @@ class EE_API cClipboardNull : public cClipboard { protected: friend class cWindowNull; - cClipboardNull( cWindow * window ); + cClipboardNull( Window::cWindow * window ); void Init(); }; diff --git a/src/window/backend/null/ccursormanagernull.hpp b/src/window/backend/null/ccursormanagernull.hpp index 1342b8cd5..7db3d6ea0 100644 --- a/src/window/backend/null/ccursormanagernull.hpp +++ b/src/window/backend/null/ccursormanagernull.hpp @@ -9,7 +9,7 @@ namespace EE { namespace Window { namespace Backend { namespace Null { class cCursorManagerNull : public cCursorManager { public: - cCursorManagerNull( cWindow * window ); + cCursorManagerNull( Window::cWindow * window ); cCursor * Create( cTexture * tex, const eeVector2i& hotspot, const std::string& name ); @@ -25,8 +25,8 @@ class cCursorManagerNull : public cCursorManager { void Hide(); - void Visible( bool visible ); - + void Visible( bool visible ); + void Remove( cCursor * cursor, bool Delete = false ); void Reload(); diff --git a/src/window/backend/null/ccursornull.cpp b/src/window/backend/null/ccursornull.cpp index 7e3d9f039..6f39a4967 100644 --- a/src/window/backend/null/ccursornull.cpp +++ b/src/window/backend/null/ccursornull.cpp @@ -2,17 +2,17 @@ namespace EE { namespace Window { namespace Backend { namespace Null { -cCursorNull::cCursorNull( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorNull::cCursorNull( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( tex, hotspot, name, window ) { } -cCursorNull::cCursorNull( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorNull::cCursorNull( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( img, hotspot, name, window ) { } -cCursorNull::cCursorNull( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorNull::cCursorNull( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( path, hotspot, name, window ) { } diff --git a/src/window/backend/null/ccursornull.hpp b/src/window/backend/null/ccursornull.hpp index 1372a4d50..6909ac6cf 100644 --- a/src/window/backend/null/ccursornull.hpp +++ b/src/window/backend/null/ccursornull.hpp @@ -11,11 +11,11 @@ class cCursorNull : public cCursor { protected: friend class cCursorManagerNull; - cCursorNull( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorNull( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorNull( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorNull( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorNull( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorNull( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); void Create(); }; diff --git a/src/window/backend/null/cinputnull.hpp b/src/window/backend/null/cinputnull.hpp index 3244d619a..73898712a 100644 --- a/src/window/backend/null/cinputnull.hpp +++ b/src/window/backend/null/cinputnull.hpp @@ -19,7 +19,7 @@ class EE_API cInputNull : public cInput { protected: friend class cWindowNull; - cInputNull( cWindow * window ); + cInputNull( Window::cWindow * window ); virtual void Init(); }; diff --git a/src/window/cclipboard.hpp b/src/window/cclipboard.hpp index 3225dd119..b1103fe24 100644 --- a/src/window/cclipboard.hpp +++ b/src/window/cclipboard.hpp @@ -18,16 +18,16 @@ class cClipboard { /** Set the current clipboard text */ virtual void SetText( const std::string& Text ) = 0; - cWindow * GetWindow() const; + Window::cWindow * GetWindow() const; protected: friend class cWindow; - cClipboard( cWindow * window ); + cClipboard( Window::cWindow * window ); /** Initialize the clipboard manager. This is needed because the backends first create the instance of the clipboard and then initialize the window context. */ virtual void Init() = 0; - cWindow * mWindow; + Window::cWindow * mWindow; }; }} diff --git a/src/window/ccursor.cpp b/src/window/ccursor.cpp index 8e9ca454d..368f80a64 100644 --- a/src/window/ccursor.cpp +++ b/src/window/ccursor.cpp @@ -2,7 +2,7 @@ namespace EE { namespace Window { -cCursor::cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursor::cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : mId( MakeHash( name ) ), mName( name ), mImage( NULL ), @@ -18,7 +18,7 @@ cCursor::cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string& } } -cCursor::cCursor( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursor::cCursor( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : mId( MakeHash( name ) ), mName( name ), mImage( NULL ), @@ -32,7 +32,7 @@ cCursor::cCursor( cImage * img, const eeVector2i& hotspot, const std::string& na } } -cCursor::cCursor( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursor::cCursor( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : mId( MakeHash( name ) ), mName( name ), mImage( NULL ), diff --git a/src/window/ccursor.hpp b/src/window/ccursor.hpp index d8066d1e1..f3c358dbf 100644 --- a/src/window/ccursor.hpp +++ b/src/window/ccursor.hpp @@ -31,11 +31,11 @@ class EE_API cCursor { eeVector2i mHotSpot; cWindow * mWindow; - cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursor( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursor( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursor( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursor( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); virtual void Create() = 0; }; diff --git a/src/window/ccursormanager.hpp b/src/window/ccursormanager.hpp index 1f8db461e..cb9a9a185 100644 --- a/src/window/ccursormanager.hpp +++ b/src/window/ccursormanager.hpp @@ -16,7 +16,7 @@ namespace EE { namespace Window { class EE_API cCursorManager { public: - cCursorManager( cWindow * window ); + cCursorManager( Window::cWindow * window ); virtual ~cCursorManager(); diff --git a/src/window/cengine.cpp b/src/window/cengine.cpp index 17510278a..067e2de66 100755 --- a/src/window/cengine.cpp +++ b/src/window/cengine.cpp @@ -19,7 +19,7 @@ #define BACKEND_SDL 1 #define BACKEND_ALLEGRO 2 -#define DEFAULT_BACKEND BACKEND_SDL +//#define DEFAULT_BACKEND BACKEND_ALLEGRO #ifndef DEFAULT_BACKEND diff --git a/src/window/cengine.hpp b/src/window/cengine.hpp index 4dd7f6330..31d97ff43 100755 --- a/src/window/cengine.hpp +++ b/src/window/cengine.hpp @@ -16,18 +16,18 @@ class EE_API cEngine : public tSingleton { /** Creates a new window. * Allegro 5 backend support more than one window creation, SDL backend only 1 window. */ - cWindow * CreateWindow( WindowSettings Settings, ContextSettings Context ); + Window::cWindow * CreateWindow( WindowSettings Settings, ContextSettings Context ); /** Destroy the window instance, and set as current other window running ( if any ). * This function is only usefull for multi-window environment. Avoid using it with one window context. */ - void DestroyWindow( cWindow * window ); + void DestroyWindow( Window::cWindow * window ); /** @return The current Window context. */ - cWindow * GetCurrentWindow() const; + Window::cWindow * GetCurrentWindow() const; /** Set the window as the current. */ - void SetCurrentWindow( cWindow * window ); + void SetCurrentWindow( Window::cWindow * window ); /** @return The number of windows created. */ Uint32 GetWindowCount() const; @@ -45,7 +45,7 @@ class EE_API cEngine : public tSingleton { const Uint32& GetHeight() const; /** @return If the window instance is inside the window list. */ - bool ExistsWindow( cWindow * window ); + bool ExistsWindow( Window::cWindow * window ); protected: friend class cWindow; diff --git a/src/window/cinput.hpp b/src/window/cinput.hpp index 06a6e0a89..824f9c951 100644 --- a/src/window/cinput.hpp +++ b/src/window/cinput.hpp @@ -154,7 +154,7 @@ class EE_API cInput { protected: friend class cWindow; - cInput( cWindow * window, cJoystickManager * joystickmanager ); + cInput( Window::cWindow * window, cJoystickManager * joystickmanager ); virtual void Init() = 0; diff --git a/src/window/cinputtextbuffer.cpp b/src/window/cinputtextbuffer.cpp index 3583de511..2f1c3b20c 100755 --- a/src/window/cinputtextbuffer.cpp +++ b/src/window/cinputtextbuffer.cpp @@ -4,7 +4,7 @@ namespace EE { namespace Window { -cInputTextBuffer::cInputTextBuffer( const bool& active, const bool& supportNewLine, const bool& supportFreeEditing, cWindow * window, const Uint32& maxLenght ) : +cInputTextBuffer::cInputTextBuffer( const bool& active, const bool& supportNewLine, const bool& supportFreeEditing, Window::cWindow * window, const Uint32& maxLenght ) : mWindow( window ), mFlags(0), mCallback(0), @@ -151,7 +151,7 @@ void cInputTextBuffer::Update( InputEvent* Event ) { String txt = mWindow->GetClipboard()->GetWideText(); if ( !SupportNewLine() ) { - Uint32 pos = txt.find_first_of( '\n' ); + size_t pos = txt.find_first_of( '\n' ); if ( pos != std::string::npos ) txt = txt.substr( 0, pos ); diff --git a/src/window/cinputtextbuffer.hpp b/src/window/cinputtextbuffer.hpp index 769cddadc..069aa5b23 100755 --- a/src/window/cinputtextbuffer.hpp +++ b/src/window/cinputtextbuffer.hpp @@ -22,9 +22,9 @@ class EE_API cInputTextBuffer { public: typedef cb::Callback0 EnterCallback; - cInputTextBuffer( const bool& active, const bool& supportNewLine, const bool& supportFreeEditing, cWindow * window = NULL, const Uint32& maxLenght = 0xFFFFFFFF ); + cInputTextBuffer( const bool& active, const bool& supportNewLine, const bool& supportFreeEditing, Window::cWindow * window = NULL, const Uint32& maxLenght = 0xFFFFFFFF ); - cInputTextBuffer( cWindow * window = NULL ); + cInputTextBuffer( Window::cWindow * window = NULL ); ~cInputTextBuffer(); diff --git a/src/window/cplatformimpl.hpp b/src/window/cplatformimpl.hpp index 1cc2e829a..fc98a4367 100644 --- a/src/window/cplatformimpl.hpp +++ b/src/window/cplatformimpl.hpp @@ -24,7 +24,7 @@ using namespace EE::Window; class cPlatformImpl { public: - cPlatformImpl( cWindow * window ); + cPlatformImpl( Window::cWindow * window ); virtual ~cPlatformImpl(); diff --git a/src/window/platform/null/cnullimpl.hpp b/src/window/platform/null/cnullimpl.hpp index 9cf02c296..193491345 100644 --- a/src/window/platform/null/cnullimpl.hpp +++ b/src/window/platform/null/cnullimpl.hpp @@ -10,7 +10,7 @@ using namespace EE::Window; class cNullImpl : public cPlatformImpl { public: - cNullImpl( cWindow * window ); + cNullImpl( Window::cWindow * window ); ~cNullImpl(); diff --git a/src/window/platform/osx/cosximpl.hpp b/src/window/platform/osx/cosximpl.hpp index 9bd95dc04..26a0d6316 100644 --- a/src/window/platform/osx/cosximpl.hpp +++ b/src/window/platform/osx/cosximpl.hpp @@ -12,7 +12,7 @@ using namespace EE::Window; class cOSXImpl : public cPlatformImpl { public: - cOSXImpl( cWindow * window ); + cOSXImpl( Window::cWindow * window ); ~cOSXImpl(); diff --git a/src/window/platform/win/cwinimpl.hpp b/src/window/platform/win/cwinimpl.hpp index 8e6498bc4..a096424c1 100644 --- a/src/window/platform/win/cwinimpl.hpp +++ b/src/window/platform/win/cwinimpl.hpp @@ -12,7 +12,7 @@ using namespace EE::Window; class cWinImpl : public cPlatformImpl { public: - cWinImpl( cWindow * window, eeWindowHandler handler ); + cWinImpl( Window::cWindow * window, eeWindowHandler handler ); ~cWinImpl(); @@ -46,8 +46,8 @@ class cWinImpl : public cPlatformImpl { void SetSystemMouseCursor( Cursor::EE_SYSTEM_CURSOR syscursor ); - void RestoreCursor(); - + void RestoreCursor(); + eeWindowHandler GetHandler() const; protected: eeWindowHandler mHandler; diff --git a/src/window/platform/x11/ccursorx11.cpp b/src/window/platform/x11/ccursorx11.cpp index aa2339f0a..520bb6ac3 100644 --- a/src/window/platform/x11/ccursorx11.cpp +++ b/src/window/platform/x11/ccursorx11.cpp @@ -5,21 +5,21 @@ namespace EE { namespace Window { namespace Platform { -cCursorX11::cCursorX11( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorX11::cCursorX11( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( tex, hotspot, name, window ), mCursor( None ) { Create(); } -cCursorX11::cCursorX11( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorX11::cCursorX11( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( img, hotspot, name, window ), mCursor( None ) { Create(); } -cCursorX11::cCursorX11( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ) : +cCursorX11::cCursorX11( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ) : cCursor( path, hotspot, name, window ), mCursor( None ) { diff --git a/src/window/platform/x11/ccursorx11.hpp b/src/window/platform/x11/ccursorx11.hpp index aad83d62b..aee363291 100644 --- a/src/window/platform/x11/ccursorx11.hpp +++ b/src/window/platform/x11/ccursorx11.hpp @@ -19,11 +19,11 @@ class cCursorX11 : public cCursor { X11Cursor mCursor; - cCursorX11( cTexture * tex, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorX11( cTexture * tex, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorX11( cImage * img, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorX11( cImage * img, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); - cCursorX11( const std::string& path, const eeVector2i& hotspot, const std::string& name, cWindow * window ); + cCursorX11( const std::string& path, const eeVector2i& hotspot, const std::string& name, Window::cWindow * window ); ~cCursorX11(); diff --git a/src/window/platform/x11/cx11impl.hpp b/src/window/platform/x11/cx11impl.hpp index 254bc88cd..cd52cf241 100644 --- a/src/window/platform/x11/cx11impl.hpp +++ b/src/window/platform/x11/cx11impl.hpp @@ -15,7 +15,7 @@ class cX11Impl : public cPlatformImpl { typedef void (*LockFunc)(void); typedef void (*UnlockFunc)(void); - cX11Impl( cWindow * window, eeWindowHandler display, X11Window xwindow, X11Window mainwindow, LockFunc lock, UnlockFunc unlock ); + cX11Impl( Window::cWindow * window, eeWindowHandler display, X11Window xwindow, X11Window mainwindow, LockFunc lock, UnlockFunc unlock ); ~cX11Impl();