Esempio n. 1
0
SpriteCmp::SpriteCmp( Game * game_ ) : BaseComponent<SpriteInfo>( game_ )
{
  SpriteDef def;
  Render * r = game->getRender();
  const AtlasInfo * ai =
    r->getAtlas( def.atlasFile.c_str(), def.atlasInfoFile.c_str() );
  if( !ai ) {
    ai = r->loadAtlas( def.atlasFile.c_str(), def.atlasInfoFile.c_str() );
    if( !ai ) PRINT_ERROR( "ERROR: nie zaladowano atlasu" );
  }
  untexturedSprite.tex = ai->tex;
  untexturedSprite.textureNumber = ai->getTextureNumber( def.textureName.c_str() );
  untexturedSprite.coordSpace = def.coordSpace;
  untexturedSprite.color = def.color;
}
Esempio n. 2
0
SpriteInfo::SpriteInfo( const SpriteDef & def, Entity e, Game * game ):
  SpriteDef( def )
/*
atlasFile(def.atlasFile), atlasInfoFile(def.atlasInfoFile)
,textureName(def.textureName),coordSpace(def.coordSpace)
,color(def.color), depth(def.depth)
*/
  , tex(), textureNumber()
{
  Render * r = game->getRender();
  const AtlasInfo * ai =
    r->getAtlas( def.atlasFile.c_str(), def.atlasInfoFile.c_str() );
  if( !ai ) {
    ai = r->loadAtlas( def.atlasFile.c_str(), def.atlasInfoFile.c_str() );
    if( !ai ) PRINT_ERROR( "ERROR: nie zaladowano atlasu" );
  }
  tex = ai->tex;
  textureNumber = ai->getTextureNumber( def.textureName.c_str() );
}