Results 1 to 5 of 5

Thread: Clicking

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    Does anyone know how games such as Civ2 know when you click on one of their icons. Such as a settler.

    THANKS

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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!!!)

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    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

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
  •  



Click Here to Expand Forum to Full Width