| www.delorie.com/archives/browse.cgi | search |
| From: | "Icehot" <max133 AT chalktv DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| References: | <cPb64.12704$uj2 DOT 348729 AT newscontent-01 DOT sprint DOT ca> <MPG DOT 12c3107b3dc38e0b9896dd AT news DOT cso DOT uiuc DOT edu> |
| Subject: | Re: Allegro mouse routines... Code probs |
| Lines: | 50 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2615.200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200 |
| Message-ID: | <Qih64.13192$uj2.360806@newscontent-01.sprint.ca> |
| Date: | Thu, 16 Dec 1999 21:34:50 -0800 |
| NNTP-Posting-Host: | 149.99.114.83 |
| X-Complaints-To: | abuse AT sprint DOT ca |
| X-Trace: | newscontent-01.sprint.ca 945398064 149.99.114.83 (Thu, 16 Dec 1999 21:34:24 EST) |
| NNTP-Posting-Date: | Thu, 16 Dec 1999 21:34:24 EST |
| Organization: | Sprint Canada Inc. |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hehe, thanks. Code optimazation isn't one of my virtues. Oh, if you ever
want
to show off unoptimized code, just post and I'll give you some.
--
Max AKA Icehot
http://move.to/gametek -- A Great C/C++ Programming Resource
---------------------------------------------------
"Don't try to be like Jackie. There is only one Jackie... Study computers
instead."
- Jackie Chan
Peter Johnson <locke AT mcs DOT net> wrote in message
news:MPG DOT 12c3107b3dc38e0b9896dd AT news DOT cso DOT uiuc DOT edu...
> In article <cPb64.12704$uj2 DOT 348729 AT newscontent-01 DOT sprint DOT ca>,
> max133 AT chalktv DOT com says...
> > for (mx==x1; mx<x2; mx++)
> > {
> > for (my==y1; my<y2; my++)
> > {
> > if ((mouse_x==mx) && (mouse_y==my) )&& (mouse_b & 1))
> > {
> > newgame();
> > }
> > }
> > }
>
> Instead of this, why not the following:
>
> if ((mouse_x < x2) && (mouse_x > x1) &&
> (mouse_y < y2) && (mouse_y > y1) &&
> (mouse_b & 1))
> newgame();
>
> Looping through the entire coordinate range is wasteful.
>
> Also, a better way to do this test would be in a mouse callback instead
> of polling, but that's another topic entirely.. :)
>
> --
> Peter Johnson locke AT mcs DOT net
> :Windows: Where do you want to go today?
> :Linux: Where do you want to go tomorrow?
> :FreeBSD: Are you guys coming or what?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |