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?