| delorie.com/archives/browse.cgi | search |
| From: | "Damian Yerrick" <web DOT poison AT pineight DOT 8m DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Mouse Events Problem |
| Date: | Tue, 19 Oct 1999 18:31:51 -0500 |
| Organization: | Rose-Hulman Institute of Technology |
| Lines: | 43 |
| Sender: | AFSAUTH AT 137 DOT 112 DOT 205 DOT 146 |
| Message-ID: | <7uiv4d$6bq$1@solomon.cs.rose-hulman.edu> |
| References: | <7uitf2$qor$1 AT news8 DOT svr DOT pol DOT co DOT uk> |
| NNTP-Posting-Host: | 137.112.205.146 |
| X-Trace: | solomon.cs.rose-hulman.edu 940376013 6522 137.112.205.146 (19 Oct 1999 23:33:33 GMT) |
| X-Complaints-To: | news AT cs DOT rose-hulman DOT edu |
| NNTP-Posting-Date: | 19 Oct 1999 23:33:33 GMT |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hammy <darren AT grayce DOT freeserve DOT co DOT uk> wrote in message
news:7uitf2$qor$1 AT news8 DOT svr DOT pol DOT co DOT uk...
> Probably not the best newsgroup but heres my problem.
> Im trying to write an event manager for a mouse. The idea
> I have so far is this: i have created a structure that holds the
> coordinates of rectangles for which a mouse can click in a
> trigger an event. Also in the struct I have a byte for the button
Limit yourself to 128 buttons on screen? I'd use an int.
> that triggers the event, a byte for if the rectangle is active,
> and a pointer to a function(the code that is run when event is
> triggered).
So it'd look like this:
typedef struct ClickRect
{
struct ClickRect *prev;
struct ClickRect *next;
int (*triggerFunc)(int, int);
int buttonID;
char active;
} ClickRect;
> I have this structure as a linked list and have ordered it in
> active/disable, now, i can image this being rather slow the more events i
> have. So, does anyone know of the a better way to do this?
qsort() the rectangles by top coordinate and use a
bsearch().
hope this helps
--
Damian Yerrick
CM 398, Rose-Hulman Institute of Technology
5500 Wabash Ave
Terre Haute, IN 47803
http://come.to/yerrick
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |