Exemple #1
0
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());
}
Exemple #2
0
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);
}