mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Some code clean up:
Time is always measured with cTime. Debugging log texts now are called with eePRINT/eePRINTL/eePRINTC. Added some patches to EE::Network: Request Methods: Head, Put, Delete added. Support for chunked transfers in cHttp. Changed version, we are now at 0.9.5, codename "Makyo".
This commit is contained in:
@@ -28,12 +28,12 @@ cAudioDevice::cAudioDevice() {
|
||||
|
||||
std::string log( "OpenAL current device:\n" );
|
||||
log += "\t" + std::string( (const char *)alcGetString(mDevice, ALC_DEVICE_SPECIFIER) );
|
||||
cLog::instance()->Write( log );
|
||||
eePRINTL( log.c_str() );
|
||||
} else {
|
||||
cLog::instance()->Write("Failed to create the audio context");
|
||||
eePRINTL("Failed to create the audio context");
|
||||
}
|
||||
} else {
|
||||
cLog::instance()->Write("Failed to open the audio device");
|
||||
eePRINTL("Failed to open the audio device");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void cAudioDevice::PrintInfo() {
|
||||
log += "OpenAL default device:\n";
|
||||
log += "\t" + std::string( (const char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER) );
|
||||
|
||||
cLog::instance()->Write( log );
|
||||
eePRINTL( log.c_str() );
|
||||
}
|
||||
|
||||
cAudioDevice::~cAudioDevice() {
|
||||
|
||||
@@ -45,7 +45,7 @@ bool cMusic::OpenFromFile( const std::string& Filename ) {
|
||||
mFile = cSoundFile::CreateRead( Filename );
|
||||
|
||||
if ( NULL == mFile ) {
|
||||
cLog::instance()->Write( "Failed to open \"" + Filename + "\" for reading" );
|
||||
eePRINTL( "Failed to open %s for reading", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ bool cMusic::OpenFromFile( const std::string& Filename ) {
|
||||
// Initialize the stream
|
||||
Initialize( mFile->GetChannelCount(), mFile->GetSampleRate() );
|
||||
|
||||
cLog::instance()->Write( "Music file " + Filename + " loaded." );
|
||||
eePRINTL( "Music file %s loaded.", Filename.c_str() );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ bool cMusic::OpenFromMemory( const char * Data, std::size_t SizeInBytes ) {
|
||||
mFile = cSoundFile::CreateRead( Data, SizeInBytes );
|
||||
|
||||
if ( NULL == mFile ) {
|
||||
cLog::instance()->Write( "Failed to open music from memory for reading" );
|
||||
eePRINTL( "Failed to open music from memory for reading" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool cMusic::OpenFromMemory( const char * Data, std::size_t SizeInBytes ) {
|
||||
|
||||
Initialize( mFile->GetChannelCount(), mFile->GetSampleRate() ); // Initialize the stream
|
||||
|
||||
cLog::instance()->Write( "Music file loaded from memory." );
|
||||
eePRINTL( "Music file loaded from memory." );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ bool cSoundBuffer::LoadFromFile(const std::string& Filename) {
|
||||
}
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "Failed to load sound buffer from file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to load sound buffer from file %s", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,21 +67,21 @@ bool cSoundBuffer::LoadFromFile(const std::string& Filename) {
|
||||
mSamples.resize( SamplesCount );
|
||||
|
||||
if ( File->Read( &mSamples[0], SamplesCount ) == SamplesCount ) {
|
||||
cLog::instance()->Write( "Sound file " + Filename + " loaded." );
|
||||
eePRINTL( "Sound file %s loaded.", Filename.c_str() );
|
||||
|
||||
// Update the internal buffer with the new samples
|
||||
eeDelete( File );
|
||||
|
||||
return Update( ChannelCount, SampleRate );
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to read audio data from file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to read audio data from file %s", Filename.c_str() );
|
||||
|
||||
eeDelete( File );
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to load sound buffer from file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to load sound buffer from file %s", Filename.c_str() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -112,21 +112,21 @@ bool cSoundBuffer::LoadFromMemory( const char* Data, std::size_t SizeInBytes ) {
|
||||
mSamples.resize( SamplesCount );
|
||||
|
||||
if ( File->Read( &mSamples[0], SamplesCount ) == SamplesCount ) {
|
||||
cLog::instance()->Write( "Sound file loaded from memory." );
|
||||
eePRINTL( "Sound file loaded from memory." );
|
||||
|
||||
// Update the internal buffer with the new samples
|
||||
eeDelete( File );
|
||||
|
||||
return Update( ChannelCount, SampleRate );
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to read audio data from file in memory" );
|
||||
eePRINTL( "Failed to read audio data from file in memory" );
|
||||
|
||||
eeDelete( File );
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to load sound buffer from file in memory" );
|
||||
eePRINTL( "Failed to load sound buffer from file in memory" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -136,13 +136,13 @@ bool cSoundBuffer::LoadFromSamples( const Int16 * Samples, std::size_t SamplesCo
|
||||
// Copy the new audio samples
|
||||
mSamples.assign( Samples, Samples + SamplesCount );
|
||||
|
||||
cLog::instance()->Write( "Sound file loaded from memory samples." );
|
||||
eePRINTL( "Sound file loaded from memory samples." );
|
||||
|
||||
// Update the internal buffer with the new samples
|
||||
return Update( ChannelCount, SampleRate );
|
||||
} else {
|
||||
// Error...
|
||||
cLog::instance()->Write( "Failed to load sound buffer from memory Samples" );
|
||||
eePRINTL( "Failed to load sound buffer from memory Samples" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ bool cSoundBuffer::SaveToFile(const std::string& Filename) const {
|
||||
return true;
|
||||
} else {
|
||||
// Error...
|
||||
cLog::instance()->Write( "Failed to save sound buffer to file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to save sound buffer to file %s", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ bool cSoundBuffer::Update( unsigned int ChannelCount, unsigned int SampleRate )
|
||||
|
||||
// Check if the format is valid
|
||||
if ( Format == 0 ) {
|
||||
cLog::instance()->Write( "Unsupported number of channels." );
|
||||
eePRINTL( "Unsupported number of channels." );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,37 +127,37 @@ bool cSoundFile::Restart() {
|
||||
// Reopen from file
|
||||
return OpenRead( mFilename, mSamplesCount, mChannelCount, mSampleRate );
|
||||
} else {
|
||||
cLog::instance()->Write( "Warning : trying to restart a sound opened in write mode, which is not allowed" );
|
||||
eePRINTL( "Warning : trying to restart a sound opened in write mode, which is not allowed" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool cSoundFile::OpenRead(const std::string& Filename, std::size_t&, unsigned int&, unsigned int&) {
|
||||
cLog::instance()->Write( "Failed to open sound file \"" + Filename + "\", format is not supported by EE" );
|
||||
eePRINTL( "Failed to open sound file %s, format is not supported by eepp", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cSoundFile::OpenRead(const char*, std::size_t, std::size_t&, unsigned int&, unsigned int&) {
|
||||
cLog::instance()->Write( "Failed to open sound file from memory, format is not supported by EE" );
|
||||
eePRINTL( "Failed to open sound file from memory, format is not supported by eepp" );
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cSoundFile::OpenWrite(const std::string& Filename, unsigned int, unsigned int) {
|
||||
cLog::instance()->Write( "Failed to open sound file \"" + Filename + "\", format is not supported by EE");
|
||||
eePRINTL( "Failed to open sound file %s, format is not supported by eepp", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
std::size_t cSoundFile::Read(Int16*, std::size_t) {
|
||||
cLog::instance()->Write( "Failed to read from sound file (not supported)" );
|
||||
eePRINTL( "Failed to read from sound file (not supported)" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cSoundFile::Write(const Int16*, std::size_t) {
|
||||
cLog::instance()->Write( "Failed to write to sound file (not supported)" );
|
||||
eePRINTL( "Failed to write to sound file (not supported)" );
|
||||
}
|
||||
|
||||
void cSoundFile::Seek( cTime timeOffset ) {
|
||||
cLog::instance()->Write( "Trying to seek a file that doesn't support seeking." );
|
||||
eePRINTL( "Trying to seek a file that doesn't support seeking." );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -62,7 +62,7 @@ bool cSoundFileDefault::OpenRead( const std::string& Filename, std::size_t& Samp
|
||||
mFile = sf_open(Filename.c_str(), SFM_READ, &fileInfos);
|
||||
|
||||
if ( NULL == mFile ) {
|
||||
cLog::instance()->Write( "Failed to read sound file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to read sound file %s", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ bool cSoundFileDefault::OpenRead( const char* Data, std::size_t SizeInBytes, std
|
||||
mFile = sf_open_virtual( &io, SFM_READ, &fileInfos, &mMemoryIO );
|
||||
|
||||
if ( !mFile ) {
|
||||
cLog::instance()->Write( "Failed to read sound file from memory ( " + std::string( sf_strerror( mFile ) ) + " )" );
|
||||
eePRINTL( "Failed to read sound file from memory ( %s )", sf_strerror( mFile ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ bool cSoundFileDefault::OpenWrite( const std::string& Filename, unsigned int Cha
|
||||
int Format = GetFormatFromFilename( Filename );
|
||||
if (Format == -1) {
|
||||
// Error : unrecognized extension
|
||||
cLog::instance()->Write( "Failed to create sound file \"" + Filename + "\" : unknown format" );
|
||||
eePRINTL( "Failed to create sound file %s : unknown format", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ bool cSoundFileDefault::OpenWrite( const std::string& Filename, unsigned int Cha
|
||||
mFile = sf_open( Filename.c_str(), SFM_WRITE, &fileInfos );
|
||||
|
||||
if ( NULL == mFile ) {
|
||||
cLog::instance()->Write( "Failed to create sound file \"" + Filename + "\"" );
|
||||
eePRINTL( "Failed to create sound file %s", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ bool cSoundFileOgg::OpenRead( const std::string& Filename, std::size_t& SamplesC
|
||||
mStream = stb_vorbis_open_filename( const_cast<char*>( Filename.c_str() ), NULL, NULL );
|
||||
|
||||
if ( NULL == mStream ) {
|
||||
cLog::instance()->Write( "Failed to read sound file \"" + Filename + "\" (cannot open the file)" );
|
||||
eePRINTL( "Failed to read sound file %s (cannot open the file)", Filename.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ bool cSoundFileOgg::OpenRead( const char* Data, std::size_t SizeInBytes, std::si
|
||||
mStream = stb_vorbis_open_memory( Buffer, Length, NULL, NULL );
|
||||
|
||||
if ( NULL == mStream ) {
|
||||
cLog::instance()->Write( "Failed to read sound file from memory (cannot open the file)" );
|
||||
eePRINTL( "Failed to read sound file from memory (cannot open the file)" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@ void cSoundStream::Initialize(unsigned int ChannelCount, unsigned int SampleRate
|
||||
if ( mFormat == 0 ) { // Check if the format is valid
|
||||
mChannelCount = 0;
|
||||
mSampleRate = 0;
|
||||
cLog::instance()->Write( "Unsupported number of channels." );
|
||||
eePRINTL( "Unsupported number of channels." );
|
||||
}
|
||||
}
|
||||
|
||||
void cSoundStream::Play() {
|
||||
if ( mFormat == 0 ) { // Check if the sound parameters have been set
|
||||
cLog::instance()->Write( "Failed to play audio stream : sound parameters have not been initialized (call Initialize first)." );
|
||||
eePRINTL( "Failed to play audio stream : sound parameters have not been initialized (call Initialize first)." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ using namespace EE::System;
|
||||
|
||||
namespace EE {
|
||||
|
||||
#ifdef EE_DEBUG
|
||||
|
||||
bool PrintDebugInLog = true;
|
||||
|
||||
#ifdef EE_DEBUG
|
||||
|
||||
void eeREPORT_ASSERT( const char * File, int Line, const char * Exp ) {
|
||||
#ifdef EE_COMPILER_MSVC
|
||||
|
||||
@@ -46,50 +46,120 @@ void eeREPORT_ASSERT( const char * File, int Line, const char * Exp ) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void eePRINT( const char * format, ... ) {
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
#endif
|
||||
|
||||
va_start( args, format );
|
||||
#ifndef EE_SILENT
|
||||
|
||||
eevsnprintf( buf, sizeof( buf ), format, args );
|
||||
|
||||
va_end( args );
|
||||
static void print_buffer( std::string& buf, bool newLine ) {
|
||||
if ( newLine )
|
||||
buf += "\n";
|
||||
|
||||
#ifdef EE_COMPILER_MSVC
|
||||
OutputDebugStringA( buf );
|
||||
OutputDebugStringA( buf.c_str() );
|
||||
#else
|
||||
if ( PrintDebugInLog && cLog::instance()->ConsoleOutput() && cLog::instance()->LiveWrite() )
|
||||
cLog::instance()->Write( std::string( buf ) );
|
||||
else
|
||||
printf("%s", buf );
|
||||
if ( PrintDebugInLog && cLog::instance()->ConsoleOutput() ) {
|
||||
cLog::instance()->Write( buf, false );
|
||||
return;
|
||||
} else {
|
||||
printf("%s", buf.c_str() );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( PrintDebugInLog )
|
||||
cLog::instance()->Write( std::string( buf ) );
|
||||
cLog::instance()->Write( buf, false );
|
||||
}
|
||||
|
||||
void eePRINT( const char * format, ... ) {
|
||||
int n, size = 2048;
|
||||
std::string buf( size, '\0' );
|
||||
|
||||
va_list args;
|
||||
|
||||
while ( 1 ) {
|
||||
va_start( args, format );
|
||||
|
||||
n = eevsnprintf( &buf[0], buf.size(), format, args );
|
||||
|
||||
if ( n > -1 && n < size ) {
|
||||
buf.resize( n );
|
||||
|
||||
print_buffer( buf, false );
|
||||
|
||||
va_end( args );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( n > -1 ) // glibc 2.1
|
||||
size = n+1; // precisely what is needed
|
||||
else // glibc 2.0
|
||||
size *= 2; // twice the old size
|
||||
|
||||
buf.resize( size );
|
||||
}
|
||||
}
|
||||
|
||||
void eePRINTL( const char * format, ... ) {
|
||||
int n, size = 2048;
|
||||
std::string buf( size, '\0' );
|
||||
|
||||
va_list args;
|
||||
|
||||
while ( 1 ) {
|
||||
va_start( args, format );
|
||||
|
||||
n = eevsnprintf( &buf[0], buf.size(), format, args );
|
||||
|
||||
if ( n > -1 && n < size ) {
|
||||
buf.resize( n );
|
||||
|
||||
print_buffer( buf, true );
|
||||
|
||||
va_end( args );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( n > -1 ) // glibc 2.1
|
||||
size = n+1; // precisely what is needed
|
||||
else // glibc 2.0
|
||||
size *= 2; // twice the old size
|
||||
|
||||
buf.resize( size );
|
||||
}
|
||||
}
|
||||
|
||||
void eePRINTC( unsigned int cond, const char * format, ...) {
|
||||
if ( 0 == cond )
|
||||
return;
|
||||
|
||||
char buf[2048];
|
||||
int n, size = 2048;
|
||||
std::string buf( size, '\0' );
|
||||
|
||||
va_list args;
|
||||
|
||||
va_start( args, format );
|
||||
while ( 1 ) {
|
||||
va_start( args, format );
|
||||
|
||||
eevsnprintf( buf, sizeof( buf ) / sizeof( buf[0]), format, args );
|
||||
n = eevsnprintf( &buf[0], buf.size(), format, args );
|
||||
|
||||
va_end( args );
|
||||
if ( n > -1 && n < size ) {
|
||||
buf.resize( n );
|
||||
|
||||
#ifdef EE_COMPILER_MSVC
|
||||
OutputDebugStringA( buf );
|
||||
#else
|
||||
printf("%s", buf );
|
||||
#endif
|
||||
print_buffer( buf, false );
|
||||
|
||||
if ( PrintDebugInLog )
|
||||
cLog::instance()->Write( std::string( buf ) );
|
||||
va_end( args );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( n > -1 ) // glibc 2.1
|
||||
size = n+1; // precisely what is needed
|
||||
else // glibc 2.0
|
||||
size *= 2; // twice the old size
|
||||
|
||||
buf.resize( size );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ bool MemoryManager::RemovePointer( void * Data ) {
|
||||
tAllocatedPointerMapIt it = mMapPointers.find( Data );
|
||||
|
||||
if ( it == mMapPointers.end() ) {
|
||||
eePRINT( "Trying to delete pointer %p created that does not exist!\n", Data );
|
||||
eePRINTL( "Trying to delete pointer %p created that does not exist!", Data );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -71,16 +71,15 @@ void MemoryManager::ShowResults() {
|
||||
EE::PrintDebugInLog = false;
|
||||
}
|
||||
|
||||
eePRINT("\n|--Memory Manager Report-------------------------------------|\n");
|
||||
eePRINT("|\n");
|
||||
eePRINTL("\n|--Memory Manager Report-------------------------------------|");
|
||||
eePRINTL("|");
|
||||
|
||||
if( mMapPointers.empty() ) {
|
||||
eePRINT( "| No memory leaks detected.\n" );
|
||||
eePRINTL( "| No memory leaks detected." );
|
||||
} else {
|
||||
eePRINT( "| Memory leaks detected: \n" );
|
||||
eePRINT( "|\n");
|
||||
|
||||
eePRINT( "| address\t file" );
|
||||
eePRINTL( "| Memory leaks detected: " );
|
||||
eePRINTL( "|");
|
||||
eePRINTL( "| address\t file" );
|
||||
|
||||
//Get max length of file name
|
||||
int lMax =0;
|
||||
@@ -98,9 +97,9 @@ void MemoryManager::ShowResults() {
|
||||
for( int i = 0; i < lMax - 4; ++i )
|
||||
eePRINT(" ");
|
||||
|
||||
eePRINT( "line\t\t memory usage\t \n" );
|
||||
eePRINTL( "line\t\t memory usage\t " );
|
||||
|
||||
eePRINT( "|-----------------------------------------------------------|\n" );
|
||||
eePRINTL( "|-----------------------------------------------------------|" );
|
||||
|
||||
it = mMapPointers.begin();
|
||||
|
||||
@@ -112,16 +111,16 @@ void MemoryManager::ShowResults() {
|
||||
for ( int i=0; i < lMax - (int)ap.mFile.length(); ++i )
|
||||
eePRINT(" ");
|
||||
|
||||
eePRINT( "%d\t\t %d\t\n", ap.mLine, ap.mMemory );
|
||||
eePRINTL( "%d\t\t %d\t", ap.mLine, ap.mMemory );
|
||||
}
|
||||
}
|
||||
|
||||
eePRINT( "|\n" );
|
||||
eePRINT( "| Memory left: %s\n", FileSystem::SizeToString( mTotalMemoryUsage ).c_str() );
|
||||
eePRINT( "| Biggest allocation:\n" );
|
||||
eePRINT( "| %s in file: %s at line: %d\n", FileSystem::SizeToString( mBiggestAllocation.mMemory ).c_str(), mBiggestAllocation.mFile.c_str(), mBiggestAllocation.mLine );
|
||||
eePRINT( "| Peak Memory Usage: %s\n", FileSystem::SizeToString( mPeakMemoryUsage ).c_str() );
|
||||
eePRINT( "|------------------------------------------------------------|\n\n" );
|
||||
eePRINTL( "|" );
|
||||
eePRINTL( "| Memory left: %s", FileSystem::SizeToString( mTotalMemoryUsage ).c_str() );
|
||||
eePRINTL( "| Biggest allocation:" );
|
||||
eePRINTL( "| %s in file: %s at line: %d", FileSystem::SizeToString( mBiggestAllocation.mMemory ).c_str(), mBiggestAllocation.mFile.c_str(), mBiggestAllocation.mLine );
|
||||
eePRINTL( "| Peak Memory Usage: %s", FileSystem::SizeToString( mPeakMemoryUsage ).c_str() );
|
||||
eePRINTL( "|------------------------------------------------------------|\n" );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -190,7 +190,6 @@ void String::InsertChar( String& str, const eeUint& pos, const Uint32& tchar ) {
|
||||
str.insert( str.begin() + pos, tchar );
|
||||
}
|
||||
|
||||
|
||||
void String::StrFormat( char * Buffer, int BufferSize, const char * format, ... ) {
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
@@ -213,10 +212,11 @@ std::string String::StrFormated( const char * format, ... ) {
|
||||
|
||||
n = eevsnprintf( &tstr[0], size, format, args );
|
||||
|
||||
va_end( args );
|
||||
|
||||
if ( n > -1 && n < size ) {
|
||||
tstr.resize( n );
|
||||
|
||||
va_end( args );
|
||||
|
||||
return tstr;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ std::string String::StrFormated( const char * format, ... ) {
|
||||
else // glibc 2.0
|
||||
size *= 2; // twice the old size
|
||||
|
||||
tstr.resize( size, '\0' );
|
||||
tstr.resize( size );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,19 +235,19 @@ String::String()
|
||||
|
||||
String::String(char ansiChar, const std::locale& locale)
|
||||
{
|
||||
mString += Utf32::DecodeAnsi(ansiChar, locale);
|
||||
mString += Utf32::DecodeAnsi(ansiChar, locale);
|
||||
}
|
||||
|
||||
#ifndef EE_NO_WIDECHAR
|
||||
String::String(wchar_t wideChar)
|
||||
{
|
||||
mString += Utf32::DecodeWide(wideChar);
|
||||
mString += Utf32::DecodeWide(wideChar);
|
||||
}
|
||||
#endif
|
||||
|
||||
String::String(StringBaseType utf32Char)
|
||||
{
|
||||
mString += utf32Char;
|
||||
mString += utf32Char;
|
||||
}
|
||||
|
||||
String::String( const char* uf8String ) {
|
||||
@@ -272,48 +272,48 @@ String::String( const std::string& utf8String ) {
|
||||
|
||||
String::String(const char* ansiString, const std::locale& locale)
|
||||
{
|
||||
if (ansiString)
|
||||
{
|
||||
std::size_t length = strlen(ansiString);
|
||||
if (length > 0)
|
||||
{
|
||||
mString.reserve(length + 1);
|
||||
Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale);
|
||||
}
|
||||
}
|
||||
if (ansiString)
|
||||
{
|
||||
std::size_t length = strlen(ansiString);
|
||||
if (length > 0)
|
||||
{
|
||||
mString.reserve(length + 1);
|
||||
Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String::String(const std::string& ansiString, const std::locale& locale)
|
||||
{
|
||||
mString.reserve(ansiString.length() + 1);
|
||||
Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale);
|
||||
mString.reserve(ansiString.length() + 1);
|
||||
Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale);
|
||||
}
|
||||
|
||||
#ifndef EE_NO_WIDECHAR
|
||||
String::String(const wchar_t* wideString)
|
||||
{
|
||||
if (wideString)
|
||||
{
|
||||
std::size_t length = std::wcslen(wideString);
|
||||
if (length > 0)
|
||||
{
|
||||
mString.reserve(length + 1);
|
||||
Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString));
|
||||
}
|
||||
}
|
||||
if (wideString)
|
||||
{
|
||||
std::size_t length = std::wcslen(wideString);
|
||||
if (length > 0)
|
||||
{
|
||||
mString.reserve(length + 1);
|
||||
Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String::String(const std::wstring& wideString)
|
||||
{
|
||||
mString.reserve(wideString.length() + 1);
|
||||
Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString));
|
||||
mString.reserve(wideString.length() + 1);
|
||||
Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString));
|
||||
}
|
||||
#endif
|
||||
|
||||
String::String(const StringBaseType* utf32String)
|
||||
{
|
||||
if (utf32String)
|
||||
mString = utf32String;
|
||||
if (utf32String)
|
||||
mString = utf32String;
|
||||
}
|
||||
|
||||
String::String(const StringType& utf32String) :
|
||||
@@ -339,32 +339,32 @@ String String::FromUtf8( const std::string& utf8String )
|
||||
|
||||
String::operator std::string() const
|
||||
{
|
||||
return ToAnsiString();
|
||||
return ToAnsiString();
|
||||
}
|
||||
|
||||
std::string String::ToAnsiString(const std::locale& locale) const
|
||||
{
|
||||
// Prepare the output string
|
||||
std::string output;
|
||||
output.reserve(mString.length() + 1);
|
||||
// Prepare the output string
|
||||
std::string output;
|
||||
output.reserve(mString.length() + 1);
|
||||
|
||||
// Convert
|
||||
Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale);
|
||||
// Convert
|
||||
Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale);
|
||||
|
||||
return output;
|
||||
return output;
|
||||
}
|
||||
|
||||
#ifndef EE_NO_WIDECHAR
|
||||
std::wstring String::ToWideString() const
|
||||
{
|
||||
// Prepare the output string
|
||||
// Prepare the output string
|
||||
std::wstring output;
|
||||
output.reserve(mString.length() + 1);
|
||||
output.reserve(mString.length() + 1);
|
||||
|
||||
// Convert
|
||||
Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0);
|
||||
// Convert
|
||||
Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0);
|
||||
|
||||
return output;
|
||||
return output;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -386,8 +386,8 @@ Uint32 String::GetHash() const
|
||||
|
||||
String& String::operator =(const String& right)
|
||||
{
|
||||
mString = right.mString;
|
||||
return *this;
|
||||
mString = right.mString;
|
||||
return *this;
|
||||
}
|
||||
|
||||
String& String::operator =( const StringBaseType& right )
|
||||
@@ -398,8 +398,8 @@ String& String::operator =( const StringBaseType& right )
|
||||
|
||||
String& String::operator +=(const String& right)
|
||||
{
|
||||
mString += right.mString;
|
||||
return *this;
|
||||
mString += right.mString;
|
||||
return *this;
|
||||
}
|
||||
|
||||
String& String::operator +=( const StringBaseType& right )
|
||||
@@ -411,17 +411,17 @@ String& String::operator +=( const StringBaseType& right )
|
||||
|
||||
String::StringBaseType String::operator [](std::size_t index) const
|
||||
{
|
||||
return mString[index];
|
||||
return mString[index];
|
||||
}
|
||||
|
||||
String::StringBaseType& String::operator [](std::size_t index)
|
||||
{
|
||||
return mString[index];
|
||||
return mString[index];
|
||||
}
|
||||
|
||||
String::StringBaseType String::at( std::size_t index ) const
|
||||
{
|
||||
return mString.at( index );
|
||||
return mString.at( index );
|
||||
}
|
||||
|
||||
void String::push_back( StringBaseType c )
|
||||
@@ -436,12 +436,12 @@ void String::swap ( String& str )
|
||||
|
||||
void String::clear()
|
||||
{
|
||||
mString.clear();
|
||||
mString.clear();
|
||||
}
|
||||
|
||||
std::size_t String::size() const
|
||||
{
|
||||
return mString.size();
|
||||
return mString.size();
|
||||
}
|
||||
|
||||
std::size_t String::length() const
|
||||
@@ -451,17 +451,17 @@ std::size_t String::length() const
|
||||
|
||||
bool String::empty() const
|
||||
{
|
||||
return mString.empty();
|
||||
return mString.empty();
|
||||
}
|
||||
|
||||
void String::erase(std::size_t position, std::size_t count)
|
||||
{
|
||||
mString.erase(position, count);
|
||||
mString.erase(position, count);
|
||||
}
|
||||
|
||||
String& String::insert(std::size_t position, const String& str)
|
||||
{
|
||||
mString.insert(position, str.mString);
|
||||
mString.insert(position, str.mString);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -517,22 +517,22 @@ const String::StringBaseType* String::data() const
|
||||
|
||||
String::Iterator String::begin()
|
||||
{
|
||||
return mString.begin();
|
||||
return mString.begin();
|
||||
}
|
||||
|
||||
String::ConstIterator String::begin() const
|
||||
{
|
||||
return mString.begin();
|
||||
return mString.begin();
|
||||
}
|
||||
|
||||
String::Iterator String::end()
|
||||
{
|
||||
return mString.end();
|
||||
return mString.end();
|
||||
}
|
||||
|
||||
String::ConstIterator String::end() const
|
||||
{
|
||||
return mString.end();
|
||||
return mString.end();
|
||||
}
|
||||
|
||||
String::ReverseIterator String::rbegin()
|
||||
@@ -542,17 +542,17 @@ String::ReverseIterator String::rbegin()
|
||||
|
||||
String::ConstReverseIterator String::rbegin() const
|
||||
{
|
||||
return mString.rbegin();
|
||||
return mString.rbegin();
|
||||
}
|
||||
|
||||
String::ReverseIterator String::rend()
|
||||
{
|
||||
return mString.rend();
|
||||
return mString.rend();
|
||||
}
|
||||
|
||||
String::ConstReverseIterator String::rend() const
|
||||
{
|
||||
return mString.rend();
|
||||
return mString.rend();
|
||||
}
|
||||
|
||||
void String::resize( std::size_t n, StringBaseType c )
|
||||
@@ -896,40 +896,40 @@ std::size_t String::find_last_not_of ( StringBaseType c, std::size_t pos ) const
|
||||
|
||||
bool operator ==(const String& left, const String& right)
|
||||
{
|
||||
return left.mString == right.mString;
|
||||
return left.mString == right.mString;
|
||||
}
|
||||
|
||||
bool operator !=(const String& left, const String& right)
|
||||
{
|
||||
return !(left == right);
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
bool operator <(const String& left, const String& right)
|
||||
{
|
||||
return left.mString < right.mString;
|
||||
return left.mString < right.mString;
|
||||
}
|
||||
|
||||
bool operator >(const String& left, const String& right)
|
||||
{
|
||||
return right < left;
|
||||
return right < left;
|
||||
}
|
||||
|
||||
bool operator <=(const String& left, const String& right)
|
||||
{
|
||||
return !(right < left);
|
||||
return !(right < left);
|
||||
}
|
||||
|
||||
bool operator >=(const String& left, const String& right)
|
||||
{
|
||||
return !(left < right);
|
||||
return !(left < right);
|
||||
}
|
||||
|
||||
String operator +(const String& left, const String& right)
|
||||
{
|
||||
String string = left;
|
||||
string += right;
|
||||
String string = left;
|
||||
string += right;
|
||||
|
||||
return string;
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ cMapEditor::cMapEditor( cUIWindow * AttatchTo, const MapEditorCloseCb& callback
|
||||
mMouseScrolling( false )
|
||||
{
|
||||
if ( NULL == mTheme ) {
|
||||
eePRINT( "cMapEditor needs a default theme seted to work." );
|
||||
eePRINTL( "cMapEditor needs a default theme seted to work." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ cConsole::cConsole( Window::cWindow * window ) :
|
||||
mHeightMin(0),
|
||||
mY(0.0f),
|
||||
mA(0.0f),
|
||||
mFadeSpeed(250.f),
|
||||
mFadeSpeed( Milliseconds( 250.f ) ),
|
||||
mMyCallback(0),
|
||||
mVidCb(0),
|
||||
mMaxLogLines(1024),
|
||||
@@ -57,7 +57,7 @@ cConsole::cConsole( cFont* Font, const bool& MakeDefaultCommands, const bool& At
|
||||
mHeightMin(0),
|
||||
mY(0.0f),
|
||||
mA(0.0f),
|
||||
mFadeSpeed(250.f),
|
||||
mFadeSpeed( Milliseconds( 250.f) ),
|
||||
mMyCallback(0),
|
||||
mVidCb(0),
|
||||
mMaxLogLines(1024),
|
||||
@@ -299,13 +299,13 @@ void cConsole::PushText( const char * format, ... ) {
|
||||
|
||||
n = eevsnprintf( &tstr[0], size, format, args );
|
||||
|
||||
va_end( args );
|
||||
|
||||
if ( n > -1 && n < size ) {
|
||||
tstr.resize( n );
|
||||
|
||||
PushText( tstr );
|
||||
|
||||
va_end( args );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ void cConsole::PushText( const char * format, ... ) {
|
||||
else // glibc 2.0
|
||||
size *= 2; // twice the old size
|
||||
|
||||
tstr.resize( size, '\0' );
|
||||
tstr.resize( size );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,13 +327,13 @@ void cConsole::Toggle() {
|
||||
|
||||
void cConsole::Fade() {
|
||||
if (mCurSide) {
|
||||
mCurAlpha -= 255.f * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed;
|
||||
mCurAlpha -= 255.f * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed.AsMilliseconds();
|
||||
if ( mCurAlpha <= 0.0f ) {
|
||||
mCurAlpha = 0.0f;
|
||||
mCurSide = !mCurSide;
|
||||
}
|
||||
} else {
|
||||
mCurAlpha += 255.f * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed;
|
||||
mCurAlpha += 255.f * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed.AsMilliseconds();
|
||||
if ( mCurAlpha >= 255.f ) {
|
||||
mCurAlpha = 255.f;
|
||||
mCurSide = !mCurSide;
|
||||
@@ -347,7 +347,7 @@ void cConsole::Fade() {
|
||||
|
||||
if ( mFadeIn ) {
|
||||
mFadeOut = false;
|
||||
mY += mCurHeight * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed;
|
||||
mY += mCurHeight * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed.AsMilliseconds();
|
||||
|
||||
mA = ( mY * mMaxAlpha / mCurHeight ) ;
|
||||
if ( mY > mCurHeight ) {
|
||||
@@ -359,7 +359,7 @@ void cConsole::Fade() {
|
||||
|
||||
if ( mFadeOut ) {
|
||||
mFadeIn = false;
|
||||
mY -= mCurHeight * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed;
|
||||
mY -= mCurHeight * mWindow->Elapsed().AsMilliseconds() / mFadeSpeed.AsMilliseconds();
|
||||
|
||||
mA = ( mY * mMaxAlpha / mCurHeight ) ;
|
||||
if ( mY <= 0.0f ) {
|
||||
|
||||
@@ -322,7 +322,7 @@ cImage::cImage( std::string Path, const eeUint& forceChannels ) :
|
||||
reason = ", reason: " + std::string( stbi_failure_reason() );
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "Failed to load image " + Path + reason );
|
||||
eePRINTL( "Failed to load image %s. Reason: %s", Path.c_str(), reason.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,10 +364,10 @@ void cImage::LoadFromPack( cPack * Pack, const std::string& FilePackPath ) {
|
||||
|
||||
mLoadedFromStbi = true;
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to load image " + FilePackPath + ", reason: " + std::string( stbi_failure_reason() ) );
|
||||
eePRINTL( "Failed to load image %s. Reason: %s", stbi_failure_reason(), FilePackPath.c_str() );
|
||||
}
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to load image " + FilePackPath + " from pack." );
|
||||
eePRINTL( "Failed to load image %s from pack.", FilePackPath.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ cShader::cShader( const Uint32& Type, const std::string& Filename ) {
|
||||
|
||||
SetSource( reinterpret_cast<char*> ( PData.Data ), PData.DataSize );
|
||||
} else {
|
||||
cLog::instance()->Write( std::string( "Couldn't open shader object: " ) + Filename );
|
||||
eePRINTL( "Couldn't open shader object: %s", Filename.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ std::string cShader::GetName() {
|
||||
void cShader::EnsureVersion() {
|
||||
#ifdef EE_GL3_ENABLED
|
||||
if ( cShader::Ensure() && ( GLi->Version() == GLv_3 || GLi->Version() == GLv_ES2 ) ) {
|
||||
cLog::instance()->Write( "Shader " + GetName() + " converted to programmable pipeline automatically." );
|
||||
eePRINTL( "Shader %s converted to programmable pipeline automatically.", GetName().c_str() );
|
||||
|
||||
if ( GL_VERTEX_SHADER == mType ) {
|
||||
if ( mSource.find( "ftransform" ) != std::string::npos || mSource.find("dgl_Vertex") == std::string::npos ) {
|
||||
@@ -141,15 +141,13 @@ void cShader::EnsureVersion() {
|
||||
String::ReplaceSubStr( mSource, "gl_TexCoord" , "dgl_TexCoord" );
|
||||
}
|
||||
}
|
||||
|
||||
/// cLog::instance()->Write( "Shader " + GetName() + " converted looks like: \n" + mSource + "\n" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cShader::SetSource( const std::string& Source ) {
|
||||
if ( IsCompiled() ) {
|
||||
cLog::instance()->Write( "Shader " + GetName() + " report: can't set source for compiled shaders" );
|
||||
eePRINTL( "Shader %s report: can't set source for compiled shaders", GetName().c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,7 +190,7 @@ void cShader::SetSource( const std::vector<Uint8>& Source ) {
|
||||
|
||||
bool cShader::Compile() {
|
||||
if ( IsCompiled() ) {
|
||||
cLog::instance()->Write( "Shader " + GetName() + " report: can't compile a shader twice" );
|
||||
eePRINTL( "Shader %s report: can't compile a shader twice", GetName().c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -215,11 +213,11 @@ bool cShader::Compile() {
|
||||
glGetShaderInfoLog( GetId(), logarraysize, &logsize, reinterpret_cast<GLchar*>( &mCompileLog[0] ) );
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "Couldn't compile shader " + GetName() + ". Log follows:\n" );
|
||||
cLog::instance()->Write( mCompileLog );
|
||||
cLog::instance()->Write( mSource );
|
||||
eePRINTL( "Couldn't compile shader %s. Log follows:\n", GetName().c_str() );
|
||||
eePRINTL( mCompileLog.c_str() );
|
||||
eePRINTL( mSource.c_str() );
|
||||
} else {
|
||||
cLog::instance()->Write( "Shader " + GetName() + " compiled succesfully" );
|
||||
eePRINTL( "Shader %s compiled succesfully", GetName().c_str() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -176,7 +176,7 @@ void cShaderProgram::Init() {
|
||||
mUniformLocations.clear();
|
||||
mAttributeLocations.clear();
|
||||
} else {
|
||||
cLog::instance()->Write( "cShaderProgram::Init() " + mName + ": Couldn't create program." );
|
||||
eePRINTL( "cShaderProgram::Init() %s: Couldn't create program.", mName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ void cShaderProgram::Reload() {
|
||||
|
||||
void cShaderProgram::AddShader( cShader* Shader ) {
|
||||
if ( !Shader->IsValid() ) {
|
||||
cLog::instance()->Write( "cShaderProgram::AddShader() " + mName + ": Cannot add invalid shader" );
|
||||
eePRINTL( "cShaderProgram::AddShader() %s: Cannot add invalid shader", mName.c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -242,10 +242,10 @@ bool cShaderProgram::Link() {
|
||||
#endif
|
||||
|
||||
if ( !mValid ) {
|
||||
cLog::instance()->Write( "cShaderProgram::Link() " + mName + ": Couldn't link program. Log follows:\n" + mLinkLog );
|
||||
eePRINTL( "cShaderProgram::Link(): %s: Couldn't link program. Log follows:\n", mName.c_str(), mLinkLog.c_str() );
|
||||
} else {
|
||||
if ( mLinkLog.size() > 1 ) {
|
||||
cLog::instance()->Write( "cShaderProgram::Link() " + mName + ": Program linked, but recibed some log:\n" + mLinkLog );
|
||||
eePRINTL( "cShaderProgram::Link() %s: Program linked, but received some log:\n", mName.c_str(), mLinkLog.c_str() );
|
||||
}
|
||||
|
||||
mUniformLocations.clear();
|
||||
|
||||
@@ -387,9 +387,7 @@ bool cSprite::AddFramesByPatternId( const Uint32& SubTextureId, const std::strin
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef EE_DEBUG
|
||||
cLog::instance()->Write( "cSprite::AddFramesByPatternId: Couldn't find any pattern with Id: " + String::ToStr( SubTextureId ) );
|
||||
#endif
|
||||
eePRINTL( "cSprite::AddFramesByPatternId: Couldn't find any pattern with Id: %d", SubTextureId );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -403,9 +401,7 @@ bool cSprite::AddFramesByPattern( const std::string& name, const std::string& ex
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef EE_DEBUG
|
||||
cLog::instance()->Write( "cSprite::AddFramesByPattern: Couldn't find any pattern with: " + name );
|
||||
#endif
|
||||
eePRINTL( "cSprite::AddFramesByPattern: Couldn't find any pattern with: %s", name.c_str() );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ void cTextureAtlasLoader::CreateSubTextures() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cLog::instance()->Write( "cTextureAtlasLoader::CreateSubTextures: Failed to find texture atlas texture, it seems that is not loaded for some reason. Couldn't find: " + path );
|
||||
eePRINTL( "cTextureAtlasLoader::CreateSubTextures: Failed to find texture atlas texture, it seems that is not loaded for some reason. Couldn't find: %s", path.c_str() );
|
||||
|
||||
eeASSERT( NULL != tTex );
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ void cTextureFactory::UnloadTextures() {
|
||||
|
||||
mTextures.clear();
|
||||
|
||||
cLog::instance()->Write( "Textures Unloaded." );
|
||||
eePRINTL( "Textures Unloaded." );
|
||||
}
|
||||
|
||||
bool cTextureFactory::Remove( Uint32 TexId ) {
|
||||
@@ -186,7 +186,7 @@ void cTextureFactory::ReloadAllTextures() {
|
||||
Tex->Reload();
|
||||
}
|
||||
|
||||
cLog::instance()->Write("Textures Reloaded.");
|
||||
eePRINTL("Textures Reloaded.");
|
||||
}
|
||||
|
||||
void cTextureFactory::GrabTextures() {
|
||||
|
||||
@@ -45,12 +45,12 @@ bool cTextureFont::Load( const Uint32& TexId, const eeUint& StartChar, const eeU
|
||||
|
||||
BuildFont();
|
||||
|
||||
cLog::instance()->Write( "Texture Font " + Tex->Filepath() + " loaded." );
|
||||
eePRINTL( "Texture Font %s loaded.", Tex->Filepath().c_str() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "Failed to load Texture Font: unknown texture." );
|
||||
eePRINTL( "Failed to Load Texture Font: Unknown Texture." );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -284,13 +284,13 @@ void cTextureLoader::LoadFromPath() {
|
||||
}
|
||||
|
||||
if ( NULL == mPixels ) {
|
||||
cLog::instance()->Write( "Filed to load: " + mFilepath + " Reason: " + std::string( stbi_failure_reason() ) );
|
||||
eePRINTL( "Filed to load: %s. Reason: ", mFilepath.c_str(), stbi_failure_reason() );
|
||||
|
||||
if ( STBI_jpeg == mImgType ) {
|
||||
mPixels = jpgd::decompress_jpeg_image_from_file( mFilepath.c_str(), &mImgWidth, &mImgHeight, &mChannels, 3 );
|
||||
|
||||
if ( NULL != mPixels ) {
|
||||
cLog::instance()->Write( "Loaded: " + mFilepath + " using jpeg-compressor." );
|
||||
eePRINTL( "Loaded: %s using jpeg-compressor.", mFilepath.c_str() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -341,13 +341,13 @@ void cTextureLoader::LoadFromMemory() {
|
||||
}
|
||||
|
||||
if ( NULL == mPixels ) {
|
||||
cLog::instance()->Write( stbi_failure_reason() );
|
||||
eePRINTL( stbi_failure_reason() );
|
||||
|
||||
if ( STBI_jpeg == mImgType ) {
|
||||
mPixels = jpgd::decompress_jpeg_image_from_memory( mImagePtr, mSize, &mImgWidth, &mImgHeight, &mChannels, 3 );
|
||||
|
||||
if ( NULL != mPixels ) {
|
||||
cLog::instance()->Write( "Loaded: image using jpeg-compressor." );
|
||||
eePRINTL( "Loaded: image using jpeg-compressor." );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ void cTextureLoader::LoadFromStream() {
|
||||
}
|
||||
|
||||
if ( NULL == mPixels ) {
|
||||
cLog::instance()->Write( stbi_failure_reason() );
|
||||
eePRINTL( stbi_failure_reason() );
|
||||
|
||||
if ( STBI_jpeg == mImgType ) {
|
||||
jpeg::jpeg_decoder_stream_steam stream( mStream );
|
||||
@@ -483,9 +483,9 @@ void cTextureLoader::LoadFromPixels() {
|
||||
|
||||
mTexId = cTextureFactory::instance()->PushTexture( mFilepath, tTexId, width, height, mImgWidth, mImgHeight, mMipmap, mChannels, mClampMode, mCompressTexture || mIsCompressed, mLocalCopy, mSize );
|
||||
|
||||
cLog::instance()->Write( "Texture " + mFilepath + " loaded in " + String::ToStr( mTE.Elapsed().AsMilliseconds() ) + " ms." );
|
||||
eePRINTL( "Texture %s loaded in %4.3f ms.", mFilepath.c_str(), mTE.Elapsed().AsMilliseconds() );
|
||||
} else {
|
||||
cLog::instance()->Write( "Failed to create texture. Reason: " + std::string( SOIL_last_result() ) );
|
||||
eePRINTL( "Failed to create texture. Reason: ", SOIL_last_result() );
|
||||
}
|
||||
|
||||
if ( TEX_LT_PIXELS != mLoadType ) {
|
||||
@@ -499,13 +499,13 @@ void cTextureLoader::LoadFromPixels() {
|
||||
mPixels = NULL;
|
||||
} else {
|
||||
if ( NULL != stbi_failure_reason() ) {
|
||||
cLog::instance()->Write( stbi_failure_reason() );
|
||||
eePRINTL( stbi_failure_reason() );
|
||||
} else {
|
||||
std::string failText( "Texture " + mFilepath + " failed to load" );
|
||||
|
||||
failText += ( NULL != mPack ) ? ( " from Pack " + mPack->GetPackPath() + "." ) : ".";
|
||||
|
||||
cLog::instance()->Write( failText );
|
||||
eePRINTL( failText.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -470,10 +470,10 @@ Int32 cTexturePacker::PackTextures() { // pack the textures, the return code is
|
||||
if ( NULL == bestFit ) {
|
||||
if ( PackBig == mStrategy ) {
|
||||
mStrategy = PackTiny;
|
||||
eePRINT( "Chaging Strategy to Tiny. %s faults.\n", t->Name().c_str() );
|
||||
eePRINTL( "Chaging Strategy to Tiny. %s faults.", t->Name().c_str() );
|
||||
} else if ( PackTiny == mStrategy ) {
|
||||
mStrategy = PackFail;
|
||||
eePRINT( "Strategy fail, must create a new image. %s faults.\n", t->Name().c_str() );
|
||||
eePRINTL( "Strategy fail, must create a new image. %s faults.", t->Name().c_str() );
|
||||
}
|
||||
} else {
|
||||
InsertTexture( t, bestFit, edgeCount, previousBestFit );
|
||||
@@ -481,14 +481,14 @@ Int32 cTexturePacker::PackTextures() { // pack the textures, the return code is
|
||||
}
|
||||
|
||||
if ( PackFail == mStrategy ) {
|
||||
eePRINT( "Creating a new image as a child.\n" );
|
||||
eePRINTL( "Creating a new image as a child." );
|
||||
CreateChild();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mCount > 0 ) {
|
||||
eePRINT( "Creating a new image as a child. Some textures couldn't get it: %d\n", mCount );
|
||||
eePRINTL( "Creating a new image as a child. Some textures couldn't get it: %d", mCount );
|
||||
CreateChild();
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ Int32 cTexturePacker::PackTextures() { // pack the textures, the return code is
|
||||
mTotalArea -= (*it)->Area();
|
||||
}
|
||||
|
||||
eePRINT( "Total Area Used: %d. This represents the %4.2f percent \n", mTotalArea, ( (eeDouble)mTotalArea / (eeDouble)( mWidth * mHeight ) ) * 100.0 );
|
||||
eePRINTL( "Total Area Used: %d. This represents the %4.3f percent", mTotalArea, ( (eeDouble)mTotalArea / (eeDouble)( mWidth * mHeight ) ) * 100.0 );
|
||||
|
||||
return ( mWidth * mHeight ) - mTotalArea;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const Uint16&
|
||||
Uint32 OutTotal = ( OutlineFreetype == OutlineMethod ) ? 0 : OutlineSize * 2;
|
||||
|
||||
if ( mFont == NULL ) {
|
||||
cLog::instance()->Write( "Failed to load TTF Font " + mFilepath + "." );
|
||||
eePRINTL( "Failed to load TTF Font %s.", mFilepath.c_str() );
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ void cTTFFont::UpdateLoading() {
|
||||
|
||||
RebuildFromGlyphs();
|
||||
|
||||
cLog::instance()->Write( "TTF Font " + mFilepath + " loaded." );
|
||||
eePRINTL( "TTF Font %s loaded.", mFilepath.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ bool cTTFFont::SaveCoordinates( const std::string& Filepath ) {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
cLog::instance()->Write("Unable to write " + Filepath + " on cTTFFont::SaveCoordinates");
|
||||
eePRINTL("cTTFFont::SaveCoordinates(): Unable to write file: %s.", Filepath.c_str() );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -178,7 +178,7 @@ void cInterpolation::Update( const cTime& Elapsed ) {
|
||||
}
|
||||
}
|
||||
|
||||
void cInterpolation::SetTotalTime( const eeFloat TotTime ) {
|
||||
void cInterpolation::SetTotalTime( const cTime & TotTime ) {
|
||||
eeFloat tdist = mTotDist;
|
||||
|
||||
if ( tdist == 0.0f ) {
|
||||
@@ -188,12 +188,12 @@ void cInterpolation::SetTotalTime( const eeFloat TotTime ) {
|
||||
|
||||
if ( mLoop ) {
|
||||
tdist += eeabs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p );
|
||||
mPoints[ mPoints.size() - 1 ].t = eeabs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p ) * TotTime / tdist;
|
||||
mPoints[ mPoints.size() - 1 ].t = eeabs( mPoints[ mPoints.size() - 1 ].p - mPoints[0].p ) * TotTime.AsMilliseconds() / tdist;
|
||||
}
|
||||
|
||||
for ( eeUint i = 0; i < mPoints.size() - 1; i++) {
|
||||
eeFloat CurDist = eeabs( mPoints[i].p - mPoints[i + 1].p );
|
||||
mPoints[i].t = CurDist * TotTime / tdist;
|
||||
mPoints[i].t = CurDist * TotTime.AsMilliseconds() / tdist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ void cWaypoints::Update( const cTime& Elapsed ) {
|
||||
}
|
||||
}
|
||||
|
||||
void cWaypoints::SetTotalTime( const eeDouble& TotTime ) {
|
||||
void cWaypoints::SetTotalTime( const cTime& TotTime ) {
|
||||
eeUint i;
|
||||
eeFloat tdist = mTotDist;
|
||||
|
||||
@@ -209,11 +209,11 @@ void cWaypoints::SetTotalTime( const eeDouble& TotTime ) {
|
||||
|
||||
if ( mLoop ) {
|
||||
tdist += mPoints[ mPoints.size() - 1 ].p.Distance( mPoints[0].p );
|
||||
mPoints[ mPoints.size() - 1 ].t = mPoints[ mPoints.size() - 1 ].p.Distance( mPoints[0].p ) * TotTime / tdist;
|
||||
mPoints[ mPoints.size() - 1 ].t = mPoints[ mPoints.size() - 1 ].p.Distance( mPoints[0].p ) * TotTime.AsMilliseconds() / tdist;
|
||||
}
|
||||
|
||||
for (i = 0; i < mPoints.size() - 1; i++)
|
||||
mPoints[i].t = mPoints[i].p.Distance( mPoints[i + 1].p ) * TotTime / tdist;
|
||||
mPoints[i].t = mPoints[i].p.Distance( mPoints[i + 1].p ) * TotTime.AsMilliseconds() / tdist;
|
||||
}
|
||||
|
||||
void cWaypoints::Type( Ease::Interpolation InterpolationType ) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
|
||||
namespace {
|
||||
// Convert a string to lower case
|
||||
@@ -11,6 +12,11 @@ namespace {
|
||||
*i = static_cast<char>(std::tolower(*i));
|
||||
return str;
|
||||
}
|
||||
|
||||
template<class InputIterator, class Size, class OutputIterator> OutputIterator copy_n(InputIterator in, Size n, OutputIterator out) {
|
||||
for (Size i = 0; i < n; *out = *in, i++, ++out, ++in);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
namespace EE { namespace Network {
|
||||
@@ -54,9 +60,11 @@ std::string cHttp::Request::Prepare() const {
|
||||
std::string method;
|
||||
switch (mMethod) {
|
||||
default :
|
||||
case Get : method = "GET"; break;
|
||||
case Post : method = "POST"; break;
|
||||
case Head : method = "HEAD"; break;
|
||||
case Get: method = "GET"; break;
|
||||
case Post: method = "POST"; break;
|
||||
case Head: method = "HEAD"; break;
|
||||
case Put: method = "PUT"; break;
|
||||
case Delete: method = "DELETE"; break;
|
||||
}
|
||||
|
||||
// Write the first line containing the request type
|
||||
@@ -169,7 +177,45 @@ void cHttp::Response::Parse(const std::string& data) {
|
||||
|
||||
// Finally extract the body
|
||||
mBody.clear();
|
||||
std::copy(std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>(), std::back_inserter(mBody));
|
||||
|
||||
// Determine whether the transfer is chunked
|
||||
if (toLower(GetField("transfer-encoding")).compare("chunked")) {
|
||||
// Not chunked - everything at once
|
||||
std::copy(std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>(), std::back_inserter(mBody));
|
||||
} else {
|
||||
// Chunked - have to read chunk by chunk
|
||||
unsigned long length;
|
||||
|
||||
// Read all chunks, identified by a chunk-size not being 0
|
||||
while (in >> std::hex >> length) {
|
||||
// Drop the rest of the line (chunk-extension)
|
||||
in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
|
||||
// Copy the actual content data
|
||||
::copy_n(std::istreambuf_iterator<char>(in), length, std::back_inserter(mBody));
|
||||
}
|
||||
|
||||
// Drop the rest of the line (chunk-extension)
|
||||
in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
|
||||
// Read all trailers (if present)
|
||||
while (std::getline(in, line) && (line.size() > 2)) {
|
||||
std::string::size_type pos = line.find(": ");
|
||||
|
||||
if (pos != std::string::npos) {
|
||||
// Extract the field name and its value
|
||||
std::string field = line.substr(0, pos);
|
||||
std::string value = line.substr(pos + 2);
|
||||
|
||||
// Remove any trailing \r
|
||||
if (!value.empty() && (*value.rbegin() == '\r'))
|
||||
value.erase(value.size() - 1);
|
||||
|
||||
// Add the field
|
||||
mFields[toLower(field)] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cHttp::cHttp() :
|
||||
@@ -190,7 +236,7 @@ void cHttp::SetHost(const std::string& host, unsigned short port) {
|
||||
mPort = (port != 0 ? port : 80);
|
||||
} else if (toLower(host.substr(0, 8)) == "https://") {
|
||||
// HTTPS protocol -- unsupported (requires encryption and certificates and stuff...)
|
||||
//err() << "HTTPS protocol is not supported by cHttp" << std::endl;
|
||||
eePRINTL( "HTTPS protocol is not supported by cHttp" );
|
||||
mHostName = "";
|
||||
mPort = 0;
|
||||
} else {
|
||||
|
||||
@@ -54,14 +54,13 @@ void cSocket::Create(SocketHandle handle) {
|
||||
int yes = 1;
|
||||
|
||||
if (setsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&yes), sizeof(yes)) == -1) {
|
||||
/*err() << "Failed to set socket option \"TCP_NODELAY\" ; "
|
||||
<< "all your TCP packets will be buffered" << std::endl;*/
|
||||
eePRINTL( "Failed to set socket option \"TCP_NODELAY\" ; all your TCP packets will be buffered" );
|
||||
}
|
||||
|
||||
// On Mac OS X, disable the SIGPIPE signal on disconnection
|
||||
#if EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
if (setsockopt(mSocket, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char*>(&yes), sizeof(yes)) == -1) {
|
||||
//err() << "Failed to set socket option \"SO_NOSIGPIPE\"" << std::endl;
|
||||
eePRINTL( "Failed to set socket option \"SO_NOSIGPIPE\"" );
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
@@ -69,7 +68,7 @@ void cSocket::Create(SocketHandle handle) {
|
||||
int yes = 1;
|
||||
|
||||
if (setsockopt(mSocket, SOL_SOCKET, SO_BROADCAST, reinterpret_cast<char*>(&yes), sizeof(yes)) == -1) {
|
||||
//err() << "Failed to enable broadcast on UDP socket" << std::endl;
|
||||
eePRINTL( "Failed to enable broadcast on UDP socket" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ cSocket::Status cTcpListener::Listen(unsigned short port) {
|
||||
sockaddr_in address = Private::cSocketImpl::CreateAddress(INADDR_ANY, port);
|
||||
if (bind(GetHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) == -1) {
|
||||
// Not likely to happen, but...
|
||||
//err() << "Failed to bind listener socket to port " << port << std::endl;
|
||||
eePRINTL( "Failed to bind listener socket to port %d", port );
|
||||
return Error;
|
||||
}
|
||||
|
||||
// Listen to the bound port
|
||||
if (::listen(GetHandle(), 0) == -1) {
|
||||
// Oops, socket is deaf
|
||||
//err() << "Failed to Listen to port " << port << std::endl;
|
||||
eePRINTL( "Failed to Listen to port %d", port );
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void cTcpListener::Close() {
|
||||
cSocket::Status cTcpListener::Accept(cTcpSocket& socket) {
|
||||
// Make sure that we're listening
|
||||
if (GetHandle() == Private::cSocketImpl::InvalidSocket()) {
|
||||
//err() << "Failed to accept a new connection, the socket is not listening" << std::endl;
|
||||
eePRINTL( "Failed to accept a new connection, the socket is not listening" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ void cTcpSocket::Disconnect() {
|
||||
cSocket::Status cTcpSocket::Send(const void* data, std::size_t size) {
|
||||
// Check the parameters
|
||||
if (!data || (size == 0)) {
|
||||
//err() << "Cannot send data over the network (no data to send)" << std::endl;
|
||||
eePRINTL( "Cannot send data over the network (no data to send)" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ cSocket::Status cTcpSocket::Receive(void* data, std::size_t size, std::size_t& r
|
||||
|
||||
// Check the destination buffer
|
||||
if (!data) {
|
||||
//err() << "Cannot receive data from the network (the destination buffer is invalid)" << std::endl;
|
||||
eePRINTL( "Cannot receive data from the network (the destination buffer is invalid)" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ cSocket::Status cUdpSocket::Bind(unsigned short port) {
|
||||
// Bind the socket
|
||||
sockaddr_in address = Private::cSocketImpl::CreateAddress(INADDR_ANY, port);
|
||||
if (::bind(GetHandle(), reinterpret_cast<sockaddr*>(&address), sizeof(address)) == -1) {
|
||||
//err() << "Failed to bind socket to port " << port << std::endl;
|
||||
eePRINTL( "Failed to bind socket to port %d", port );
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ cSocket::Status cUdpSocket::Send(const void* data, std::size_t size, const cIpAd
|
||||
// Make sure that all the data will fit in one datagram
|
||||
if (size > MaxDatagramSize)
|
||||
{
|
||||
/*err() << "Cannot send data over the network "
|
||||
<< "(the number of bytes to send is greater than cUdpSocket::MaxDatagramSize)" << std::endl;*/
|
||||
eePRINTL( "Cannot send data over the network (the number of bytes to send is greater than cUdpSocket::MaxDatagramSize)" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
@@ -78,7 +77,7 @@ cSocket::Status cUdpSocket::Receive(void* data, std::size_t size, std::size_t& r
|
||||
|
||||
// Check the destination buffer
|
||||
if (!data) {
|
||||
//err() << "Cannot receive data from the network (the destination buffer is invalid)" << std::endl;
|
||||
eePRINTL( "Cannot receive data from the network (the destination buffer is invalid)" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ bool cIniFile::ReadFile() {
|
||||
// Check that the user hasn't openned a binary file by checking the first
|
||||
// character of each line!
|
||||
if ( !isprint ( line[0] ) ) {
|
||||
eePRINT ( "Failing on char %d\n", line[0] );
|
||||
eePRINT ( "cIniFile::ReadFile(): Failing on char %d\n", line[0] );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void cLog::OpenFS() {
|
||||
}
|
||||
|
||||
if ( NULL == mFS ) {
|
||||
std::string str = mFilePath + "log.log";
|
||||
std::string str = mFilePath + "log.log";
|
||||
|
||||
mFS = eeNew( cIOStreamFile, ( str, std::ios::app | std::ios::out | std::ios::binary ) );
|
||||
}
|
||||
@@ -127,13 +127,15 @@ void cLog::Writef( const char* format, ... ) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( mLiveWrite ) {
|
||||
if ( mLiveWrite ) {
|
||||
OpenFS();
|
||||
|
||||
mFS->Write( tstr.c_str(), tstr.size() );
|
||||
|
||||
mFS->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
va_end( args );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -355,6 +355,10 @@ void Sys::Sleep( const Uint32& ms ) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void Sys::Sleep( const cTime& time ) {
|
||||
Sleep( (Uint32)time.AsMilliseconds() );
|
||||
}
|
||||
|
||||
static std::string sGetProcessPath() {
|
||||
#if EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
char exe_file[PATH_MAX + 1];
|
||||
|
||||
@@ -48,23 +48,23 @@ void cUIComplexControl::Update() {
|
||||
Pos.y = cUIManager::instance()->GetMousePos().y - mTooltip->Size().Height();
|
||||
}
|
||||
|
||||
if ( 0 == cUIThemeManager::instance()->TooltipTimeToShow() ) {
|
||||
if ( cTime::Zero == cUIThemeManager::instance()->TooltipTimeToShow() ) {
|
||||
if ( !mTooltip->Visible() || cUIThemeManager::instance()->TooltipFollowMouse() )
|
||||
mTooltip->Pos( Pos );
|
||||
|
||||
mTooltip->Show();
|
||||
} else {
|
||||
if ( -1.f != mTooltip->TooltipTime() ) {
|
||||
mTooltip->TooltipTimeAdd( cUIManager::instance()->Elapsed().AsMilliseconds() );
|
||||
if ( -1.f != mTooltip->TooltipTime().AsMilliseconds() ) {
|
||||
mTooltip->TooltipTimeAdd( cUIManager::instance()->Elapsed() );
|
||||
}
|
||||
|
||||
if ( mTooltip->TooltipTime() >= cUIThemeManager::instance()->TooltipTimeToShow() ) {
|
||||
if ( mTooltip->TooltipTime() != -1.f ) {
|
||||
if ( mTooltip->TooltipTime().AsMilliseconds() != -1.f ) {
|
||||
mTooltip->Pos( Pos );
|
||||
|
||||
mTooltip->Show();
|
||||
|
||||
mTooltip->TooltipTime( -1.f );
|
||||
mTooltip->TooltipTime( Milliseconds( -1.f ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void cUIComplexControl::Update() {
|
||||
mTooltip->Pos( Pos );
|
||||
}
|
||||
} else {
|
||||
mTooltip->TooltipTime( 0.f );
|
||||
mTooltip->TooltipTime( Milliseconds( 0.f ) );
|
||||
|
||||
if ( mTooltip->Visible() )
|
||||
mTooltip->Hide();
|
||||
|
||||
@@ -181,7 +181,7 @@ bool cUIControlAnim::Animating() {
|
||||
return ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) || ( NULL != mAngleAnim && mAngleAnim->Enabled() ) || ( NULL != mScaleAnim && mScaleAnim->Enabled() ) || ( NULL != mMoveAnim && mMoveAnim->Enabled() );
|
||||
}
|
||||
|
||||
void cUIControlAnim::StartAlphaAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
void cUIControlAnim::StartAlphaAnim( const eeFloat& From, const eeFloat& To, const cTime& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
if ( NULL == mAlphaAnim )
|
||||
mAlphaAnim = eeNew( cInterpolation, () );
|
||||
|
||||
@@ -190,6 +190,7 @@ void cUIControlAnim::StartAlphaAnim( const eeFloat& From, const eeFloat& To, con
|
||||
mAlphaAnim->AddWaypoint( To );
|
||||
mAlphaAnim->SetTotalTime( TotalTime );
|
||||
mAlphaAnim->Start( PathEndCallback );
|
||||
mAlphaAnim->Type( Type );
|
||||
|
||||
Alpha( From );
|
||||
|
||||
@@ -209,7 +210,7 @@ void cUIControlAnim::StartAlphaAnim( const eeFloat& From, const eeFloat& To, con
|
||||
}
|
||||
}
|
||||
|
||||
void cUIControlAnim::StartScaleAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
void cUIControlAnim::StartScaleAnim( const eeFloat& From, const eeFloat& To, const cTime& TotalTime, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
if ( NULL == mScaleAnim )
|
||||
mScaleAnim = eeNew( cInterpolation, () );
|
||||
|
||||
@@ -223,7 +224,7 @@ void cUIControlAnim::StartScaleAnim( const eeFloat& From, const eeFloat& To, con
|
||||
Scale( From );
|
||||
}
|
||||
|
||||
void cUIControlAnim::StartMovement( const eeVector2i& From, const eeVector2i& To, const eeFloat& TotalTime, const Ease::Interpolation& Type, cWaypoints::OnPathEndCallback PathEndCallback ) {
|
||||
void cUIControlAnim::StartMovement( const eeVector2i& From, const eeVector2i& To, const cTime& TotalTime, const Ease::Interpolation& Type, cWaypoints::OnPathEndCallback PathEndCallback ) {
|
||||
if ( NULL == mMoveAnim )
|
||||
mMoveAnim = eeNew( cWaypoints, () );
|
||||
|
||||
@@ -237,7 +238,7 @@ void cUIControlAnim::StartMovement( const eeVector2i& From, const eeVector2i& To
|
||||
Pos( From );
|
||||
}
|
||||
|
||||
void cUIControlAnim::StartRotation( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
void cUIControlAnim::StartRotation( const eeFloat& From, const eeFloat& To, const cTime& TotalTime, const Ease::Interpolation& Type, cInterpolation::OnPathEndCallback PathEndCallback ) {
|
||||
if ( NULL == mAngleAnim )
|
||||
mAngleAnim = eeNew( cInterpolation, () );
|
||||
|
||||
@@ -251,20 +252,20 @@ void cUIControlAnim::StartRotation( const eeFloat& From, const eeFloat& To, cons
|
||||
Angle( From );
|
||||
}
|
||||
|
||||
void cUIControlAnim::CreateFadeIn( const eeFloat& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
void cUIControlAnim::CreateFadeIn( const cTime& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
StartAlphaAnim( mAlpha, 255.f, Time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
void cUIControlAnim::CreateFadeOut( const eeFloat& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
void cUIControlAnim::CreateFadeOut( const cTime& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
StartAlphaAnim( 255.f, mAlpha, Time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
void cUIControlAnim::CloseFadeOut( const eeFloat& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
void cUIControlAnim::CloseFadeOut( const cTime& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
StartAlphaAnim ( mAlpha, 0.f, Time, AlphaChilds, Type );
|
||||
mControlFlags |= UI_CTRL_FLAG_CLOSE_FO;
|
||||
}
|
||||
|
||||
void cUIControlAnim::DisableFadeOut( const eeFloat& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
void cUIControlAnim::DisableFadeOut( const cTime& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
Enabled( false );
|
||||
|
||||
StartAlphaAnim ( mAlpha, 0.f, Time, AlphaChilds, Type );
|
||||
|
||||
@@ -21,7 +21,7 @@ cUITextBox::cUITextBox( const cUITextBox::CreateParams& Params ) :
|
||||
if ( NULL != cUIThemeManager::instance()->DefaultFont() )
|
||||
mTextCache->Font( cUIThemeManager::instance()->DefaultFont() );
|
||||
else
|
||||
eePRINT( "cUITextBox::cUITextBox : Created a UI TextBox without a defined font.\n" );
|
||||
eePRINTL( "cUITextBox::cUITextBox : Created a UI TextBox without a defined font." );
|
||||
}
|
||||
|
||||
AutoAlign();
|
||||
|
||||
@@ -169,7 +169,7 @@ cUITheme * cUITheme::LoadFromTextureAtlas( cUITheme * tTheme, cTextureAtlas * Te
|
||||
tTheme->Add( eeNew( cUISkinSimple, ( ElemFound[i] ) ) );
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "UI Theme Loaded in: " + String::ToStr( TE.Elapsed().AsMilliseconds() ) + " ( from TextureAtlas )" );
|
||||
eePRINTL( "UI Theme Loaded in: %4.3f ms ( from TextureAtlas )", TE.Elapsed().AsMilliseconds() );
|
||||
|
||||
return tTheme;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ cUITheme * cUITheme::LoadFromPath( cUITheme * tTheme, const std::string& Path, c
|
||||
tTheme->Add( eeNew( cUISkinSimple, ( ElemFound[i] ) ) );
|
||||
}
|
||||
|
||||
cLog::instance()->Write( "UI Theme Loaded in: " + String::ToStr( TE.Elapsed().AsMilliseconds() ) + " ( from path )" );
|
||||
eePRINTL( "UI Theme Loaded in: %4.3f ms ( from path )", TE.Elapsed().AsMilliseconds() );
|
||||
|
||||
return tTheme;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ cUIThemeManager::cUIThemeManager() :
|
||||
mThemeDefault( NULL ),
|
||||
mAutoApplyDefaultTheme( true ),
|
||||
mEnableDefaultEffects( false ),
|
||||
mFadeInTime( 100.f ),
|
||||
mFadeOutTime( 100.f ),
|
||||
mTooltipTimeToShow( 200 ),
|
||||
mFadeInTime( Milliseconds( 100.f ) ),
|
||||
mFadeOutTime( Milliseconds ( 100.f ) ),
|
||||
mTooltipTimeToShow( Milliseconds( 200 ) ),
|
||||
mTooltipFollowMouse( true ),
|
||||
mCursorSize( 16, 16 )
|
||||
{
|
||||
@@ -77,27 +77,27 @@ const bool& cUIThemeManager::DefaultEffectsEnabled() const {
|
||||
return mEnableDefaultEffects;
|
||||
}
|
||||
|
||||
const eeFloat& cUIThemeManager::ControlsFadeInTime() const {
|
||||
const cTime& cUIThemeManager::ControlsFadeInTime() const {
|
||||
return mFadeInTime;
|
||||
}
|
||||
|
||||
void cUIThemeManager::ControlsFadeInTime( const eeFloat& Time ) {
|
||||
void cUIThemeManager::ControlsFadeInTime( const cTime& Time ) {
|
||||
mFadeInTime = Time;
|
||||
}
|
||||
|
||||
const eeFloat& cUIThemeManager::ControlsFadeOutTime() const {
|
||||
const cTime& cUIThemeManager::ControlsFadeOutTime() const {
|
||||
return mFadeOutTime;
|
||||
}
|
||||
|
||||
void cUIThemeManager::ControlsFadeOutTime( const eeFloat& Time ) {
|
||||
void cUIThemeManager::ControlsFadeOutTime( const cTime& Time ) {
|
||||
mFadeOutTime = Time;
|
||||
}
|
||||
|
||||
void cUIThemeManager::TooltipTimeToShow( const Uint32& Time ) {
|
||||
void cUIThemeManager::TooltipTimeToShow( const cTime& Time ) {
|
||||
mTooltipTimeToShow = Time;
|
||||
}
|
||||
|
||||
const Uint32& cUIThemeManager::TooltipTimeToShow() const {
|
||||
const cTime& cUIThemeManager::TooltipTimeToShow() const {
|
||||
return mTooltipTimeToShow;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ cUITooltip::cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf
|
||||
mFontShadowColor( Params.FontShadowColor ),
|
||||
mAlignOffset( 0.f, 0.f ),
|
||||
mPadding( Params.Padding ),
|
||||
mTooltipTime( 0.f ),
|
||||
mTooltipTime( cTime::Zero ),
|
||||
mTooltipOf( TooltipOf )
|
||||
{
|
||||
mTextCache = eeNew( cTextCache, () );
|
||||
@@ -23,7 +23,7 @@ cUITooltip::cUITooltip( cUITooltip::CreateParams& Params, cUIControl * TooltipOf
|
||||
if ( NULL != cUIThemeManager::instance()->DefaultFont() )
|
||||
mTextCache->Font( cUIThemeManager::instance()->DefaultFont() );
|
||||
else
|
||||
eePRINT( "cUITooltip::cUITextBox : Created a UI TextBox without a defined font.\n" );
|
||||
eePRINTL( "cUITooltip::cUITextBox : Created a UI TextBox without a defined font." );
|
||||
}
|
||||
|
||||
AutoPadding();
|
||||
@@ -237,15 +237,15 @@ const eeVector2f& cUITooltip::AlignOffset() const {
|
||||
return mAlignOffset;
|
||||
}
|
||||
|
||||
void cUITooltip::TooltipTime( const eeFloat& Time ) {
|
||||
void cUITooltip::TooltipTime( const cTime& Time ) {
|
||||
mTooltipTime = Time;
|
||||
}
|
||||
|
||||
void cUITooltip::TooltipTimeAdd( const eeFloat& Time ) {
|
||||
void cUITooltip::TooltipTimeAdd( const cTime& Time ) {
|
||||
mTooltipTime += Time;
|
||||
}
|
||||
|
||||
const eeFloat& cUITooltip::TooltipTime() const {
|
||||
const cTime& cUITooltip::TooltipTime() const {
|
||||
return mTooltipTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ void cUIWindow::CloseWindow() {
|
||||
mModalCtrl = NULL;
|
||||
}
|
||||
|
||||
if ( 0 != cUIThemeManager::instance()->ControlsFadeOutTime() )
|
||||
if ( cTime::Zero != cUIThemeManager::instance()->ControlsFadeOutTime() )
|
||||
CloseFadeOut( cUIThemeManager::instance()->ControlsFadeOutTime() );
|
||||
else
|
||||
Close();
|
||||
|
||||
@@ -18,7 +18,7 @@ cTextureAtlasEditor::cTextureAtlasEditor( cUIWindow * AttatchTo, const TGEditorC
|
||||
mCurSubTexture( NULL )
|
||||
{
|
||||
if ( NULL == cUIThemeManager::instance()->DefaultTheme() ) {
|
||||
eePRINT( "cTextureAtlasEditor needs a default theme seted to work." );
|
||||
eePRINTL( "cTextureAtlasEditor needs a default theme assigned to work." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mWindow.ContextConfig = Context;
|
||||
|
||||
if ( SDL_Init( SDL_INIT_VIDEO ) != 0 ) {
|
||||
cLog::instance()->Write( "Unable to initialize SDL: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to initialize SDL: %s", SDL_GetError() );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -100,7 +100,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
if ( SDL_VideoModeOK( mWindow.WindowConfig.Width, mWindow.WindowConfig.Height, mWindow.WindowConfig.BitsPerPixel, mTmpFlags ) ) {
|
||||
mSurface = SDL_SetVideoMode( mWindow.WindowConfig.Width, mWindow.WindowConfig.Height, mWindow.WindowConfig.BitsPerPixel, mTmpFlags );
|
||||
} else {
|
||||
cLog::instance()->Write( "Video Mode Unsopported for this videocard: " );
|
||||
eePRINTL( "Video Mode Unsopported for this videocard: " );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -110,7 +110,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mWindow.WindowSize = eeSize( mWindow.WindowConfig.Width, mWindow.WindowConfig.Height );
|
||||
|
||||
if ( NULL == mSurface ) {
|
||||
cLog::instance()->Write( "Unable to set video mode: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to set video mode: %s", SDL_GetError() );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -294,7 +294,7 @@ void cWindowSDL::Size( Uint32 Width, Uint32 Height, bool Windowed ) {
|
||||
#ifdef EE_SUPPORT_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
cLog::instance()->Writef( "Switching from %s to %s. Width: %d Height %d.", this->Windowed() ? "windowed" : "fullscreen", Windowed ? "windowed" : "fullscreen", Width, Height );
|
||||
eePRINTL( "Switching from %s to %s. Width: %d Height %d.", this->Windowed() ? "windowed" : "fullscreen", Windowed ? "windowed" : "fullscreen", Width, Height );
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
#if EE_PLATFORM == EE_PLATFORM_WIN
|
||||
@@ -363,7 +363,7 @@ void cWindowSDL::Size( Uint32 Width, Uint32 Height, bool Windowed ) {
|
||||
}
|
||||
#ifdef EE_SUPPORT_EXCEPTIONS
|
||||
} catch (...) {
|
||||
cLog::instance()->Write( "Unable to change resolution: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to change resolution: %s", SDL_GetError() );
|
||||
cLog::instance()->Save();
|
||||
mWindow.Created = false;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ std::vector<DisplayMode> cWindowSDL::GetDisplayModes() const {
|
||||
SDL_Rect **modes = SDL_ListModes( NULL, SDL_OPENGL | SDL_HWPALETTE | SDL_HWACCEL | SDL_FULLSCREEN );
|
||||
|
||||
if(modes == (SDL_Rect **)0)
|
||||
cLog::instance()->Write("No VideoMode Found");
|
||||
eePRINTL("No VideoMode Found");
|
||||
|
||||
std::vector<DisplayMode> result;
|
||||
if( modes != (SDL_Rect **)-1 )
|
||||
|
||||
@@ -113,7 +113,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mWindow.ContextConfig = Context;
|
||||
|
||||
if ( SDL_Init( SDL_INIT_VIDEO ) != 0 ) {
|
||||
cLog::instance()->Write( "Unable to initialize SDL: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to initialize SDL: %s", SDL_GetError() );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -155,7 +155,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mSDLWindow = SDL_CreateWindow( mWindow.WindowConfig.Caption.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, mWindow.WindowConfig.Width, mWindow.WindowConfig.Height, mTmpFlags );
|
||||
|
||||
if ( NULL == mSDLWindow ) {
|
||||
cLog::instance()->Write( "Unable to create window: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to create window: %s", SDL_GetError() );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -170,8 +170,6 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mWindow.WindowConfig.Height = h;
|
||||
mWindow.WindowSize = eeSize( mWindow.WindowConfig.Width, mWindow.WindowConfig.Height );
|
||||
|
||||
cLog::instance()->Write( "Creating Context" );
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_ANDROID || EE_PLATFORM == EE_PLATFORM_IOS
|
||||
if ( GLv_default != Context.Version ) {
|
||||
if ( GLv_ES1 == Context.Version || GLv_2 == Context.Version ) {
|
||||
@@ -179,14 +177,14 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
if ( GLv_2 == Context.Version )
|
||||
mWindow.ContextConfig.Version = GLv_default;
|
||||
|
||||
cLog::instance()->Write( "Starting GLES1" );
|
||||
eePRINTL( "Starting GLES1" );
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef EE_GLES2
|
||||
cLog::instance()->Write( "Starting GLES2" );
|
||||
eePRINTL( "Starting GLES2" );
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
@@ -194,18 +192,18 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
}
|
||||
} else {
|
||||
#if defined( EE_GLES2 ) && !defined( EE_GLES1 )
|
||||
cLog::instance()->Write( "Starting GLES2 default" );
|
||||
eePRINTL( "Starting GLES2 default" );
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
|
||||
#else
|
||||
cLog::instance()->Write( "Starting GLES1 default" );
|
||||
eePRINTL( "Starting GLES1 default" );
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
/* @TODO Add OpenGL Core Profile support? */
|
||||
/** @todo Add OpenGL Core Profile support? */
|
||||
/**if ( GLv_3 == Context.Version ) {
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
@@ -228,7 +226,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
#endif
|
||||
)
|
||||
{
|
||||
cLog::instance()->Write( "Unable to create context: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to create context: %s", SDL_GetError() );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
|
||||
@@ -271,12 +269,12 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
#if EE_PLATFORM == EE_PLATFORM_ANDROID
|
||||
std::string apkPath( SDL_AndroidGetApkPath() );
|
||||
|
||||
cLog::instance()->Write( "Opening application APK in: " + apkPath );
|
||||
eePRINTL( "Opening application APK in: %s", apkPath.c_str() );
|
||||
|
||||
if ( mZip->Open( apkPath ) )
|
||||
cLog::instance()->Write( "APK opened succesfully!" );
|
||||
eePRINTL( "APK opened succesfully!" );
|
||||
else
|
||||
cLog::instance()->Write( "Failed to open APK!" );
|
||||
eePRINTL( "Failed to open APK!" );
|
||||
|
||||
LogSuccessfulInit( GetVersion(), apkPath );
|
||||
#else
|
||||
@@ -396,7 +394,7 @@ void cWindowSDL::Size( Uint32 Width, Uint32 Height, bool Windowed ) {
|
||||
#ifdef EE_SUPPORT_EXCEPTIONS
|
||||
try {
|
||||
#endif
|
||||
cLog::instance()->Writef( "Switching from %s to %s. Width: %d Height %d.", this->Windowed() ? "windowed" : "fullscreen", Windowed ? "windowed" : "fullscreen", Width, Height );
|
||||
eePRINTL( "Switching from %s to %s. Width: %d Height %d.", this->Windowed() ? "windowed" : "fullscreen", Windowed ? "windowed" : "fullscreen", Width, Height );
|
||||
|
||||
// @TODO Test in OS X if this is still needed
|
||||
#if EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
@@ -466,7 +464,7 @@ void cWindowSDL::Size( Uint32 Width, Uint32 Height, bool Windowed ) {
|
||||
SendVideoResizeCb();
|
||||
#ifdef EE_SUPPORT_EXCEPTIONS
|
||||
} catch (...) {
|
||||
cLog::instance()->Write( "Unable to change resolution: " + std::string( SDL_GetError() ) );
|
||||
eePRINTL( "Unable to change resolution: %s", SDL_GetError() );
|
||||
cLog::instance()->Save();
|
||||
mWindow.Created = false;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ cCursor::cCursor( cTexture * tex, const eeVector2i& hotspot, const std::string&
|
||||
|
||||
tex->Unlock();
|
||||
} else {
|
||||
cLog::instance()->Write( "cCursor::cCursor: Error creating cursor from cTexture." );
|
||||
eePRINTL( "cCursor::cCursor: Error creating cursor from cTexture." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ cCursor::cCursor( cImage * img, const eeVector2i& hotspot, const std::string& na
|
||||
if ( img->MemSize() ) {
|
||||
mImage = eeNew( cImage, ( img->GetPixelsPtr(), img->Width(), img->Height(), img->Channels() ) );
|
||||
} else {
|
||||
cLog::instance()->Write( "cCursor::cCursor: Error creating cursor from cImage." );
|
||||
eePRINTL( "cCursor::cCursor: Error creating cursor from cImage." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ cCursor::cCursor( const std::string& path, const eeVector2i& hotspot, const std:
|
||||
mImage = eeNew( cImage, ( path ) );
|
||||
|
||||
if ( NULL == mImage->GetPixels() ) {
|
||||
cLog::instance()->Write( "cCursor::cCursor: Error creating cursor from path." );
|
||||
eePRINTL( "cCursor::cCursor: Error creating cursor from path." );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ void cWindow::SendVideoResizeCb() {
|
||||
}
|
||||
|
||||
void cWindow::LogSuccessfulInit(const std::string& BackendName , const std::string&ProcessPath ) {
|
||||
cLog::instance()->Write( "Engine Initialized Succesfully.\n\tVersion: " + Version::GetVersionName() + " (codename: \"" + Version::GetCodename() + "\")" +
|
||||
std::string msg( "Engine Initialized Succesfully.\n\tVersion: " + Version::GetVersionName() + " (codename: \"" + Version::GetCodename() + "\")" +
|
||||
"\n\tOS: " + Sys::GetOSName() +
|
||||
"\n\tArch: " + Sys::GetOSArchitecture() +
|
||||
"\n\tCPU Cores: " + String::ToStr( Sys::GetCPUCount() ) +
|
||||
@@ -399,10 +399,16 @@ void cWindow::LogSuccessfulInit(const std::string& BackendName , const std::stri
|
||||
"\n\tResolution: " + String::ToStr( GetWidth() ) + "x" + String::ToStr( GetHeight() ) +
|
||||
"\n\tGL extensions supported:\n\t\t" + GLi->GetExtensions()
|
||||
);
|
||||
|
||||
#ifndef EE_SILENT
|
||||
eePRINTL( msg.c_str() );
|
||||
#else
|
||||
cLog::instance()->Write( msg );
|
||||
#endif
|
||||
}
|
||||
|
||||
void cWindow::LogFailureInit( const std::string& ClassName, const std::string& BackendName ) {
|
||||
cLog::instance()->Write( "Error on " + ClassName + "::Init . Backend " + BackendName + " failed to start." );
|
||||
eePRINTL( "Error on %s::Init. Backend %s failed to start.", ClassName.c_str(), BackendName.c_str() );
|
||||
}
|
||||
|
||||
std::string cWindow::Caption() {
|
||||
|
||||
@@ -15,7 +15,7 @@ void spriteCallback( Uint32 Event, cSprite * Sprite, void * UserData ) {
|
||||
AngleInterpolation->ClearWaypoints();
|
||||
AngleInterpolation->AddWaypoint( Sprite->Angle() );
|
||||
AngleInterpolation->AddWaypoint( Sprite->Angle() + 45.f );
|
||||
AngleInterpolation->SetTotalTime( 500 );
|
||||
AngleInterpolation->SetTotalTime( Milliseconds( 500 ) );
|
||||
AngleInterpolation->Type( Ease::BounceOut ); // Set the easing effect used for the interpolation
|
||||
AngleInterpolation->Start();
|
||||
|
||||
@@ -92,7 +92,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
cInterpolation PlanetAngle;
|
||||
PlanetAngle.AddWaypoint( 0 );
|
||||
PlanetAngle.AddWaypoint( 360 );
|
||||
PlanetAngle.SetTotalTime( 10000 );
|
||||
PlanetAngle.SetTotalTime( Seconds( 10 ) );
|
||||
PlanetAngle.Loop( true );
|
||||
PlanetAngle.Start();
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void cEETest::Init() {
|
||||
WP.EditWaypoint( 2, eeVector2f(800,600), 100 );
|
||||
WP.EraseWaypoint( 3 );
|
||||
WP.Loop(true);
|
||||
WP.SetTotalTime(5000);
|
||||
WP.SetTotalTime( Milliseconds( 5000 ) );
|
||||
WP.Start();
|
||||
|
||||
Batch.AllocVertexs( 2048 );
|
||||
@@ -171,7 +171,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().AsMilliseconds() );
|
||||
eePRINTL( "Fonts loading time: %4.3f ms.", mFTE.Elapsed().AsMilliseconds() );
|
||||
|
||||
eeASSERT( TTF != NULL );
|
||||
eeASSERT( TTFB != NULL );
|
||||
@@ -250,7 +250,7 @@ void cEETest::CreateUI() {
|
||||
|
||||
CreateUIThemeTextureAtlas();
|
||||
|
||||
Log->Writef( "Texture Atlas Loading Time: %f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
eePRINTL( "Texture Atlas Loading Time: %4.3f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
|
||||
cUIManager::instance()->Init(); //UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER
|
||||
|
||||
@@ -288,7 +288,7 @@ void cEETest::CreateUI() {
|
||||
Child->Pos( 240, 130 );
|
||||
Child->Visible( true );
|
||||
Child->Enabled( true );
|
||||
Child->StartRotation( 0.f, 360.f, 5000.f );
|
||||
Child->StartRotation( 0.f, 360.f, Milliseconds( 5000.f ) );
|
||||
Child->AngleInterpolation()->Loop( true );
|
||||
|
||||
Params.Background.Colors( eeColorA( 0xFFFF0077 ), eeColorA( 0xCCCC0077 ), eeColorA( 0xCCCC0077 ), eeColorA( 0xFFFF0077 ) );
|
||||
@@ -298,7 +298,7 @@ void cEETest::CreateUI() {
|
||||
Child2->Pos( 15, 15 );
|
||||
Child2->Visible( true );
|
||||
Child2->Enabled( true );
|
||||
Child2->StartRotation( 0.f, 360.f, 5000.f );
|
||||
Child2->StartRotation( 0.f, 360.f, Milliseconds( 5000.f ) );
|
||||
Child2->AngleInterpolation()->Loop( true );
|
||||
|
||||
mTheme->CreateSprite( eeNew( cSprite, ( "gn" ) ), C, eeSize(), eeVector2i( 160, 100 ) );
|
||||
@@ -572,7 +572,7 @@ void cEETest::CreateUI() {
|
||||
|
||||
C = reinterpret_cast<cUIControlAnim*> ( C->Parent() );
|
||||
|
||||
Log->Writef( "CreateUI time: %f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
eePRINTL( "CreateUI time: %4.3f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
}
|
||||
|
||||
void cEETest::CreateMapEditor() {
|
||||
@@ -693,13 +693,13 @@ void cEETest::ItemClick( const cUIEvent * Event ) {
|
||||
|
||||
if ( Chk->Active() ) {
|
||||
if ( C->Scale() == 1.f ) C->Scale( 0.f );
|
||||
C->StartScaleAnim( C->Scale(), 1.f, 500.f, Ease::SineOut );
|
||||
C->StartAlphaAnim( C->Alpha(), 255.f, 500.f );
|
||||
C->StartRotation( 0, 360, 500.f, Ease::SineOut );
|
||||
C->StartScaleAnim( C->Scale(), 1.f, Milliseconds( 500.f ), Ease::SineOut );
|
||||
C->StartAlphaAnim( C->Alpha(), 255.f, Milliseconds( 500.f ) );
|
||||
C->StartRotation( 0, 360, Milliseconds( 500.f ), Ease::SineOut );
|
||||
} else {
|
||||
C->StartScaleAnim( C->Scale(), 0.f, 500.f, Ease::SineIn );
|
||||
C->StartAlphaAnim( C->Alpha(), 0.f, 500.f );
|
||||
C->StartRotation( 0, 360, 500.f, Ease::SineIn );
|
||||
C->StartScaleAnim( C->Scale(), 0.f, Milliseconds( 500.f ), Ease::SineIn );
|
||||
C->StartAlphaAnim( C->Alpha(), 0.f, Milliseconds( 500.f ) );
|
||||
C->StartRotation( 0, 360, Milliseconds( 500.f ), Ease::SineIn );
|
||||
}
|
||||
} else if ( "Show Window 2" == txt ) {
|
||||
if ( NULL == mUIWindow ) {
|
||||
@@ -763,9 +763,9 @@ void cEETest::ButtonClick( const cUIEvent * Event ) {
|
||||
Gfx->Visible( true );
|
||||
Gfx->Enabled( false );
|
||||
|
||||
Gfx->StartRotation( 0, 2500, 2500 );
|
||||
Gfx->StartMovement( eeVector2i( Math::Randi( 0, mWindow->GetWidth() ), -64 ), eeVector2i( Math::Randi( 0, mWindow->GetWidth() ), mWindow->GetHeight() + 64 ), 2500 );
|
||||
Gfx->CloseFadeOut( 3500 );
|
||||
Gfx->StartRotation( 0, 2500, Milliseconds( 2500 ) );
|
||||
Gfx->StartMovement( eeVector2i( Math::Randi( 0, mWindow->GetWidth() ), -64 ), eeVector2i( Math::Randi( 0, mWindow->GetWidth() ), mWindow->GetHeight() + 64 ), Milliseconds( 2500 ) );
|
||||
Gfx->CloseFadeOut( Milliseconds( 3500 ) );
|
||||
|
||||
mListBox->AddListBoxItem( "Test ListBox " + String::ToStr( mListBox->Count() + 1 ) + " testing it right now!" );
|
||||
}
|
||||
@@ -917,7 +917,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().AsMilliseconds() );
|
||||
eePRINTL( "Textures loading time: %4.3f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
|
||||
Map.Create( 100, 100, 2, 128, 64, eeColor(175,175,175) );
|
||||
RandomizeHeights();
|
||||
@@ -925,7 +925,7 @@ void cEETest::LoadTextures() {
|
||||
TreeTilingCreated = false;
|
||||
CreateTiling(Wireframe);
|
||||
|
||||
Log->Writef( "Map creation time: %f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
eePRINTL( "Map creation time: %4.3f ms.", TE.Elapsed().AsMilliseconds() );
|
||||
}
|
||||
|
||||
void cEETest::RandomizeHeights() {
|
||||
|
||||
Reference in New Issue
Block a user