Mail Archives: djgpp/1999/02/23/13:51:49
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 -