title says.
whenever i click "X" or close (--'), it crashes and that causes it not to terminate. Nothing is moving only in the application.
here's the code.
i will put everything.
main
#include "DarkGDK.h"
#include "string.h"
#define CURSOR 2
#define FRAMER 1
//DECLARATIONS
int load();
int create();
int clear(int ID);
int mouse(int ID);
int framer(int ID);
//GLOBAL VARIABLES
//GLOBAL CONSTANT VARIABLES
//Fonts
//leelawadee
//Goudy Stout
void DarkGDK(void)
{
//Default Setting Configurations
dbSyncOn();
dbSyncRate(120);
dbDisableEscapeKey();
load();
create();
while(LoopGDK())
{
dbSync();
dbCLS();
//Declared Functions
framer(FRAMER);
mouse(CURSOR);
//Game Functions
//Setting Change
//Terminate
if(dbEscapeKey())
{
break;
}
dbSync();
}
clear(200);
return;
}
mouse
#include "darkGDK.h"
#define pi 3.1415
double x;
double y;
double mx;
double my;
double a;
double b;
double c;
double angle;
int mouse(int ID)
{
x=dbSpriteX(ID);
y=dbSpriteY(ID);
mx=dbMouseX();
my=dbMouseY();
a = x-mx;
b = y-my;
c = sqrt((a*a)+(b*b));
angle = ((atan2(my-y, mx-x))*180/pi)+90;
dbRotateSprite(ID, angle);
dbMoveSprite(ID, c);
dbRotateSprite(ID, 0);
return 0;
}
image
#include "darkgdk.h"
int load()
{
dbCreateAnimatedSprite(1, "framer.png", 3, 1, 1);
dbLoadImage("cursor.png", 2);
dbLoadImage("warlord1.png", 3);
dbLoadImage("pause.png", 4);
return 0;
}
int create()
{
dbSprite(1, 10, 10, 1);
dbSprite(2, dbMouseX(), dbMouseY(), 2);
dbSprite(3, 0, 0, 3);
//Size/Scale/Stretch
dbSizeSprite(3, 640, 480);
//Priority
dbSetSpritePriority(2, 5000);
dbSetSpritePriority(1, 4999);
return 0;
}
int clear(int ID)
{
for(int i = 0; i<=ID; ID++)
{
dbDeleteSprite(ID);
dbDeleteImage(ID);
}
return 0;
}
frames
#include "darkgdk.h"
int framer(int ID)
{
if(dbScreenFPS() >= 60)
{
dbPlaySprite(ID, 1, 1, 100);
}
else if(dbScreenFPS() > 30 && dbScreenFPS() < 60)
{
dbPlaySprite(ID, 2, 2, 100);
}
else
{
dbPlaySprite(ID, 3, 3, 100);
}
return 0;
}
-Excellence deals with weak people-