This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Tortuga/client/image.cpp
T
2013-05-02 20:28:12 +10:00

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);
}