コード例 #1
0
ファイル: render.cpp プロジェクト: tempbottle/kj2
/*! 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 );
  }
}
コード例 #2
0
ファイル: render.cpp プロジェクト: tempbottle/kj2
/*! 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)