Skip to main content
gamedev.net
🔒 Locked

Please Help me.

Started by pcman Apr 30, 2004 at 1:17 AM 3 replies 300+ views
Original Post
pcman
pcman
I''m new in DDraw. I got a question. How to select an object with mouse left-click in DDraw ? thank you.
RuneLancer
RuneLancer
The short answer is "it depends on how you handle stuff in your program."

Unfortunatly for you, it''s also the long answer right now.

How does your program work? What kind of objects do you mean? Are you talking about sprites, for instance? Or tiles? Either way, you''d probably want to do something like setting a "selected" flag on or off depending on what you click on. It''s really hard to give you a proper answer without knowing what it is you want to do in more details, frankly.
BriTeg
BriTeg
quote:
Original post by pcman
I''m new in DDraw. I got a question.

How to select an object with mouse left-click in DDraw ?



By writing a lot of code.

You''ll need to keep track of the locations of everything you blit to the screen - a structure containing each drawn item (its original surface and location on that surface - i.e. where it''s being blitted *from*) and its current bounding box (where it is being blitted *to*). Then when the user clicks the mouse, you retrieve the coordinates, and compare against all the bounding boxes of all items on the screen that you''ve been keeping track of.

Brianmiserere nostri <font color=#BC
pcman
pcman
quote:
Original post by BriTeg
quote:
Original post by pcman
I''m new in DDraw. I got a question.

How to select an object with mouse left-click in DDraw ?



By writing a lot of code.

You''ll need to keep track of the locations of everything you blit to the screen - a structure containing each drawn item (its original surface and location on that surface - i.e. where it''s being blitted *from*) and its current bounding box (where it is being blitted *to*). Then when the user clicks the mouse, you retrieve the coordinates, and compare against all the bounding boxes of all items on the screen that you''ve been keeping track of.





But, Starcraft of Blizzard use same detectiongs ?
It runs well on the Pentium MMX CPU.


Hedos
Hedos
quote:
Original post by pcman
But, Starcraft of Blizzard use same detectiongs ?
It runs well on the Pentium MMX CPU.


Having to check for some bounding boxes when the user click is really not a big deal even for small CPUs

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.