Message-ID: <19981124121217.3615.qmail@hotmail.com> X-Originating-IP: [195.44.9.66] From: "a j" To: djgpp AT delorie DOT com Subject: RE: More help with Allegro (mouse on border) MIME-Version: 1.0 Content-Type: text/plain Date: Tue, 24 Nov 1998 04:12:17 PST Reply-To: djgpp AT delorie DOT com >> I'm using DJGPP & Allegro and am currently trying to code a puzzle >> game. The main screen is comprised of a 9x9 sprite grid. I have a >> way to access all of the coordinates, but I'm still wondering how to >> get the program to check when the cursor is at a border of the screen. > >int OnBorder(int x_mouse, int y_mouse) >{ > if(x_mouse == 0) return 1; /* Left Border */ > if(x_mouse == SCREEN_W) return 2; /* Right Border */ > if(y_mouse == 0) return 3; /* Top Border */ > if(y_mouse == SCREEN_H) return 4; /* Bottom Border */ > return 0; >} this code will not work as SCREEN_W is one more than the mouse will go to. > >This is one easy way of doing it. If the function returns 0, then no border >is touched by the mouse. If 1, then left border, 2 then right border etc. > >This is a very simple method and there are far more elegant ways of doing >it. > >James Arthur - jaa AT arfa DOT clara DOT net >http://www.arfa.clara.net/james/ >ICQ#15054819 > > ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com