hey i can't get this to work
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
//function headers
void WindowSetup( void );
void MouseSetup ( void );
void MousePasteImage ( void ) ;
void MainScreen ( void );
void MainScreenSetup ( void );
void MainScreenClick_Create ( void );
void MainScreenClick_CreateScreen ( void );
char * username;
char * password;
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
//Sets up Client : Window size, resolution etc.
WindowSetup();
//Setup Sprite number for mouse
MouseSetup();
//Set up Sprite number for screen
MainScreenSetup();
// our main loop
while ( LoopGDK ( ) )
{
// main screen images etc
MainScreen ();
//if Create is clicked.
MainScreenClick_Create ( );
// changing mouse
MousePasteImage();
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void WindowSetup( void )
{
dbSetDir("Media");
dbSetWindowTitle ( "The War Within Client v 0.1" ) ;
dbSetWindowOff(); // window mode off
dbSetDisplayMode ( 1024, 768, 32 ); //depth and res.
dbMaximiseWindow(); // maximise
}
void MouseSetup ( void )
{
dbHideMouse ( ) ;
dbCreateAnimatedSprite ( 99999, "testcursor.png", 1, 1, 99999 );
}
void MousePasteImage ( void )
{
dbPasteSprite ( 99999, dbMouseX(), dbMouseY() ) ;
}
void MainScreen ( void )
{
dbPasteSprite ( 99998, 0, 0 ) ;
dbPasteSprite ( 99997, 100, 0 ) ;
}
void MainScreenSetup ( void )
{
;dbCreateAnimatedSprite ( 99998, "Create.png", 1, 1, 99998 );
dbCreateAnimatedSprite ( 99997, "LogIn.png", 1, 1, 99997 );
}
void MainScreenClick_Create ( void )
{
int spriteCollision = dbSpriteCollision(99999, 99998);
int mouse = 99999;
int create = 99998;
int login = 99997;
//left == 1, right == 2
if(dbMouseClick() == 1 && spriteCollision)
{
dbDeleteSprite(create);
dbDeleteSprite(login);
MainScreenClick_CreateScreen();
}
}
void MainScreenClick_CreateScreen ( void )
{
int x = 300;
int y = 0;
char * filename = "Username.txt";
dbSetCursor ( x, y ) ;
username = dbInput ();
dbMakeFile ( filename );
dbOpenToWrite ( 1, filename ) ;
dbWriteString ( 1, username ) ;
dbPrint(username);
dbCloseFile ( 1 ) ;
}
Basically in the beginning, when the program starts, it has 2 images, create and log in. I then have a function that "replaces" the current mouse with a sprite (just hides mouse and uses a sprite in its place) I want it so that when i right click on the 'create', it removes all the sprites on the screen so i can redraw. However, as of now, i right click anywhere on screen, and it deletes everything on screen. That means the collision isnt working. Please help me
Thankyou very much