Renamed AppPath() for GetProcessPath()

Renamed GetNumCPUs() for GetCPUCount()
GetProcessPath() Added Haiku, BSD and Solaris implementations.
Added GetOSName()
Added GetOSArchitecture()
Changed some SOIL_load_image calls for stbi_load ( avoid depending in SOIL when isn't needed ).
Fixed a bug on cWindow::mFrameData, the structure values werent initialized and in some rare case scenario this provoked a crash.
This commit is contained in:
spartanj
2011-03-14 02:42:47 -03:00
parent 9f73ffbf05
commit 42c845bce7
17 changed files with 306 additions and 49 deletions

View File

@@ -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)

View File

@@ -76,6 +76,9 @@
<Unit filename="src/base/memorymanager.cpp" />
<Unit filename="src/base/memorymanager.hpp" />
<Unit filename="src/base/stlcontainers.hpp" />
<Unit filename="src/base/string.cpp" />
<Unit filename="src/base/string.hpp" />
<Unit filename="src/base/utf.hpp" />
<Unit filename="src/ee.h" />
<Unit filename="src/gaming/base.hpp" />
<Unit filename="src/gaming/cisomap.cpp" />
@@ -669,7 +672,8 @@
<Unit filename="src/system/tcontainer.hpp" />
<Unit filename="src/system/tresourcemanager.hpp" />
<Unit filename="src/system/tsingleton.hpp" />
<Unit filename="src/test/ee.cpp" />
<Unit filename="src/test/eetest.cpp" />
<Unit filename="src/test/eetest.hpp" />
<Unit filename="src/ui/base.hpp" />
<Unit filename="src/ui/cuibackground.cpp" />
<Unit filename="src/ui/cuibackground.hpp" />

View File

@@ -81,6 +81,9 @@
<Unit filename="src\base\memorymanager.cpp" />
<Unit filename="src\base\memorymanager.hpp" />
<Unit filename="src\base\stlcontainers.hpp" />
<Unit filename="src\base\string.cpp" />
<Unit filename="src\base\string.hpp" />
<Unit filename="src\base\utf.hpp" />
<Unit filename="src\ee.h" />
<Unit filename="src\gaming\base.hpp" />
<Unit filename="src\gaming\cisomap.cpp" />
@@ -677,7 +680,8 @@
<Unit filename="src\system\tcontainer.hpp" />
<Unit filename="src\system\tresourcemanager.hpp" />
<Unit filename="src\system\tsingleton.hpp" />
<Unit filename="src\test\ee.cpp" />
<Unit filename="src\test\eetest.cpp" />
<Unit filename="src\test\eetest.hpp" />
<Unit filename="src\ui\base.hpp" />
<Unit filename="src\ui\cuibackground.cpp" />
<Unit filename="src\ui\cuibackground.hpp" />

View File

@@ -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() ) );
}
}

View File

@@ -10,7 +10,7 @@ cTextureFactory::cTextureFactory() :
mTextures.clear();
mTextures.push_back( NULL );
mAppPath = AppPath();
mAppPath = GetProcessPath();
memset( &mCurrentTexture[0], 0, EE_MAX_TEXTURE_UNITS );
}

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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++;
}

View File

@@ -15,7 +15,7 @@ cLog::~cLog() {
Write( "...::: Entropia Engine++ Unloaded :::..." );
if ( !mFilePath.empty() )
mFilePath = AppPath();
mFilePath = GetProcessPath();
if ( mSave ) {
std::string str = mFilePath;

View File

@@ -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;

View File

@@ -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" );

View File

@@ -3,7 +3,6 @@
#if EE_PLATFORM == EE_PLATFORM_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#include <sys/sysctl.h>
#elif EE_PLATFORM == EE_PLATFORM_WIN
#include <windows.h>
#elif EE_PLATFORM == EE_PLATFORM_LINUX
@@ -11,6 +10,13 @@
#include <unistd.h>
#elif EE_PLATFORM == EE_PLATFORM_HAIKU
#include <kernel/OS.h>
#include <kernel/image.h>
#elif EE_PLATFORM == EE_PLATFORM_SOLARIS
#include <stdlib.h>
#endif
#if EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD
#include <sys/sysctl.h>
#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 <sys/utsname.h>
#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 )

View File

@@ -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<std::string> 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<Uint8>& 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();
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 ) {

View File

@@ -298,18 +298,35 @@ class EE_API cWindow {
Uint32 mNumCallBacks;
std::map<Uint32, WindowResizeCallback> 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();