www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/23/13:51:49

From: ChrHenz AT aol DOT com
Message-ID: <dc1663b1.36d2e73f@aol.com>
Date: Tue, 23 Feb 1999 12:37:03 EST
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Here is a tough question...... read on...
X-Mailer: AOL 3.0.i for Windows 95 sub 66
Reply-To: djgpp AT delorie DOT com

In einer eMail vom 23.02.99 05:45:18 MEZ, schreiben Sie:

> And I am writing a game that requires the program to know where on the
>  screen the mouse is clickiong. There will be an image loaded onto the
>  screen, and by clicking on different parts you goto different places....
>  but how do I get the conputer to recognize where the mouse is clicking
>  (in less than 10000 lines of source) . I have already found away, but
>  the souce is hundreds upon hundreds of lines long to do that .. there
>  must be another way. Could someone please let me know.

You could make a 'grid' for you bitmap (for example 16*16 pixel sqares) and
then do something like mouse_x/16, mouse_y/16 to get the coordinates of the
sqare the cursor is in... If you need more 'precision', you could make a mask
of your bitmap (I think some graphical adventures work that way). Redraw that
bitmap but with only one color for each different object... when there is a
mouse-click on the bitmap, just transfer the coordinates to the mask and see
which color (object) is clicked on...

Christian.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019