1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include "main.h"
int main( int argc, char* args[] )
{
CGraphics* gr = new CGraphics(800, 600, "Hello", 20, 107, 47);
SDL_Surface* pig = gr->loadBitmap("pig.bmp", 255, 255, 255);
NPC* woink = new NPC();
woink->setX(50);
woink->setY(50);
woink->setSpeed(3);
NPC* woink2 = new NPC();
woink2->setX(500);
woink2->setY(450);
woink2->setSpeed(18);
while(1)
{
woink->move(400, 350);
woink2->move(20, 14);
gr->beginScene();
gr->drawSprite(pig, 0, 0, woink->getX(), woink->getY(), 32, 32);
gr->drawSprite(pig, 0, 0, woink2->getX(), woink2->getY(), 32, 32);
SDL_Delay(50);
gr->endScene();
}
delete woink;
delete woink2;
gr->closeBitmap(pig);
gr->~CGraphics();
return 0;
}
|