10.07.2015 Views

[ebook]Programacion de videojuegos con SDL

[ebook]Programacion de videojuegos con SDL

[ebook]Programacion de videojuegos con SDL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

P R O G R A M A C I Ó N D E V I D E O J U E G O S C O N S D Lcsprite.cpp#inclu<strong>de</strong> #inclu<strong>de</strong> "csprite.h"// Sprite Class implementationvoid CFrame::load(char *path) {img=<strong>SDL</strong>_LoadBMP(path);}// Asignamos el color transparente al color rojo.<strong>SDL</strong>_SetColorKey(img,<strong>SDL</strong>_SRCCOLORKEY|<strong>SDL</strong>_RLEACCEL, <strong>SDL</strong>_MapRGB(img->format,255,0,0));img=<strong>SDL</strong>_DisplayFormat(img);void CFrame::unload(){<strong>SDL</strong>_FreeSurface(img);}CSprite::CSprite(int nf) {sprite=new CFrame[nf];nframes=nf;<strong>con</strong>t=0;}CSprite::CSprite() {int nf=1;sprite=new CFrame[nf];nframes=nf;<strong>con</strong>t=0;}void CSprite::finalize() {int i;}for (i=0 ; ix1)&&((y2+h2)>y1)) {return TRUE;84

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!