Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Surface.h"
- SDL_Surface * MySurface::OnLoad(char *File)
- {
- SDL_Surface *Temp = NULL;
- SDL_Surface *Res = NULL;
- if((Temp = SDL_LoadBMP(File)) == NULL)
- {
- return NULL;
- }
- Res = SDL_DisplayFormat(Temp);
- SDL_FreeSurface(Temp);
- return Res;
- }
- bool MySurface::OnDraw(SDL_Surface *Main, SDL_Surface *Src, int X, int Y)
- {
- if(Main == NULL || Src == NULL)
- {
- return false;
- }
- SDL_Rect MainR;
- MainR.x = X;
- MainR.y = Y;
- SDL_BlitSurface(Src, NULL, Main, &MainR);
- return true;
- }
- bool MySurface::OnDraw(SDL_Surface *Main, SDL_Surface *Src, int X, int Y, int X2, int Y2, int W, int H)
- {
- if(Main == NULL || Src == NULL)
- {
- return false;
- }
- SDL_Rect MainR;
- MainR.x = X;
- MainR.y = Y;
- SDL_Rect SrcR;
- SrcR.x = X2;
- SrcR.y = Y2;
- SrcR.h = H;
- SrcR.w = W;
- SDL_BlitSurface(Src, &SrcR, Main, &MainR);
- return true;
- }
- bool MySurface::Transparent(SDL_Surface *Surface, int R, int G, int B)
- {
- if(Surface == NULL)
- {
- return false;
- }
- SDL_SetColorKey(Surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(Surface->format, R, G, B));
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement