Question about direct draw & surfaces

Started by
3 comments, last by alkirah 19 years, 10 months ago
Hi, i''m doing an Online Role Playing Game and I''m wondering if I could do something. i''ve search the net and didn''t found how to do it. I want to be able to know which directdraw7 surface my mouse is over. So if an item is on the ground, i wanna be able to put a palette on it to make it clearer and write a text up of the item. I have tons of more things to do with it but you should understand with it. If my mouse is over the item, I wanna know what is the surface just down the mouse. I''ve seen it in many games but I didn''t found how to do it on the internet...
Advertisement
Store the objects bounding box somewhere, and test if mouse is in that rectangle. After that you may do what ever you please with it.

Business is business and Moses is Moses
[Homesite]
Hi, thx for the answer, it is not a bad idea but what about if I have a colorkey? is it possible to get only pixels that are blittered on the screen buffer?

so If I have 2 items at the same pos, I would be able to select either 1 of the other if they r not identicly of the same shape ...?
Do you mean that you have a sprite with hole in it (due to transparency/colorkeying) and you want to select the other sprite that can be seen through that hole?

If that''s the case, I''ve got no good idea. Some sort of pixel level testing, but that goes a bit too complex...?

Business is business and Moses is Moses
[Homesite]
Yes, it is exactly this Miksan, i know it is a lot more tricky but I was wondering if there is a function that come with DirectX that would return a ptr or wathever that could be useful to get it like LPDIRECTDRAWSURFACE7 * getsurfaceundermouse(int x, int y) or if someone have already done something similar that can paste a little exemple on how it could be done ...

If not, i''ll have to go with what u say first ... saving my rect used to draw sprite and do a mouse check ...

This topic is closed to new replies.

Advertisement