From 9409443df5d2fca94c36d5f47429793d134aff4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Fri, 16 Aug 2013 00:39:51 -0300 Subject: [PATCH] Fixd VC++ compilation. SDL2 is now the default backend for VC++. --- include/eepp/helper/glew/glew.h | 2 +- premake4.lua | 2 +- projects/windows/ee.files | 24 ++++++++++++------- projects/windows/ee.includes | 1 + src/eepp/graphics/cimage.cpp | 2 +- src/eepp/helper/glew/glew.c | 14 +++++------ src/eepp/window/backend/SDL/cclipboardsdl.cpp | 11 ++++++++- .../window/backend/SDL/ccursormanagersdl.cpp | 5 ++++ src/eepp/window/backend/SDL/cinputsdl.cpp | 10 +++++++- .../backend/SDL/cjoystickmanagersdl.cpp | 4 ++++ src/eepp/window/backend/SDL/cjoysticksdl.hpp | 4 ++++ src/eepp/window/backend/SDL/cwindowsdl.cpp | 10 +++++++- src/eepp/window/backend/SDL2/base.hpp | 2 +- src/eepp/window/backend/SDL2/cbackendsdl2.cpp | 2 +- .../window/backend/SDL2/cjoysticksdl2.cpp | 2 +- src/eepp/window/backend/SDL2/cwindowsdl2.cpp | 5 ++++ src/eepp/window/backend/SDL2/cwindowsdl2.hpp | 2 +- src/test/eetest.cpp | 12 +++++----- 18 files changed, 83 insertions(+), 31 deletions(-) diff --git a/include/eepp/helper/glew/glew.h b/include/eepp/helper/glew/glew.h index 51a29ef8b..3e6f76ec1 100644 --- a/include/eepp/helper/glew/glew.h +++ b/include/eepp/helper/glew/glew.h @@ -191,7 +191,7 @@ typedef _W64 int ptrdiff_t; * GLEW_STATIC is defined for static library. * GLEW_BUILD is defined for building the DLL library. */ - +#define GLEW_STATIC #ifdef GLEW_STATIC # define GLEWAPI extern #else diff --git a/premake4.lua b/premake4.lua index 4403c6dc9..1c8618c29 100644 --- a/premake4.lua +++ b/premake4.lua @@ -484,7 +484,7 @@ end function backend_is( name ) if not _OPTIONS["with-backend"] then - if ( is_vs() or os.is_real("mingw32") ) then + if ( os.is_real("mingw32") ) then _OPTIONS["with-backend"] = "SDL" else _OPTIONS["with-backend"] = "SDL2" diff --git a/projects/windows/ee.files b/projects/windows/ee.files index a10f3461d..93b9d78ac 100644 --- a/projects/windows/ee.files +++ b/projects/windows/ee.files @@ -32,8 +32,7 @@ ../../include/eepp/system/tresourcemanager.hpp ../../include/eepp/system/tcontainer.hpp ../../include/eepp/system/czip.hpp -../../include/eepp/system/ctimer.hpp -../../include/eepp/system/ctimeelapsed.hpp +../../include/eepp/system/cclock.hpp ../../include/eepp/system/cthread.hpp ../../include/eepp/system/cresourceloader.hpp ../../include/eepp/system/crc4.hpp @@ -49,8 +48,7 @@ ../../include/eepp/system/cinifile.hpp ../../include/eepp/system/base.hpp ../../src/eepp/system/czip.cpp -../../src/eepp/system/ctimer.cpp -../../src/eepp/system/ctimeelapsed.cpp +../../src/eepp/system/cclock.cpp ../../src/eepp/system/cthread.cpp ../../src/eepp/system/cresourceloader.cpp ../../src/eepp/system/crc4.cpp @@ -64,16 +62,16 @@ ../../src/eepp/system/ciostreamfile.cpp ../../src/eepp/system/cinifile.cpp ../../src/eepp/system/platform/platformimpl.hpp -../../src/eepp/system/platform/posix/ctimerimpl.hpp +../../src/eepp/system/platform/posix/cclockimpl.hpp ../../src/eepp/system/platform/posix/cthreadimpl.hpp ../../src/eepp/system/platform/posix/cmuteximpl.hpp -../../src/eepp/system/platform/posix/ctimerimpl.cpp +../../src/eepp/system/platform/posix/cclockimpl.cpp ../../src/eepp/system/platform/posix/cthreadimpl.cpp ../../src/eepp/system/platform/posix/cmuteximpl.cpp -../../src/eepp/system/platform/win/ctimerimpl.hpp +../../src/eepp/system/platform/win/cclockimpl.hpp ../../src/eepp/system/platform/win/cthreadimpl.hpp ../../src/eepp/system/platform/win/cmuteximpl.hpp -../../src/eepp/system/platform/win/ctimerimpl.cpp +../../src/eepp/system/platform/win/cclockimpl.cpp ../../src/eepp/system/platform/win/cthreadimpl.cpp ../../src/eepp/system/platform/win/cmuteximpl.cpp ../../include/eepp/gaming/maphelper.hpp @@ -614,3 +612,13 @@ ../../src/examples/physics/physics.cpp ../../src/eepp/physics/cshapepoint.cpp ../../include/eepp/physics/cshapepoint.hpp +../../include/eepp/math/originpoint.hpp +../../include/eepp/system/ccondition.hpp +../../src/eepp/system/ccondition.cpp +../../src/eepp/system/platform/win/cconditionimpl.hpp +../../src/eepp/system/platform/win/cconditionimpl.cpp +../../src/eepp/system/platform/posix/cconditionimpl.hpp +../../src/eepp/system/platform/posix/cconditionimpl.cpp +../../include/eepp/graphics/opengl.hpp +../../src/eepp/system/ctime.cpp +../../include/eepp/system/ctime.hpp diff --git a/projects/windows/ee.includes b/projects/windows/ee.includes index 02a2a3994..eb8e42b7d 100644 --- a/projects/windows/ee.includes +++ b/projects/windows/ee.includes @@ -1 +1,2 @@ ../../src/ +../../include/ diff --git a/src/eepp/graphics/cimage.cpp b/src/eepp/graphics/cimage.cpp index e170702e8..691491d85 100644 --- a/src/eepp/graphics/cimage.cpp +++ b/src/eepp/graphics/cimage.cpp @@ -60,7 +60,7 @@ bool cImage::GetInfo( const std::string& path, int * width, int * height, int * tPack->ExtractFileToMemory( npath, PData ); - res = stbi_info_from_memory( PData.Data, PData.DataSize, width, height, channels ); + res = 0 != stbi_info_from_memory( PData.Data, PData.DataSize, width, height, channels ); } } diff --git a/src/eepp/helper/glew/glew.c b/src/eepp/helper/glew/glew.c index e7cc57ad2..d4dfff8b6 100644 --- a/src/eepp/helper/glew/glew.c +++ b/src/eepp/helper/glew/glew.c @@ -267,13 +267,16 @@ static GLboolean _glewStrSame3 (GLubyte** a, GLuint* na, const GLubyte* b, GLuin */ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, const GLubyte *end) { + const GLubyte *p, *ext; + GLuint len,n; + int i, max = 0; + if (start != NULL) { - const GLubyte* p; - GLuint len = _glewStrLen((const GLubyte*)name); + len = _glewStrLen((const GLubyte*)name); p = start; while (p < end) { - GLuint n = _glewStrCLen(p, ' '); + n = _glewStrCLen(p, ' '); if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; p += n+1; } @@ -281,12 +284,9 @@ static GLboolean _glewSearchExtension (const char* name, const GLubyte *start, c } else { if (glGetStringi != NULL) { - int max = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &max); - const GLubyte* ext; - int i; - GLuint len = _glewStrLen((const GLubyte*)name); + len = _glewStrLen((const GLubyte*)name); for (i = 0; i < max; i++) { ext = (const GLubyte*)glGetStringi(GL_EXTENSIONS, i); diff --git a/src/eepp/window/backend/SDL/cclipboardsdl.cpp b/src/eepp/window/backend/SDL/cclipboardsdl.cpp index af3066f96..9b698d6e1 100644 --- a/src/eepp/window/backend/SDL/cclipboardsdl.cpp +++ b/src/eepp/window/backend/SDL/cclipboardsdl.cpp @@ -4,10 +4,19 @@ #include #include + +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif #if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX || defined( EE_X11_PLATFORM ) - #include + #if !defined( EE_COMPILER_MSVC ) + #include + #else + #include + #endif #endif #if EE_PLATFORM == EE_PLATFORM_WIN diff --git a/src/eepp/window/backend/SDL/ccursormanagersdl.cpp b/src/eepp/window/backend/SDL/ccursormanagersdl.cpp index fe8835555..cb9d9ed2e 100644 --- a/src/eepp/window/backend/SDL/ccursormanagersdl.cpp +++ b/src/eepp/window/backend/SDL/ccursormanagersdl.cpp @@ -4,7 +4,12 @@ #ifdef EE_BACKEND_SDL_1_2 #include + +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif namespace EE { namespace Window { namespace Backend { namespace SDL { diff --git a/src/eepp/window/backend/SDL/cinputsdl.cpp b/src/eepp/window/backend/SDL/cinputsdl.cpp index 26b7b0947..26dedc961 100644 --- a/src/eepp/window/backend/SDL/cinputsdl.cpp +++ b/src/eepp/window/backend/SDL/cinputsdl.cpp @@ -2,10 +2,18 @@ #ifdef EE_BACKEND_SDL_1_2 +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif #if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX || defined( EE_X11_PLATFORM ) - #include + #if !defined( EE_COMPILER_MSVC ) + #include + #else + #include + #endif #endif #include diff --git a/src/eepp/window/backend/SDL/cjoystickmanagersdl.cpp b/src/eepp/window/backend/SDL/cjoystickmanagersdl.cpp index 1208ef7f0..0a01c3b67 100644 --- a/src/eepp/window/backend/SDL/cjoystickmanagersdl.cpp +++ b/src/eepp/window/backend/SDL/cjoystickmanagersdl.cpp @@ -3,7 +3,11 @@ #ifdef EE_BACKEND_SDL_1_2 +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif namespace EE { namespace Window { namespace Backend { namespace SDL { diff --git a/src/eepp/window/backend/SDL/cjoysticksdl.hpp b/src/eepp/window/backend/SDL/cjoysticksdl.hpp index 0c993a38c..0ea78d3d3 100644 --- a/src/eepp/window/backend/SDL/cjoysticksdl.hpp +++ b/src/eepp/window/backend/SDL/cjoysticksdl.hpp @@ -7,7 +7,11 @@ #ifdef EE_BACKEND_SDL_1_2 #include +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif namespace EE { namespace Window { namespace Backend { namespace SDL { diff --git a/src/eepp/window/backend/SDL/cwindowsdl.cpp b/src/eepp/window/backend/SDL/cwindowsdl.cpp index f941926f1..3c4f113e0 100644 --- a/src/eepp/window/backend/SDL/cwindowsdl.cpp +++ b/src/eepp/window/backend/SDL/cwindowsdl.cpp @@ -2,10 +2,18 @@ #ifdef EE_BACKEND_SDL_1_2 +#if !defined( EE_COMPILER_MSVC ) #include +#else +#include +#endif #if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX || defined( EE_X11_PLATFORM ) -#include + #if !defined( EE_COMPILER_MSVC ) + #include + #else + #include + #endif #endif #include diff --git a/src/eepp/window/backend/SDL2/base.hpp b/src/eepp/window/backend/SDL2/base.hpp index 0d04c226e..ac6f9c341 100644 --- a/src/eepp/window/backend/SDL2/base.hpp +++ b/src/eepp/window/backend/SDL2/base.hpp @@ -10,7 +10,7 @@ #define EE_BACKEND_SDL2 #endif - #if EE_PLATFORM != EE_PLATFORM_ANDROID + #if EE_PLATFORM != EE_PLATFORM_ANDROID && !defined( EE_COMPILER_MSVC ) #include #else #include diff --git a/src/eepp/window/backend/SDL2/cbackendsdl2.cpp b/src/eepp/window/backend/SDL2/cbackendsdl2.cpp index 2e8d5aa11..635ead5a5 100644 --- a/src/eepp/window/backend/SDL2/cbackendsdl2.cpp +++ b/src/eepp/window/backend/SDL2/cbackendsdl2.cpp @@ -2,7 +2,7 @@ #ifdef EE_BACKEND_SDL2 -#if EE_PLATFORM != EE_PLATFORM_ANDROID +#if EE_PLATFORM != EE_PLATFORM_ANDROID && !defined( EE_COMPILER_MSVC ) #include #else #include diff --git a/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp b/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp index 65c613338..fbac4f9ba 100644 --- a/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp +++ b/src/eepp/window/backend/SDL2/cjoysticksdl2.cpp @@ -2,7 +2,7 @@ #ifdef EE_BACKEND_SDL2 -#if EE_PLATFORM != EE_PLATFORM_ANDROID +#if EE_PLATFORM != EE_PLATFORM_ANDROID && !defined( EE_COMPILER_MSVC ) #include #else #include diff --git a/src/eepp/window/backend/SDL2/cwindowsdl2.cpp b/src/eepp/window/backend/SDL2/cwindowsdl2.cpp index 1c430d521..09ba7e527 100644 --- a/src/eepp/window/backend/SDL2/cwindowsdl2.cpp +++ b/src/eepp/window/backend/SDL2/cwindowsdl2.cpp @@ -3,7 +3,12 @@ #ifdef EE_BACKEND_SDL2 #if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX || defined( EE_X11_PLATFORM ) + #if !defined( EE_COMPILER_MSVC ) #include + #else + #include + #endif + #undef CreateWindow #endif #include diff --git a/src/eepp/window/backend/SDL2/cwindowsdl2.hpp b/src/eepp/window/backend/SDL2/cwindowsdl2.hpp index 9e2422dd1..de4222f63 100644 --- a/src/eepp/window/backend/SDL2/cwindowsdl2.hpp +++ b/src/eepp/window/backend/SDL2/cwindowsdl2.hpp @@ -8,7 +8,7 @@ #include -class SDL_SysWMinfo; +struct SDL_SysWMinfo; #if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX || defined( EE_X11_PLATFORM ) #define EE_USE_WMINFO diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index c42814f47..5dd2a8ac1 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -172,7 +172,7 @@ void cEETest::OnFontLoaded( cResourceLoader * ObjLoaded ) { TTF = cFontManager::instance()->GetByName( "arial" ); TTFB = cFontManager::instance()->GetByName( "arialb" ); - Log->Writef( "Fonts loading time: %f ms.", mFTE.Elapsed() ); + Log->Writef( "Fonts loading time: %f ms.", mFTE.Elapsed().AsMilliseconds() ); eeASSERT( TTF != NULL ); eeASSERT( TTFB != NULL ); @@ -251,7 +251,7 @@ void cEETest::CreateUI() { CreateUIThemeTextureAtlas(); - Log->Writef( "Texture Atlas Loading Time: %f ms.", TE.Elapsed() ); + Log->Writef( "Texture Atlas Loading Time: %f ms.", TE.Elapsed().AsMilliseconds() ); cUIManager::instance()->Init(); //UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER @@ -573,7 +573,7 @@ void cEETest::CreateUI() { C = reinterpret_cast ( C->Parent() ); - Log->Writef( "CreateUI time: %f ms.", TE.Elapsed() ); + Log->Writef( "CreateUI time: %f ms.", TE.Elapsed().AsMilliseconds() ); } void cEETest::CreateMapEditor() { @@ -803,7 +803,7 @@ void cEETest::OnTextureLoaded( cResourceLoader * ResLoaded ) { } void cEETest::LoadTextures() { - cClock te; + cClock TE; Uint32 i; @@ -918,7 +918,7 @@ void cEETest::LoadTextures() { mBoxSprite = eeNew( cSprite, ( cGlobalTextureAtlas::instance()->Add( eeNew( cSubTexture, ( TN[3], "ilmare" ) ) ) ) ); mCircleSprite = eeNew( cSprite, ( cGlobalTextureAtlas::instance()->Add( eeNew( cSubTexture, ( TN[1], "thecircle" ) ) ) ) ); - Log->Writef( "Textures loading time: %f ms.", te.Elapsed() ); + Log->Writef( "Textures loading time: %f ms.", TE.Elapsed().AsMilliseconds() ); Map.Create( 100, 100, 2, 128, 64, eeColor(175,175,175) ); RandomizeHeights(); @@ -926,7 +926,7 @@ void cEETest::LoadTextures() { TreeTilingCreated = false; CreateTiling(Wireframe); - Log->Writef( "Map creation time: %f ms.", te.Elapsed() ); + Log->Writef( "Map creation time: %f ms.", TE.Elapsed().AsMilliseconds() ); } void cEETest::RandomizeHeights() {