mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-02 19:46:29 +03:00
I made some minor changes in the debugging functions to write to the log file too the information debuged. Fixed glew include, trying to include from the include file path instead of the project file path. To try to avoid the rare bug i moved the creation of the instance of the ttf font on the constructor of the ttf font loader ( to know if that fixes the problem i need to NOT replecate the bug again, so it will be a matter of time to know if that affect or not in the current bug ). I said that i hate threading bugs?
93 lines
2.1 KiB
C++
93 lines
2.1 KiB
C++
#include "cshapegroupmanager.hpp"
|
|
#include "cglobalshapegroup.hpp"
|
|
|
|
namespace EE { namespace Graphics {
|
|
|
|
cShapeGroupManager::cShapeGroupManager() :
|
|
tResourceManager<cShapeGroup>( false )
|
|
{
|
|
Add( cGlobalShapeGroup::instance() );
|
|
}
|
|
|
|
cShapeGroupManager::~cShapeGroupManager() {
|
|
}
|
|
|
|
cShape * cShapeGroupManager::GetShapeByName( const std::string& Name ) {
|
|
cShape * tShape = GetShapeById( MakeHash( Name ) );
|
|
|
|
//eePRINTC( NULL == tShape, "cShapeGroupManager::GetShapeByName shape '%s' not found\n", Name.c_str() );
|
|
|
|
return tShape;
|
|
}
|
|
|
|
cShape * cShapeGroupManager::GetShapeById( const Uint32& Id ) {
|
|
std::list<cShapeGroup*>::iterator it;
|
|
|
|
cShapeGroup * tSG = NULL;
|
|
cShape * tShape = NULL;
|
|
|
|
for ( it = mResources.begin(); it != mResources.end(); it++ ) {
|
|
tSG = (*it);
|
|
|
|
tShape = tSG->GetById( Id );
|
|
|
|
if ( NULL != tShape )
|
|
return tShape;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
void cShapeGroupManager::PrintResources() {
|
|
std::list<cShapeGroup*>::iterator it;
|
|
|
|
for ( it = mResources.begin(); it != mResources.end(); it++ )
|
|
(*it)->PrintNames();
|
|
}
|
|
|
|
std::vector<cShape*> cShapeGroupManager::GetShapesByPattern( const std::string& name, const std::string& extension, cShapeGroup * SearchInShapeGroup ) {
|
|
std::vector<cShape*> Shapes;
|
|
std::string search;
|
|
bool found = true;
|
|
cShape * tShape = NULL;
|
|
std::string realext = "";
|
|
eeInt c = 0;
|
|
if ( extension.size() )
|
|
realext = "." + extension;
|
|
|
|
do {
|
|
if ( c < 100 )
|
|
search = StrFormated( "%s%02d%s", name.c_str(), c, realext.c_str() );
|
|
else if ( c < 1000 )
|
|
search = StrFormated( "%s%03d%s", name.c_str(), c, realext.c_str() );
|
|
else if ( c < 10000 )
|
|
search = StrFormated( "%s%04d%s", name.c_str(), c, realext.c_str() );
|
|
else
|
|
found = false;
|
|
|
|
if ( found ) {
|
|
if ( NULL == SearchInShapeGroup )
|
|
tShape = GetShapeByName( search );
|
|
else
|
|
tShape = SearchInShapeGroup->GetByName( search );
|
|
|
|
if ( NULL != tShape ) {
|
|
Shapes.push_back( tShape );
|
|
|
|
found = true;
|
|
} else {
|
|
if ( 0 == c ) // if didn't found "00", will search at least for "01"
|
|
found = true;
|
|
else
|
|
found = false;
|
|
}
|
|
}
|
|
|
|
c++;
|
|
} while ( found );
|
|
|
|
return Shapes;
|
|
}
|
|
|
|
}}
|