Visa spoiler
/* begining of class tree1 */
class tree1
{
private:
SDL_Rect Cbox;
SDL_Rect Sclip[2];
int x, y;
SDL_Surface *sprite;
int frame;
public:
tree1( int X, int Y );
~tree1();
void drawSprite();
};
tree1::tree1( int X, int Y ):
x( X ),
y( Y ),
frame( 0 )
{
Cbox.x = X;
Cbox.y = Y;
Cbox.w = 100;
Cbox.h = 150;
sprite = loadImage( "tree1_SDL_setting upp.png" );
Sclip[0].x = 0;
Sclip[0].y = 0;
Sclip[0].w = 100;
Sclip[0].h = 150;
Sclip[1].x = 100;
Sclip[1].y = 0;
Sclip[1].w = 100;
Sclip[1].h = 150;
Sclip[2].x = 200;
Sclip[2].y = 0;
Sclip[2].w = 100;
Sclip[2].h = 150;
}
tree1::~tree1()
{
SDL_FreeSurface( sprite );
}
void tree1::drawSprite()
{
frame++;
if( frame >= 3 )
frame = 0;
Draw( x, y, sprite, screen, &Sclip[frame] );
}
/* end of class tree1 */
class tree1
{
private:
SDL_Rect Cbox;
SDL_Rect Sclip[2];
int x, y;
SDL_Surface *sprite;
int frame;
public:
tree1( int X, int Y );
~tree1();
void drawSprite();
};
tree1::tree1( int X, int Y ):
x( X ),
y( Y ),
frame( 0 )
{
Cbox.x = X;
Cbox.y = Y;
Cbox.w = 100;
Cbox.h = 150;
sprite = loadImage( "tree1_SDL_setting upp.png" );
Sclip[0].x = 0;
Sclip[0].y = 0;
Sclip[0].w = 100;
Sclip[0].h = 150;
Sclip[1].x = 100;
Sclip[1].y = 0;
Sclip[1].w = 100;
Sclip[1].h = 150;
Sclip[2].x = 200;
Sclip[2].y = 0;
Sclip[2].w = 100;
Sclip[2].h = 150;
}
tree1::~tree1()
{
SDL_FreeSurface( sprite );
}
void tree1::drawSprite()
{
frame++;
if( frame >= 3 )
frame = 0;
Draw( x, y, sprite, screen, &Sclip[frame] );
}
/* end of class tree1 */
Ingen status