www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/23/08:07:39

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE3584544@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Here is a tough question...... read on...
Date: Tue, 23 Feb 1999 13:05:40 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Clifford Roche writes:
> 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 don't understand the problem here: surely you can just look at the
values of mouse_x and mouse_y to see where on the screen it is? If
your problem is how to map a coordinate onto what object they clicked,
that really depends on how complex your objects are. The Allegro GUI
provides one very basic framework for this kind of thing. If you
divide your regions into boxes, it's very easy to check for a point
being in a rectangle. If the shapes are more complex, perhaps you
could use polygonal regions (see comp.graphics.algorithms FAQ for
polygonal testing algorithms). If the areas are really random kind
of shapes, maybe it would be better to just store a big lookup table
with an entry for every pixel on the screen, listing which object
is covering it.

> Also I have found that using an ESS AudioDrive card, whenever Allegro
> does an autodetect of my sound hardware it autodetects my OPL3 Adlib but
> doesn't work properly..... I am currently setting it to use my MPU401
> interface... it is much better anyway.

You always need to select the MPU driver manually, because it's 
unfortunately not possible to autodetect this interface (almost all
soundcards have one, but it isn't usually connected to a real output
device).


	Shawn Hargreaves.

- Raw text -


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