DirectInput newie question

Hi,

After read some tutorials of DirectX 8 and see some code i have a question about DirectInput.
Suppose i have 4 cubes, then i hit a key or click a mouse button. I want to know if i click over one of the cubes, right? Well, how do i do that? As far as i know the way is store the key or mouse button somewhere (global variable maybe) and in the render of each object check if the area of click or the object selected is in my space. Is this the way? Is no other way to do that?

Now, what happen if i have 2 cubes, one behind the other. How i can detect which of them was selected? I suppose using the z coordinate and evaluates which is higher, maybe with a global variable that stores the max z value. Is that correct?

Bye

Comments

  • writing code to for stuff like that is all about checking. You will have to simply check the z order if you have a cube above the other. Plus if you are running a game loop (real-time loop) then checking game input every frame is probably the best way to see what is happening. Hope this helps.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion