コード例 #1
0
ファイル: Bitmap.cpp プロジェクト: rubyaction/rubyaction
Bitmap::Bitmap(mrb_value self, mrb_value texture_region)
  : Sprite(self)
{
  setProperty("texture_region", texture_region);
  TextureRegion *region = (TextureRegion*) getObject("texture_region");
  setWidth(region->getWidth());
  setHeight(region->getHeight());
}
コード例 #2
0
ファイル: Bitmap.cpp プロジェクト: rubyaction/rubyaction
void Bitmap::renderMe(SDL_Renderer *renderer)
{
  TextureRegion *region = (TextureRegion*) this->getObject("texture_region");
  Texture *texture = (Texture*) region->getObject("texture");

  SDL_Rect srcrect = { region->getX(), region->getY(), region->getWidth(), region->getHeight() };
  SDL_Rect dstrect = { 0, 0, this->getWidth(), this->getHeight() };

  texture->render(renderer, &srcrect, &dstrect);
}