DrawSpriteCenter

出典: YKAwiki

目次

概要

LoadTextureで読み込んだテクスチャをスプライト表示

書式

void drawSpriteCenter( int id, int centerx, int centery, HPLRect src_rect,
   float zoom, float rot = 0, int blend_type = BLEND_TYPE_NORMAL,
   float alpha = 1.f);
@param id 識別ID
@param centerx,centery 表示位置(中心の座標)
@param src_rect テクスチャの度の部分を表示するか
@param zoom 拡大縮小。倍率指定(標準=1.0)
@param rot 回転。ラジアン指定
@param blend_type 透明化表示の種類
   BLEND_TYPE_NORMAL 標準透過
   BLEND_TYPE_ADD 加算透過
@param alpha 透明度 1で不透明。[0.0,1.0]

サンプル

int InitApplication(){
 //消去色
 gGame->setClearColor(0,0.2f,0,1);
 //テクスチャ読み込み
 gGame->loadTexture( "comboMark.png", eSpriteTexture);
 return 0;
}
void Main(){
 {
  static float fRot = 0;
  fRot += 0.1f;
  if( fRot > 2 * 3.14){
  fRot = 0;
 }
 static float fZoom = 1.f;
 fZoom += 0.1f;
 if( fZoom > 5){
  fZoom = 0;
 }
 int centerx = 100, centery = 100;
 //スプライト描画
 gGame->drawSpriteCenter( eSpriteTexture, centerx, centery, rSpriteSrcRect,
   fZoom, fRot, BLEND_TYPE_NORMAL, 1.f);
 }
}

関連

LoadTexture