/*! jesli widoczny to go narysuje */ void SpriteCmp::draw( Entity e , const ShapeDef& shapeDef) { SpriteInfo * spriteInfo = 0; if(e.getId() == 0) { spriteInfo = &untexturedSprite; }else{ spriteInfo = BaseType::get( e ); if( ! spriteInfo ) return; } Render * r = game->getRender(); if( spriteInfo->visible ) { Vec2Quad shape; translateQuad( shapeDef.rect, shapeDef.pos, &shape ); if(shapeDef.angle) rotateQuad(shape,shapeDef.angle,shapeDef.pos,&shape); r->drawAtlas( spriteInfo->tex, spriteInfo->textureNumber, shape, Render::CoordSpace_e( spriteInfo->coordSpace ), spriteInfo->color, shapeDef.depth ); } }
/*! rysuje tylko widoczne */ void SpriteCmp::drawAll() { Render * r = game->getRender(); ShapeCmp * shapeCmp = game->getShapeCmp(); FOR_ALL( records, it ) { SpriteInfo * scd = *it; ShapeDef * shapeDef = shapeCmp->getSure( scd->shape ); if( scd->visible ) { Vec2Quad shape; //rotateQuad(shapeDef->rect,shapeDef->angle,shapeDef->pos,&shape ); //translateQuad( shape, shapeDef->pos, &shape ); translateQuad( shapeDef->rect, shapeDef->pos, &shape ); if(shapeDef->angle) rotateQuad(shape,shapeDef->angle,shapeDef->pos,&shape); r->drawAtlas( scd->tex, scd->textureNumber, shape, Render::CoordSpace_e( scd->coordSpace ), scd->color, shapeDef->depth ); } }//koniec for(records)