Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dynamic sprite ?

Author
Message
Can I use VC++ 6 with Dark GDK
16
Years of Service
User Offline
Joined: 8th Jan 2008
Location:
Posted: 17th Mar 2008 11:12
///////////////////////////////////

#include "DarkGDK.h"

void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );

int i = 1;

while ( LoopGDK ( ) )
{

if( dbUpKey( ) )
{
while( dbUpKey( ) ); //wait for the key is released
dbLoadImage( "box.jpg", i, 1 );
dbSprite( i, dbRND( 640 ), dbRND( 480 ), i );
i++;
}

if( dbDownKey( ) )
{
while( dbDownKey( ) ); //wait for the key is released
i--;
dbDeleteSprite( i );
dbDeleteImage( i );
}

dbSync ( );
}


return;
}


///////////////////////////////////
I think that these codes for dynamic loading (dynamic sprite loading and dynamic image loading)

I found a problem...
1.when the program runs, it works correctly.
2.I pushed up key 3 times to load the dynamic sprites, it worked correctly.
3.when I pushed down key 3 times to delete the sprites I loaded, it worked correctly.
4.I pushed up key 3 time again to load the sprites 3 pieces on screen, it worked correctly.
5.but when I pushed down key to delete each sprite, it appears that the sprites on screen cannot be deleted.

6.why?

*NOTE if I did not delete the last sprite on screen when I pushed up key to load it or I pushed down key to delete it, it appears that it works correctly
[/code][code]
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 17th Mar 2008 19:59
I'm going to take a guess here. Is there any chance that you're letting 'i' get down to where it's zero? If so, I think the GDK doesn't like that and might start behaving strangely. You might want to put a check or two for 'i' being zero (or less) and incrementing it until it's at least greater than zero.

Lilith, Night Butterfly

Login to post a reply

Server time is: 2024-11-20 05:45:48
Your offset time is: 2024-11-20 05:45:48