delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/08/08:38:51

Newsgroups: comp.os.msdos.djgpp
From: tob AT world DOT std DOT com (Tom Breton)
Subject: Re: Hiding mouse before drawing not working (Allegro)
Message-ID: <EBFq9D.3y4@world.std.com>
Organization: The World Public Access UNIX, Brookline, MA
References: <5ncmia$ees AT news DOT interlog DOT com>
Date: Sun, 8 Jun 1997 02:15:13 GMT
Lines: 41
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 N. Lad <gautam AT interlog DOT com> wrote:
>
>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.
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^

That is exactly the condition that you can't use that flag for. It will prevent
mouse movements from being drawn, but does not hide the mouse. If the mouse
is *on* the area you are drawing, use show_mouse( NULL ); show_mouse( screen );

In C++, try using this class (From my own Allegro-helper header)

#if !defined alleg_mouse_unused                               
extern  BITMAP    * _mouse_screen;  //For now, from internal.h
struct                                                        
hold_that_mouse                                               
    {                                                         
    hold_that_mouse( void )                                   
        :   old_mouse_screen( _mouse_screen )                 
        { show_mouse( NULL ); };                              
                                                              
    ~hold_that_mouse( void )                                  
        { show_mouse( old_mouse_screen ); };                  
                                                              
    BITMAP    * old_mouse_screen;                             
    };                                                        
                                                              
    const int mouse_left_button  = 0x01;                      
    const int mouse_right_button = 0x02;                      
                                                              
#endif  /*  !defined alleg_mouse_unused */                    

	Tom

- Raw text -


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