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 / help with command dbPoint

Author
Message
Jim H
15
Years of Service
User Offline
Joined: 1st Mar 2009
Location:
Posted: 2nd Mar 2009 03:36
I'm new to dark GDK and relatively new to c++. I would like some help on returning a value from the dbPoint() command. In the instance I need help with, I'm trying to determine if a sprite is on a certain path by picking up the color of the background. I've loaded the background as a sprite... like this...

dbLoadImage ( "track.bmp",1);
dbSprite (1,0,0,1 );

then trying to extract the color of the point...

DWORD track,stripe,testp1,testp2;
track=dbPoint(10,10);
stripe=dbPoint(264,110);

the color at the points indicated should be a green and a yellow. When I debug and break the program, the values contained in track and stripe are both 0. I've also tried declaring the variables as int and long. Any help would be appreciated. Thanks, Jim.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Mar 2009 18:38
You'll need to give more info than that.

I suggest that you post the image you use for your backdrop (or something that can be tested against), and your code (or code that contains your checks and still doesn't work), then we can look at it.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 2nd Mar 2009 19:34
dbPoint doesn't work on sprites

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Mar 2009 19:59
Oops, never noticed that ... so why didn't you tell him how to get it to work with sprites?

@Jim H,
Sprites, in their default setting, leave no trace on the background. If you have the backdrop on, they are overwritten with the blue you normally see. If you have the backdrop off, then the background will saved before displaying the sprite and replaced after - this is so you can move the sprite without having to redraw the background.

To get this working for you, just use two simple commands after you create the sprite:


The middle number in the first commands sets the sprite backsave option to 'off' and disables the saving. The second command removes the backdrop - this means that you'll have to clear the backdrop yourself if you need that, using the dbCls function.

Login to post a reply

Server time is: 2024-09-30 19:23:20
Your offset time is: 2024-09-30 19:23:20