|
-
Jan 17th, 2001, 04:24 PM
#1
Thread Starter
Lively Member
Does anyone know how games such as Civ2 know when you click on one of their icons. Such as a settler.
THANKS
-
Jan 17th, 2001, 05:34 PM
#2
PowerPoster
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!!!)
-
Jan 17th, 2001, 08:41 PM
#3
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 18th, 2001, 04:06 PM
#4
Thread Starter
Lively Member
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
-
Jan 18th, 2001, 04:16 PM
#5
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|