Click to See Complete Forum and Search --> : Clicking
Allanon
Jan 17th, 2001, 03:24 PM
Does anyone know how games such as Civ2 know when you click on one of their icons. Such as a settler.
THANKS
Fox
Jan 17th, 2001, 04:34 PM
I never played CIV but I suppose they use DInput to get the input, so after catching the MouseDown event they check if there's a control under the cursor and call it's MouseDown function they made... note that this games are made in C/C++ so they can just call the MouseDown events and -depending on the control- run other functions.. class inheritance :) (sucks in VB!!!)
kedaman
Jan 17th, 2001, 07:41 PM
DInput get's you the cursor position and mouse status, If you don't wan't to go into DX then you could do the same with API's, Getasynckeystate or Getkeyboardstate will read the mouse states for Keycode 1 2 and 3 or something like that, Getcursorpos returns a pointapi for the cursor position. The form has a mousedown even too... Civ2 has a plane iso tiled map, and i suppose it has it's functions to convert between screen pixels and isometrical coordinates, which will depend also on the map offset it's displayed at.
Allanon
Jan 18th, 2001, 03:06 PM
Yes, I know about getting the mouse's cordinates and DX, I am also using C++. But I want to know is HOW the program knows that you clicked on one of the guys. And not somewhere else.
thanks
kedaman
Jan 18th, 2001, 03:16 PM
There's an algoritm for everything, if there's one to plot it on the screen, there's one to know if it was clicked. Ask microprose if you want to get the exact one.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.