diff --git a/Makefile b/Makefile index eaad988be..b3fc1f7c9 100644 --- a/Makefile +++ b/Makefile @@ -125,6 +125,14 @@ LIBS = -lfreetype -lopenal -lGL $(SDL_BACKEND_LINK) OTHERINC = -I/usr/include/freetype2 PLATFORMSRC = +ifeq ($(OS), freebsd) + +LIBS = -lfreetype -lopenal -lGL -lXcursor $(LIBSNDFILE) $(SDL_BACKEND_LINK) $(ALLEGRO_BACKEND_LINK) +OTHERINC = -I/usr/include/freetype2 +PLATFORMSRC = $(wildcard ./src/window/platform/x11/*.cpp) + +endif + endif endif @@ -137,7 +145,12 @@ EXE = eetest-$(RELEASETYPE) EXEIV = eeiv-$(RELEASETYPE) EXEFLUID = eefluid-$(RELEASETYPE) +ifeq ($(OS), haiku) +SRCGLEW = +else SRCGLEW = $(wildcard ./src/helper/glew/*.c) +endif + SRCSOIL = $(wildcard ./src/helper/SOIL/*.c) SRCSTBVORBIS = $(wildcard ./src/helper/stb_vorbis/*.c) SRCZLIB = $(wildcard ./src/helper/zlib/*.c) diff --git a/ee.linux.cbp b/ee.linux.cbp index 5043f7464..5dc22a3bd 100644 --- a/ee.linux.cbp +++ b/ee.linux.cbp @@ -76,6 +76,9 @@ + + + @@ -669,7 +672,8 @@ - + + diff --git a/ee.win.cbp b/ee.win.cbp index 2084fd4d5..2c1e9905f 100644 --- a/ee.win.cbp +++ b/ee.win.cbp @@ -81,6 +81,9 @@ + + + @@ -677,7 +680,8 @@ - + + diff --git a/src/graphics/cimage.cpp b/src/graphics/cimage.cpp index 51cf82b84..6ee805c5e 100644 --- a/src/graphics/cimage.cpp +++ b/src/graphics/cimage.cpp @@ -55,7 +55,7 @@ cImage::cImage( const std::string& Path ) : mAvoidFree(false) { int w, h, c; - Uint8 * data = SOIL_load_image( Path.c_str(), &w, &h, &c, SOIL_LOAD_AUTO ); + Uint8 * data = stbi_load( Path.c_str(), &w, &h, &c, 0 ); if ( NULL != data ) { mPixels = data; @@ -69,6 +69,8 @@ cImage::cImage( const std::string& Path ) : #ifdef EE_MEMORY_MANAGER MemoryManager::AddPointer( cAllocatedPointer( (void*)data, __FILE__, __LINE__, mSize ) ); #endif + } else { + cLog::instance()->Write( "Failed to load image, reason: " + std::string( stbi_failure_reason() ) ); } } diff --git a/src/graphics/ctexturefactory.cpp b/src/graphics/ctexturefactory.cpp index 2b148c6f9..99f81a503 100755 --- a/src/graphics/ctexturefactory.cpp +++ b/src/graphics/ctexturefactory.cpp @@ -10,7 +10,7 @@ cTextureFactory::cTextureFactory() : mTextures.clear(); mTextures.push_back( NULL ); - mAppPath = AppPath(); + mAppPath = GetProcessPath(); memset( &mCurrentTexture[0], 0, EE_MAX_TEXTURE_UNITS ); } diff --git a/src/graphics/ctexturegrouploader.cpp b/src/graphics/ctexturegrouploader.cpp index c9880d4b8..8b352fb76 100644 --- a/src/graphics/ctexturegrouploader.cpp +++ b/src/graphics/ctexturegrouploader.cpp @@ -8,7 +8,7 @@ namespace EE { namespace Graphics { cTextureGroupLoader::cTextureGroupLoader() : mThreaded(false), mLoaded(false), - mAppPath( AppPath() ), + mAppPath( GetProcessPath() ), mSkipResourceLoad(false), mIsLoading(false) { @@ -18,7 +18,7 @@ cTextureGroupLoader::cTextureGroupLoader( const std::string& TextureGroupPath, c mTextureGroupPath( TextureGroupPath ), mThreaded( Threaded ), mLoaded(false), - mAppPath( AppPath() ), + mAppPath( GetProcessPath() ), mPack(NULL), mSkipResourceLoad(false), mIsLoading(false) @@ -30,7 +30,7 @@ cTextureGroupLoader::cTextureGroupLoader( const Uint8* Data, const Uint32& DataS mTextureGroupPath( TextureGroupName ), mThreaded( Threaded ), mLoaded(false), - mAppPath( AppPath() ), + mAppPath( GetProcessPath() ), mPack(NULL), mSkipResourceLoad(false), mIsLoading(false) @@ -42,7 +42,7 @@ cTextureGroupLoader::cTextureGroupLoader( cPack * Pack, const std::string& FileP mTextureGroupPath( FilePackPath ), mThreaded( Threaded ), mLoaded(false), - mAppPath( AppPath() ), + mAppPath( GetProcessPath() ), mPack(NULL), mSkipResourceLoad(false), mIsLoading(false) @@ -335,7 +335,7 @@ bool cTextureGroupLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: tapath = FileRemoveExtension( TextureAtlasPath ) + "_ch" + toStr( z ) + "." + SaveTypeToExtension( mTexGrHdr.Format ); } - unsigned char * imgPtr = SOIL_load_image( tapath.c_str(), &x, &y, &c, SOIL_LOAD_AUTO ); + unsigned char * imgPtr = stbi_load( tapath.c_str(), &x, &y, &c, 0 ); if ( NULL != imgPtr ) { cImage Img( imgPtr, x, y, c ); @@ -356,7 +356,7 @@ bool cTextureGroupLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: if ( tSh->Date != ModifDate ) { tSh->Date = ModifDate; // Update the shape hdr - unsigned char * imgCopyPtr = SOIL_load_image( imgcopypath.c_str(), &x, &y, &c, SOIL_LOAD_AUTO ); + unsigned char * imgCopyPtr = stbi_load( imgcopypath.c_str(), &x, &y, &c, 0 ); if ( NULL != imgCopyPtr ) { cImage ImgCopy( imgCopyPtr, x, y, c ); @@ -364,7 +364,8 @@ bool cTextureGroupLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: Img.CopyImage( &ImgCopy, tSh->X, tSh->Y ); // Update the image into the texture atlas - SOIL_free_image_data( imgCopyPtr ); + if ( imgCopyPtr ) + free( imgCopyPtr ); } else break; } @@ -374,7 +375,8 @@ bool cTextureGroupLoader::UpdateTextureAtlas( std::string TextureAtlasPath, std: Img.SaveToFile( tapath, (EE_SAVE_TYPE)mTexGrHdr.Format ); - SOIL_free_image_data( imgPtr ); + if ( imgPtr ) + free( imgPtr ); } else return false; // fatal error diff --git a/src/graphics/ctextureloader.cpp b/src/graphics/ctextureloader.cpp index 6fae12505..0a383f47c 100644 --- a/src/graphics/ctextureloader.cpp +++ b/src/graphics/ctextureloader.cpp @@ -163,11 +163,11 @@ void cTextureLoader::LoadFromPath() { stbi_dds_info_from_memory( mPixels, mSize, &mImgWidth, &mImgHeight, &mChannels, &mIsDDSCompressed ); } else { - mPixels = SOIL_load_image( mFilepath.c_str(), &mImgWidth, &mImgHeight, &mChannels, SOIL_LOAD_AUTO ); + mPixels = stbi_load( mFilepath.c_str(), &mImgWidth, &mImgHeight, &mChannels, 0 ); } if ( NULL == mPixels ) - cLog::instance()->Write( SOIL_last_result() ); + cLog::instance()->Write( stbi_failure_reason() ); } } @@ -191,11 +191,11 @@ void cTextureLoader::LoadFromMemory() { memcpy( mPixels, mImagePtr, mSize ); stbi_dds_info_from_memory( mPixels, mSize, &mImgWidth, &mImgHeight, &mChannels, &mIsDDSCompressed ); } else { - mPixels = SOIL_load_image_from_memory( mImagePtr, mSize, &mImgWidth, &mImgHeight, &mChannels, SOIL_LOAD_AUTO ); + mPixels = stbi_load_from_memory( mImagePtr, mSize, &mImgWidth, &mImgHeight, &mChannels, 0 ); } if ( NULL == mPixels ) - cLog::instance()->Write( SOIL_last_result() ); + cLog::instance()->Write( stbi_failure_reason() ); } void cTextureLoader::LoadFromPixels() { @@ -234,20 +234,23 @@ void cTextureLoader::LoadFromPixels() { if ( NULL != mColorKey && 0 != mTexId ) cTextureFactory::instance()->GetTexture( mTexId )->CreateMaskFromColor( eeColorA( mColorKey->R(), mColorKey->G(), mColorKey->B(), 255 ), 0 ); + } else { + cLog::instance()->Write( "Failed to create texture. Reason: " + std::string( SOIL_last_result() ) ); } if ( TEX_LT_PIXELS != mLoadType ) { if ( mIsDDS ) { eeFree( mPixels ); } else { - SOIL_free_image_data( mPixels ); + if ( mPixels ) + free( mPixels ); } } mPixels = NULL; } else - cLog::instance()->Write( SOIL_last_result() ); + cLog::instance()->Write( stbi_failure_reason() ); SetLoaded(); } diff --git a/src/graphics/ctexturepacker.cpp b/src/graphics/ctexturepacker.cpp index c03a613e4..7b367eff3 100644 --- a/src/graphics/ctexturepacker.cpp +++ b/src/graphics/ctexturepacker.cpp @@ -495,7 +495,7 @@ void cTexturePacker::Save( const std::string& Filepath, const EE_SAVE_TYPE& Form t = &(*it); if ( t->Placed() ) { - Uint8 * data = SOIL_load_image( t->Name().c_str(), &w, &h, &c, 0 ); + Uint8 * data = stbi_load( t->Name().c_str(), &w, &h, &c, 0 ); if ( NULL != data && t->Width() == w && t->Height() == h ) { cImage * ImgCopy = eeNew( cImage, ( data, w, h, c ) ); @@ -509,7 +509,8 @@ void cTexturePacker::Save( const std::string& Filepath, const EE_SAVE_TYPE& Form eeSAFE_DELETE( ImgCopy ); - SOIL_free_image_data( data ); + if ( data ) + free( data ); mPlacedCount++; } diff --git a/src/system/clog.cpp b/src/system/clog.cpp index 2b44d7d32..cd0437ea0 100755 --- a/src/system/clog.cpp +++ b/src/system/clog.cpp @@ -15,7 +15,7 @@ cLog::~cLog() { Write( "...::: Entropia Engine++ Unloaded :::..." ); if ( !mFilePath.empty() ) - mFilePath = AppPath(); + mFilePath = GetProcessPath(); if ( mSave ) { std::string str = mFilePath; diff --git a/src/system/cresourceloader.cpp b/src/system/cresourceloader.cpp index 85d2a7676..a45f79ee4 100644 --- a/src/system/cresourceloader.cpp +++ b/src/system/cresourceloader.cpp @@ -17,9 +17,9 @@ cResourceLoader::~cResourceLoader() { void cResourceLoader::SetThreads() { if ( THREADS_AUTO == mThreads ) { - mThreads = GetNumCPUs(); + mThreads = GetCPUCount(); /** - eeInt NumCpus = GetNumCPUs() - 1; + eeInt NumCpus = GetCPUCount() - 1; if ( NumCpus > 1 ) mThreads = NumCpus; diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index fdd3394e0..0823b7315 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -25,7 +25,7 @@ void cEETest::Init() { mAxisX = 0; mAxisY = 0; - MyPath = AppPath(); + MyPath = GetProcessPath(); cIniFile Ini( MyPath + "data/ee.ini" ); Ini.ReadFile(); @@ -56,7 +56,7 @@ void cEETest::Init() { if ( Resizeable ) Style |= WindowStyle::Resize; - mWindow = EE->CreateWindow( WindowSettings( mWidth, mHeight, BitColor, Style ), ContextSettings( VSync, GLVer ) ); + mWindow = EE->CreateWindow( WindowSettings( mWidth, mHeight, BitColor, Style, MyPath + "data/ee.png" ), ContextSettings( VSync, GLVer ) ); PAK.Open( MyPath + "data/ee.zip" ); diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 2e7563f03..18e4c9649 100755 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -3,7 +3,6 @@ #if EE_PLATFORM == EE_PLATFORM_MACOSX #include - #include #elif EE_PLATFORM == EE_PLATFORM_WIN #include #elif EE_PLATFORM == EE_PLATFORM_LINUX @@ -11,6 +10,13 @@ #include #elif EE_PLATFORM == EE_PLATFORM_HAIKU #include + #include +#elif EE_PLATFORM == EE_PLATFORM_SOLARIS + #include +#endif + +#if EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD +#include #endif #if EE_PLATFORM == EE_PLATFORM_WIN @@ -32,17 +38,161 @@ static bool TickStarted = false; #if EE_PLATFORM == EE_PLATFORM_WIN +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); + +static std::string GetWindowsArch() { + std::string arch = "Unknown"; + OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + PGNSI pGNSI; + BOOL bOsVersionInfoEx; + + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + bOsVersionInfoEx = GetVersionEx( (OSVERSIONINFO*) &osvi ); + + if( bOsVersionInfoEx == FALSE ) return arch; + + // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. + pGNSI = (PGNSI) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetNativeSystemInfo" ); + + if( NULL != pGNSI ) { + pGNSI(&si); + } else { + GetSystemInfo(&si); + } + + if ( osvi.dwMajorVersion >= 6 ) { + if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) { + arch = "x64"; + } else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_INTEL ) { + arch = "x86"; + } + } else { + arch = "x86"; + } + + return arch; +} + +static std::string GetWindowsVersion() { + std::string os; + OSVERSIONINFOEX osvi; + SYSTEM_INFO si; + PGNSI pGNSI; + BOOL bOsVersionInfoEx; + + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + bOsVersionInfoEx = GetVersionEx( (OSVERSIONINFO*) &osvi ); + + if( bOsVersionInfoEx == FALSE ) return os; + + // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. + pGNSI = (PGNSI) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetNativeSystemInfo" ); + + if( NULL != pGNSI ) { + pGNSI(&si); + } else { + GetSystemInfo(&si); + } + + os = "Microsoft "; + + if ( VER_PLATFORM_WIN32_NT == osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) { + if ( osvi.dwMajorVersion == 6 ) { + if( osvi.dwMinorVersion == 0 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + os += "Windows Vista"; + } else { + os += "Windows Server 2008"; + } + } + + if ( osvi.dwMinorVersion == 1 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + os += "Windows 7"; + } else { + os += "Windows Server 2008 R2"; + } + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) { + if ( GetSystemMetrics(SM_SERVERR2) ) { + os += "Windows Server 2003 R2, "; + } else if ( osvi.wSuiteMask & VER_SUITE_STORAGE_SERVER ) { + os += "Windows Storage Server 2003"; + } else if ( osvi.wSuiteMask & 0x00008000 ) { //VER_SUITE_WH_SERVER + os += "Windows Home Server"; + } else if ( osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ) { + os += "Windows XP Professional x64 Edition"; + } else { + os += "Windows Server 2003, "; + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) { + os += "Windows XP"; + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) { + os += "Windows 2000"; + } + + // Include service pack (if any) and build number. + std::string CSDVer( osvi.szCSDVersion ); + if ( CSDVer.size() ) { + os += " " + CSDVer; + } + } else if ( VER_PLATFORM_WIN32_WINDOWS == osvi.dwPlatformId ) { + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) { + if (osvi.szCSDVersion[1] == 'C' || + osvi.szCSDVersion[1] == 'B') { + os += "Windows 95 OSR2"; + } else { + os += "Windows 95"; + } + } else if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) { + if (osvi.szCSDVersion[1] == 'A') { + os += "Windows 98 SE"; + } else { + os += "Windows 98"; + } + } else if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) { + os += "Windows ME"; + } else if (osvi.dwMajorVersion == 4) { + os += "Windows unknown 95 family"; + } else { + os += "Windows"; + } + } else { + os += "Windows"; + } + + return os; +} + #define TIME_WRAP_VALUE (~(DWORD)0) /* The first high-resolution ticks value of the application */ static LARGE_INTEGER hires_start_ticks; /* The number of ticks per second of the high-resolution performance counter */ static LARGE_INTEGER hires_ticks_per_second; + #endif #if EE_PLATFORM == EE_PLATFORM_LINUX || EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD #define HAVE_CLOCK_GETTIME #endif +#if defined( EE_PLATFORM_POSIX ) +#include +#endif + #ifdef EE_PLATFORM_POSIX #ifdef HAVE_CLOCK_GETTIME static struct timespec start; @@ -53,6 +203,38 @@ static struct timeval start; namespace EE { namespace Utils { +std::string GetOSName() { +#if defined( EE_PLATFORM_POSIX ) + struct utsname os; + + if ( -1 != uname( &os ) ) { + return std::string( os.sysname ) + " " + std::string( os.release ); + } + + return "Unknown"; +#elif EE_PLATFORM == EE_PLATFORM_WIN + return GetWindowsVersion(); +#else + return "Unknown"; +#endif +} + +std::string GetOSArchitecture() { +#if defined( EE_PLATFORM_POSIX ) + struct utsname os; + + if ( -1 != uname( &os ) ) { + return std::string( os.machine ); + } + + return "Unknown"; +#elif EE_PLATFORM == EE_PLATFORM_WIN + return GetWindowsArch(); +#else + return "Unknown"; +#endif +} + bool FileExists( const std::string& Filepath ) { struct stat st; return ( stat( Filepath.c_str(), &st ) == 0 ); @@ -121,7 +303,7 @@ void eeSleep( const Uint32& ms ) { #endif } -std::string AppPath() { +std::string GetProcessPath() { #if EE_PLATFORM == EE_PLATFORM_MACOSX char exe_file[PATH_MAX + 1]; CFBundleRef mainBundle = CFBundleGetMainBundle(); @@ -185,8 +367,31 @@ std::string AppPath() { return std::string(szDrive) + std::string(szDir); #endif +#elif EE_PLATFORM == EE_PLATFORM_BSD + int mib[4]; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + char buf[1024]; + size_t cb = sizeof(buf); + sysctl(mib, 4, buf, &cb, NULL, 0); + + return FileRemoveFileName( std::string( buf ) ); +#elif EE_PLATFORM == EE_PLATFORM_SOLARIS + return FileRemoveFileName( std::string( getexecname() ) ); +#elif EE_PLATFORM == EE_PLATFORM_HAIKU + image_info info; + int32 cookie = 0; + + while ( B_OK == get_next_image_info( 0, &cookie, &info ) ) { + if ( info.type == B_APP_IMAGE ) + break; + } + + return FileRemoveFileName( std::string( info.name ) ); #else - #warning AppPath() not implemented on this platform. ( will return "./" ) + #warning GetProcessPath() not implemented on this platform. ( will return "./" ) return "./"; #endif } @@ -516,7 +721,7 @@ std::string FileRemoveFileName( const std::string& filepath ) { return filepath.substr( 0, filepath.find_last_of("/\\") + 1 ); } -eeInt GetNumCPUs() { +eeInt GetCPUCount() { eeInt nprocs = -1; #if EE_PLATFORM == EE_PLATFORM_WIN @@ -533,11 +738,11 @@ eeInt GetNumCPUs() { mib[0] = CTL_HW; mib[1] = HW_NCPU; - + len = sizeof(maxproc); sysctl( mib, 2, &maxproc, &len, NULL, 0 ); - + nprocs = maxproc; #elif EE_PLATFORM == EE_PLATFORM_HAIKU system_info info; @@ -546,7 +751,7 @@ eeInt GetNumCPUs() { nprocs = info.cpu_count; } #else - #warning GetNumCPUs not implemented on this platform ( it will return 1 ). + #warning GetCPUCount not implemented on this platform ( it will return 1 ). #endif if ( nprocs < 1 ) diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index 11b2f0a3f..f6a1cc52e 100755 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -14,7 +14,7 @@ namespace EE { namespace Utils { void EE_API eeSleep( const Uint32& ms ); /** @return The application path ( the executable path ) */ - std::string EE_API AppPath(); + std::string EE_API GetProcessPath(); /** @return The files and sub directories contained by a directory */ std::vector EE_API FilesGetInPath( const std::string& path ); @@ -82,7 +82,7 @@ namespace EE { namespace Utils { bool EE_API FileWrite( const std::string& filepath, const std::vector& data ); /** @return The Number of CPUs of the system. */ - eeInt EE_API GetNumCPUs(); + eeInt EE_API GetCPUCount(); /** @return The modification date of the file */ Uint32 EE_API FileGetModificationDate( const std::string& Filepath ); @@ -117,6 +117,12 @@ namespace EE { namespace Utils { /** Write a 32 bit flag value */ void EE_API SetFlagValue( Uint32 * Key, Uint32 Val, Uint32 BitWrite ); + + /** @return The OS Name */ + std::string GetOSName(); + + /** @return The OS Architecture */ + std::string GetOSArchitecture(); } } diff --git a/src/window/backend/SDL/cwindowsdl.cpp b/src/window/backend/SDL/cwindowsdl.cpp index 4db6008e6..c33e578db 100644 --- a/src/window/backend/SDL/cwindowsdl.cpp +++ b/src/window/backend/SDL/cwindowsdl.cpp @@ -194,7 +194,7 @@ bool cWindowSDL::Icon( const std::string& Path ) { return false; } - unsigned char * Ptr = SOIL_load_image( Path.c_str(), &x, &y, &c, SOIL_LOAD_AUTO ); + unsigned char * Ptr = stbi_load( Path.c_str(), &x, &y, &c, 0 ); if ( NULL != Ptr ) { Int32 W = x; diff --git a/src/window/backend/allegro5/cwindowal.cpp b/src/window/backend/allegro5/cwindowal.cpp index 7819977c5..1f4b28015 100644 --- a/src/window/backend/allegro5/cwindowal.cpp +++ b/src/window/backend/allegro5/cwindowal.cpp @@ -409,7 +409,7 @@ bool cWindowAl::Icon( const std::string& Path ) { return false; } - unsigned char * Ptr = SOIL_load_image( Path.c_str(), &x, &y, &c, SOIL_LOAD_AUTO ); + unsigned char * Ptr = stbi_load( Path.c_str(), &x, &y, &c, 0 ); if ( NULL != Ptr ) { Int32 W = x; diff --git a/src/window/cwindow.cpp b/src/window/cwindow.cpp index 830ee0d88..d22118c24 100644 --- a/src/window/cwindow.cpp +++ b/src/window/cwindow.cpp @@ -142,7 +142,7 @@ bool cWindow::TakeScreenshot( std::string filepath, const EE_SAVE_TYPE& Format ) if ( IsDirectory( filepath ) || !Ext.size() ) CreateNewFile = true; } else { - filepath = AppPath(); + filepath = GetProcessPath(); CreateNewFile = true; } @@ -317,7 +317,7 @@ void cWindow::SendVideoResizeCb() { } void cWindow::LogSuccessfulInit( const std::string& BackendName ) { - cLog::instance()->Write( "Engine Initialized Succesfully.\n\tBackend: " + BackendName + "\n\tGL Backend: " + GLi->VersionStr() + "\n\tGL Vendor: " + GLi->GetVendor() + "\n\tGL Renderer: " + GLi->GetRenderer() + "\n\tGL Version: " + GLi->GetVersion() + "\n\tGL Shading Language Version: " + GLi->GetShadingLanguageVersion() ); + cLog::instance()->Write( "Engine Initialized Succesfully.\n\tOS: " + GetOSName() + "\n\tArch: " + GetOSArchitecture() + " \n\tBackend: " + BackendName + "\n\tGL Backend: " + GLi->VersionStr() + "\n\tGL Vendor: " + GLi->GetVendor() + "\n\tGL Renderer: " + GLi->GetRenderer() + "\n\tGL Version: " + GLi->GetVersion() + "\n\tGL Shading Language Version: " + GLi->GetShadingLanguageVersion() ); } void cWindow::LogFailureInit( const std::string& ClassName, const std::string& BackendName ) { diff --git a/src/window/cwindow.hpp b/src/window/cwindow.hpp index a1b4f5e6a..3378753bd 100644 --- a/src/window/cwindow.hpp +++ b/src/window/cwindow.hpp @@ -298,18 +298,35 @@ class EE_API cWindow { Uint32 mNumCallBacks; std::map mCallbacks; - struct _FrameData { + class cFrameData { public: - struct FPSData { - Uint32 LastCheck; - Uint32 Current; - Uint32 Count; - eeFloat Limit; - Int32 Error; - } FPS; - cTimeElapsed FrameElapsed; - eeFloat ElapsedTime; - } mFrameData; + class cFPSData { + public: + cFPSData() : + LastCheck(0), + Current(0), + Count(0), + Limit(0), + Error(0) + {} + + Uint32 LastCheck; + Uint32 Current; + Uint32 Count; + eeFloat Limit; + Int32 Error; + }; + + cFPSData FPS; + cTimeElapsed FrameElapsed; + eeFloat ElapsedTime; + + cFrameData() : + ElapsedTime(0) + {} + }; + + cFrameData mFrameData; /** Set the flag state to be the current window */ virtual void SetCurrent();