32 lines
600 B
C++
32 lines
600 B
C++
#include "image.hpp"
|
|
|
|
Image::Image(SDL_Surface* p) {
|
|
SetSurface(p);
|
|
}
|
|
|
|
Image::Image(SDL_Surface* p, SDL_Rect r) {
|
|
SetSurface(p, r);
|
|
}
|
|
|
|
SDL_Surface* Image::SetSurface(SDL_Surface* p) {
|
|
surface = p;
|
|
clip = {0, 0, (Uint16)surface->w, (Uint16)surface->h};
|
|
return surface;
|
|
}
|
|
|
|
SDL_Surface* Image::SetSurface(SDL_Surface* const p, SDL_Rect r) {
|
|
surface = p;
|
|
clip = r;
|
|
return surface;
|
|
}
|
|
|
|
SDL_Surface* Image::GetSurface() const {
|
|
return surface;
|
|
}
|
|
|
|
void Image::DrawTo(SDL_Surface* dest, Sint16 x, Sint16 y) {
|
|
SDL_Rect sclip = clip, dclip = {x,y};
|
|
|
|
SDL_BlitSurface(surface, &sclip, dest, &dclip);
|
|
}
|