delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/09/19:47:53

From: krand AT ican DOT net (Andrew Ellem)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Hiding mouse before drawing not working (Allegro)
Date: Sun, 08 Jun 1997 02:35:23 GMT
Organization: ACC TelEnterprises Ltd.
Lines: 33
Message-ID: <5nd5kn$63l$1@readme.ican.net>
References: <5ncmia$ees AT news DOT interlog DOT com>
Reply-To: krand AT ican DOT net
NNTP-Posting-Host: ppp-174.toronto-11.ican.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <5ncmia$ees AT news DOT interlog DOT com>, gautam AT interlog DOT com (Gautam N. Lad) wrote:
>Hi,
>I'm making a simple tile/map editor, and I've a grid setup.  When a user clicks
> on 
>a grid, I do the following (psuedo code): 
>
>if click is in range
> freeze_mouse_flag=TRUE; // Allegro extern variable for hiding/show mouse     
> tblit();  // blit the sprite/tile
> freeze_mouse_flag=FALSE;
>
>For some reason, this won't work!  The mouse hides, the bitmap gets drawn, and 
>the mouse becomes visible again.  The drawn bitmap still looks messed up,
> 'cause 
>the drawn bitmap looks like the mouse is still over it.
>
>What am I doing wrong?

You're not hiding the mouse cursor, you're only preventing it from moving.

Try:
    freeze_mouse_flag=TRUE; // Prevent the mouse from being moved
    show_mouse(NULL); // Tells allegro to not draw the mouse
    tblit();
    show_mouse(screen); // Tells allegro it can draw the mouse again
    freeze_mouse_flag=FALSE; // Let the mouse move again

You don't even need the freeze_mouse_*, but it doesn't hurt ;)

Hope this helps,

Andrew Ellem
krand at ican.net

- Raw text -


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