diff --git a/Makefile.macosx b/Makefile.macosx index b69ba6628..e57112422 100644 --- a/Makefile.macosx +++ b/Makefile.macosx @@ -94,7 +94,7 @@ libeepp-s.a: $(OBJHELPERS) $(OBJMODULES) $(AR) $(ARFLAGS) $(LIBNAME) $(OBJHELPERS) $(OBJMODULES) libeepp.so: $(OBJHELPERS) $(OBJMODULES) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJHELPERS) $(OBJMODULES) -lfreetype -lSDL -lsndfile -framework OpenGL -framework GLUT -framework OpenAL -framework Cocoa -framework CoreFoundation + $(CPP) $(LDFLAGS) -Wl -o $(LIBNAME) $(OBJHELPERS) $(OBJMODULES) -lfreetype -lSDL -lsndfile -framework OpenGL -framework GLUT -framework OpenAL -framework Cocoa -framework CoreFoundation $(OBJMODULES): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) -I/usr/include/freetype2 diff --git a/src/audio/openal.hpp b/src/audio/openal.hpp index 1b94a2792..7c6dcfe33 100755 --- a/src/audio/openal.hpp +++ b/src/audio/openal.hpp @@ -1,7 +1,7 @@ #ifndef EE_OPENAL_H #define EE_OPENAL_H -#if EE_PLATFORM == EE_PLATFORM_APPLE +#if EE_PLATFORM == EE_PLATFORM_MACOSX #include #include #else diff --git a/src/base.hpp b/src/base.hpp index 5ac4f559b..2170a0b59 100644 --- a/src/base.hpp +++ b/src/base.hpp @@ -36,7 +36,7 @@ #define EE_PLATFORM_WIN32 1 #define EE_PLATFORM_LINUX 2 -#define EE_PLATFORM_APPLE 3 +#define EE_PLATFORM_MACOSX 3 #if defined( __WIN32__ ) || defined( _WIN32 ) # define EE_PLATFORM EE_PLATFORM_WIN32 @@ -46,7 +46,7 @@ #endif #elif defined( __APPLE_CC__) || defined ( __APPLE__ ) -# define EE_PLATFORM EE_PLATFORM_APPLE +# define EE_PLATFORM EE_PLATFORM_MACOSX #else # define EE_PLATFORM EE_PLATFORM_LINUX @@ -85,7 +85,7 @@ #endif #include "helper/glew/glew.h" -#if EE_PLATFORM == EE_PLATFORM_APPLE +#if EE_PLATFORM == EE_PLATFORM_MACOSX #include #else #include diff --git a/src/graphics/cframebufferpbuffer.cpp b/src/graphics/cframebufferpbuffer.cpp index 3190a3fca..5ee016f9e 100644 --- a/src/graphics/cframebufferpbuffer.cpp +++ b/src/graphics/cframebufferpbuffer.cpp @@ -4,30 +4,36 @@ namespace EE { namespace Graphics { -cFrameBufferPBuffer::cFrameBufferPBuffer() : - cFrameBuffer(), +cFrameBufferPBuffer::cFrameBufferPBuffer() #if EE_PLATFORM == EE_PLATFORM_WIN32 + : cFrameBuffer(), mDeviceContext( NULL ), -#elif EE_PLATFORM == EE_PLATFORM_LINUX - mDisplay( NULL ), -#endif mPBuffer( NULL ), mContext( NULL ) +#elif EE_PLATFORM == EE_PLATFORM_LINUX + : cFrameBuffer(), + mDisplay( NULL ), + mPBuffer( NULL ), + mContext( NULL ) +#endif { #if EE_PLATFORM == EE_PLATFORM_LINUX mDisplay = XOpenDisplay(NULL); #endif } -cFrameBufferPBuffer::cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer ) : - cFrameBuffer(), +cFrameBufferPBuffer::cFrameBufferPBuffer( const Uint32& Width, const Uint32& Height, bool DepthBuffer ) #if EE_PLATFORM == EE_PLATFORM_WIN32 + : cFrameBuffer(), mDeviceContext( NULL ), -#elif EE_PLATFORM == EE_PLATFORM_LINUX - mDisplay( NULL ), -#endif mPBuffer( NULL ), mContext( NULL ) +#elif EE_PLATFORM == EE_PLATFORM_LINUX + : cFrameBuffer(), + mDisplay( NULL ), + mPBuffer( NULL ), + mContext( NULL ) +#endif { #if EE_PLATFORM == EE_PLATFORM_LINUX mDisplay = XOpenDisplay(NULL); diff --git a/src/graphics/cframebufferpbuffer.hpp b/src/graphics/cframebufferpbuffer.hpp index a987a4730..3da60a2da 100644 --- a/src/graphics/cframebufferpbuffer.hpp +++ b/src/graphics/cframebufferpbuffer.hpp @@ -23,7 +23,7 @@ // // 3. This notice may not be removed or altered from any source distribution. * -* NOTE by Martin Golini: This is not the original version, so differs from SFML implementation. +* NOTE by Martin Lucas Golini: This is not the original version, so differs from SFML implementation. */ #include "base.hpp" @@ -34,8 +34,8 @@ #elif EE_PLATFORM == EE_PLATFORM_LINUX #include "../helper/glew/glxew.h" #include -#elif EE_PLATFORM == EE_PLATFORM_APPLE -#include +#elif EE_PLATFORM == EE_PLATFORM_MACOSX +//#include #warning No PBuffer implemented on MAC #else #warning No PBuffer implemented on this platform diff --git a/src/test/ee.cpp b/src/test/ee.cpp index 279c084ec..33891c93e 100644 --- a/src/test/ee.cpp +++ b/src/test/ee.cpp @@ -1,15 +1,14 @@ #include "../ee.h" /** -@TODO Add support for Frame Buffer Object and to switch rendering to FBO and Screen. @TODO Create a Vertex Buffer Object class ( with and without GL_ARB_vertex_buffer_object ). -@TODO Create a basic UI system ( add basic controls, add skinning support ). @TODO Support multitexturing. -@TODO Encapsulate SDL and OpenGL ( and remove unnecessary dependencies ). +@TODO Create a basic UI system ( add basic controls, add skinning support ). @TODO Add some Surface Grid class, to create special effects ( waved texture, and stuff like that ). -@TODO Support color cursors ( not only black and white cursors, that really sucks ) - Imposible with SDL 1.2 @TODO Add Scripting support ( lua or squirrel ). @TODO Add 2D physics support ( Box2D or Chipmunk wrapper ). +@TODO Encapsulate SDL and OpenGL ( and remove unnecessary dependencies ). +@TODO Support color cursors ( not only black and white cursors, that really sucks ) - Imposible with SDL 1.2 */ class cUITest : public cUIControlAnim { diff --git a/src/utils/string.cpp b/src/utils/string.cpp index 54bacdc40..3be5dbf88 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -226,13 +226,13 @@ std::string StoragePath( std::string appname ) { #else char *home = getenv("HOME"); - #if EE_PLATFORM != EE_PLATFORM_APPLE + #if EE_PLATFORM != EE_PLATFORM_MACOSX int i; #endif if(!home) return std::string(); - #if EE_PLATFORM == EE_PLATFORM_APPLE + #if EE_PLATFORM == EE_PLATFORM_MACOSX snprintf(path, 256, "%s/Library/Application Support/%s", home, appname.c_str() ); #else snprintf(path, 256, "%s/.%s", home, appname.c_str() ); diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 919a29aab..79a1e1fb9 100755 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -1,7 +1,7 @@ #include "utils.hpp" #include "string.hpp" -#if EE_PLATFORM == EE_PLATFORM_APPLE +#if EE_PLATFORM == EE_PLATFORM_MACOSX #include #include #elif EE_PLATFORM == EE_PLATFORM_WIN32 @@ -45,7 +45,7 @@ void eeSleep( const Uint32& ms ) { } std::string AppPath() { -#if EE_PLATFORM == EE_PLATFORM_APPLE +#if EE_PLATFORM == EE_PLATFORM_MACOSX char exe_file[PATH_MAX + 1]; CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle) { @@ -66,7 +66,7 @@ std::string AppPath() { int size; size = readlink("/proc/self/exe", exe_file, PATH_MAX); if (size < 0) { - return ""; + return "./"; } else { exe_file[size] = '\0'; return std::string(dirname(exe_file)) + "/"; @@ -108,6 +108,9 @@ std::string AppPath() { return std::string(szDrive) + std::string(szDir); #endif +#else + #warning AppPath() not implemented on this platform. ( will return "./" ) + return "./"; #endif } @@ -353,7 +356,7 @@ eeInt GetNumCPUs() { nprocs = (eeInt) info.dwNumberOfProcessors; #elif EE_PLATFORM == EE_PLATFORM_LINUX nprocs = sysconf(_SC_NPROCESSORS_ONLN); - #elif EE_PLATFORM == EE_PLATFORM_APPLE + #elif EE_PLATFORM == EE_PLATFORM_MACOSX int mib[2]; size_t len; int maxproc = 1; @@ -368,7 +371,7 @@ eeInt GetNumCPUs() { nprocs = maxproc; #else - #warning GetNumCPUs not implemented for this platform + #warning GetNumCPUs not implemented on this platform. #endif if ( nprocs < 0 ) diff --git a/src/window/base.hpp b/src/window/base.hpp index f95233b9f..7cf86ad88 100644 --- a/src/window/base.hpp +++ b/src/window/base.hpp @@ -9,8 +9,8 @@ #include "../helper/glew/wglew.h" #elif EE_PLATFORM == EE_PLATFORM_LINUX #include "../helper/glew/glxew.h" -#elif EE_PLATFORM == EE_PLATFORM_APPLE -#include +#elif EE_PLATFORM == EE_PLATFORM_MACOSX +//#include #endif #if EE_PLATFORM == EE_PLATFORM_LINUX diff --git a/src/window/cengine.cpp b/src/window/cengine.cpp index e98385b24..aff55e527 100755 --- a/src/window/cengine.cpp +++ b/src/window/cengine.cpp @@ -337,7 +337,7 @@ void cEngine::ChangeRes( const Uint16& width, const Uint16& height, const bool& try { cLog::instance()->Writef( "Switching from %s to %s. Width: %d Height %d.", mVideoInfo.Windowed == true ? "windowed" : "fullscreen", Windowed == true ? "windowed" : "fullscreen", width, height ); - #if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_APPLE + #if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_MACOSX #if EE_PLATFORM == EE_PLATFORM_WIN32 bool Reload = mVideoInfo.Windowed != Windowed; #else @@ -370,10 +370,11 @@ void cEngine::ChangeRes( const Uint16& width, const Uint16& height, const bool& ResetGL2D(); - #if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_APPLE + #if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_MACOSX if ( Reload ) { - cTextureFactory::instance()->UngrabTextures(); - cShaderProgramManager::instance()->Reload(); + cTextureFactory::instance()->UngrabTextures(); // Reload all textures + cShaderProgramManager::instance()->Reload(); // Reload all shaders + GetMainContext(); // Recover the context } #endif @@ -563,7 +564,7 @@ SDL_Cursor* cEngine::CreateCursor( const Uint32& TexId, const eeVector2i& HotSpo return NULL; //the width must be a multiple of 8 (SDL requirement) - #if EE_PLATFORM == EE_PLATFORM_APPLE + #if EE_PLATFORM == EE_PLATFORM_MACOSX size_t cursor_width = 16; #else size_t cursor_width = static_cast(Tex->Width()); @@ -684,8 +685,8 @@ void cEngine::MaximizeWindow() { XFlush(mVideoInfo.info.info.x11.display); mVideoInfo.info.info.x11.unlock_func(); - #elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::MaximizeWindow() not implemented on Apple + #else + #warning cEngine::MaximizeWindow() not implemented on this platform. #endif } @@ -696,8 +697,8 @@ void cEngine::HideWindow() { mVideoInfo.info.info.x11.unlock_func(); #elif EE_PLATFORM == EE_PLATFORM_WIN32 WIN_ShowWindow( mVideoInfo.info.window, SW_HIDE ); -#elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::HideWindow() not implemented on Apple +#else + #warning cEngine::HideWindow() not implemented on this platform. #endif } @@ -715,8 +716,8 @@ void cEngine::RaiseWindow() { top = HWND_NOTOPMOST; SetWindowPos( mVideoInfo.info.window, top, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE) ); -#elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::RaiseWindow() not implemented on Apple +#else + #warning cEngine::RaiseWindow() not implemented on this platform. #endif } @@ -727,8 +728,8 @@ void cEngine::ShowWindow() { mVideoInfo.info.info.x11.unlock_func(); #elif EE_PLATFORM == EE_PLATFORM_WIN32 WIN_ShowWindow( mVideoInfo.info.window, SW_SHOW ); -#elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::RaiseWindow() not implemented on Apple +#else + #warning cEngine::RaiseWindow() not implemented on this platform. #endif } @@ -738,8 +739,8 @@ void cEngine::SetWindowPosition(Int16 Left, Int16 Top) { XFlush( mVideoInfo.info.info.x11.display ); #elif EE_PLATFORM == EE_PLATFORM_WIN32 SetWindowPos( mVideoInfo.info.window, NULL, Left, Top, 0, 0, SWP_NOSIZE | SWP_NOZORDER ); -#elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::SetWindowPosition() not implemented on Apple +#else + #warning cEngine::SetWindowPosition() not implemented on this platform. #endif } @@ -753,9 +754,9 @@ eeVector2i cEngine::GetWindowPosition() { RECT r; GetWindowRect( mVideoInfo.info.window, &r ); return eeVector2i( r.left, r.top ); -#elif EE_PLATFORM == EE_PLATFORM_APPLE +#else + #warning cEngine::GetWindowPos() not implemented on this platform. return eeVector2i( 0, 0 ); - //#warning cEngine::GetWindowPos() not implemented on Apple #endif } @@ -946,8 +947,8 @@ std::string cEngine::GetClipboardText() { } eeSAFE_DELETE_ARRAY( scrap ); - #elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::GetClipboardText() not implemented on Apple + #else + #warning cEngine::GetClipboardText() not implemented on this platform. #endif return tStr; @@ -976,8 +977,8 @@ std::wstring cEngine::GetClipboardTextWStr() { } eeSAFE_DELETE_ARRAY( scrap ); - #elif EE_PLATFORM == EE_PLATFORM_APPLE - #warning cEngine::GetClipboardTextWStr() not implemented on Apple + #else + #warning cEngine::GetClipboardTextWStr() not implemented on this platform. #endif return tStr; @@ -1005,14 +1006,14 @@ void cEngine::SetCurrentContext( GLXContext Context ) { GLXContext cEngine::GetContext() const { return mContext; } -#elif EE_PLATFORM == EE_PLATFORM_APPLE -void cEngine::SetCurrentContext( AGLContext Context ) { +#elif EE_PLATFORM == EE_PLATFORM_MACOSX +/*void cEngine::SetCurrentContext( AGLContext Context ) { aglSetCurrentContext( Context ); } AGLContext cEngine::GetContext() const { return mContext; -} +}*/ #endif void cEngine::GetMainContext() { @@ -1020,13 +1021,15 @@ void cEngine::GetMainContext() { mContext = wglGetCurrentContext(); #elif EE_PLATFORM == EE_PLATFORM_LINUX mContext = glXGetCurrentContext(); -#elif EE_PLATFORM == EE_PLATFORM_APPLE - mContext = aglGetCurrentContext(); +#elif EE_PLATFORM == EE_PLATFORM_MACOSX + //mContext = aglGetCurrentContext(); #endif } void cEngine::SetDefaultContext() { + #if EE_PLATFORM == EE_PLATFORM_WIN32 || EE_PLATFORM == EE_PLATFORM_LINUX SetCurrentContext( mContext ); + #endif } }} diff --git a/src/window/cengine.hpp b/src/window/cengine.hpp index bb1faacc3..7f8014a55 100755 --- a/src/window/cengine.hpp +++ b/src/window/cengine.hpp @@ -239,9 +239,9 @@ class EE_API cEngine : public cSingleton { #elif EE_PLATFORM == EE_PLATFORM_LINUX void SetCurrentContext( GLXContext Context ); GLXContext GetContext() const; - #elif EE_PLATFORM == EE_PLATFORM_APPLE - void SetCurrentContext( AGLContext Context ); - AGLContext GetContext() const; + #elif EE_PLATFORM == EE_PLATFORM_MACOSX + //void SetCurrentContext( AGLContext Context ); + //AGLContext GetContext() const; #endif void SetDefaultContext(); @@ -280,8 +280,8 @@ class EE_API cEngine : public cSingleton { HGLRC mContext; #elif EE_PLATFORM == EE_PLATFORM_LINUX GLXContext mContext; - #elif EE_PLATFORM == EE_PLATFORM_APPLE - AGLContext mContext + #elif EE_PLATFORM == EE_PLATFORM_MACOSX + //AGLContext mContext; #endif void CalculateFps();