Mail Archives: djgpp/1998/11/24/07:12:30
>> 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
- Raw text -