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 / I don't see my sprites, help needed please.

Author
Message
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 13th May 2005 08:08
hi,

I'm not sure I'm doing things rights.
To display a sprite where the sprite equal its image size (png) I made the code below, is that correct ?

The result is that I have a blue screen without any sprite displayed.

What am I doing wrong ?
Thanks

/kml
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 13th May 2005 17:06
Here the code (don't know why it was not included in the first place)
The only thing I've is a black screen.


#include "DarkSDK.h"


int width = 640, height = 480 , depth = 16; // screen resolution

void rasters(void) {

dbSprite ( 0, 0, 0, 0 ); //first zero is the sprite number, then x/y coord. then the number of the image where the sprite is taking from (see getimage)
}

void DarkSDK ( void )
{

dbSyncOn ( );
dbSyncRate ( 0 );


dbSetDisplayMode ( width, height, depth );

dbLoadImage ( "rasterr.png", 0 );

dbGetImage ( 0, 0, 0, 640, 16 ); //first zero number of the image (ref), then upper left, top width and size of the image to create the sprite

while ( LoopSDK ( ) )
{
if ( dbEscapeKey ( ) )
return;
rasters(); //display the sprite.
dbSync ( );
}
}

/kml
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th May 2005 21:15
Valid Sprite and Image numbers start at 1.

Apart from that, your code looks fine.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 13th May 2005 21:40
Hi,

thanks but I thought of that just after posting but its not working either.
I even tried bmp, gif format in case, same pb.
The only thing that I saw once was a little dot moving because I did a typo in the code, instead of sprite 2 I put 12.

I'm lost

/kml
Smithy
19
Years of Service
User Offline
Joined: 8th Dec 2004
Location: Switzerland
Posted: 13th May 2005 22:19 Edited at: 13th May 2005 22:33
I find this strange:
You use "dbLoadImage ( <*.png>, imgID )"

and next line
"dbGetImage (imgID, coords)"

I am not at home and have no helpfile, also I have no experience with sprites yet, but I think you will overwrite the image!

dbLoadImage -> load the png into image with say ID 1.
dbGetImage -> load something from screen into image with ID 1.

Now, the image with the ID 1 will have what you got from screen and not the png.

--smithy

[EDIT]
AFAIK, the dbLoadImage will not display the image on screen but load the file in an imageobject which you can use then to i.e. texture another 3d-object.
To display the image, there should be something like "dbPasteImage".

//Pentium IV 3200E/Prescott; 800Mhz FSB; Hyperthreading; WinXP Pro (!XP2); ATI R9700PRO; 1024MB RAM (2x 512MB "DualChanneled"; VC++ 6.0; Delphi; ADSL;
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 13th May 2005 23:16
Good catch,

So how do I tranlate my image as a sprite ?

I tried what you said but its not working either, meaning that I still do have a black screen.


#include "DarkSDK.h"


int width = 640, height = 480 , depth = 32; // screen resolution

void DarkSDK ( void )
{

dbSyncOn ( );
dbSyncRate ( 0 );


dbSetDisplayMode ( width, height, depth );

dbLoadImage ( "rasterr.bmp", 1 );

dbPasteImage(1,0,0);


while ( LoopSDK ( ) )
{
if ( dbEscapeKey ( ) )
return;

dbSync ( );
}
}

/kml
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 14th May 2005 03:46
I didn't spot that

Quote: "So how do I tranlate my image as a sprite ?"


You don't. You just specify the image number as the last parameter of the sprite. Sprites link to images.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 14th May 2005 06:48
Problem found, thanks to Seph' from Darkbasic IRC, I was so stupid that I didn't check the path of the datas
Poor me.

Files at :
http://www.thegamecreators.com/?m=codebase_view&i=b7ae953fd37e575d91aaebfc800a2ae1

/kml

Login to post a reply

Server time is: 2024-04-25 00:58:48
Your offset time is: 2024-04-25 00:58:48