delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/24/11:32:24.1

Message-Id: <199811241632.QAA06406@remus.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: More help with Allegro (mouse on border)
Date: Tue, 24 Nov 1998 16:31:08 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <19981124121217.3615.qmail@hotmail.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
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.

D'Oh! :-)

James Arthur - jaa AT arfa DOT clara DOT net
http://www.arfa.clara.net/james/
ICQ#15054819



- Raw text -


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