Re: [AD] Don't use Devpaks

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


The manual (https://www.allegro.cc/manual/4/api/mouse-routines/show_mouse) says to call show_mouse(NULL) before destroying a bitmap that the mouse is shown on.

 

From: Allegro-developers [mailto:allegro-developers-bounces@xxxxxxxxxx] On Behalf Of Andrew Robinson
Sent: May 9, 2016 6:50 PM
To: allegro-developers@xxxxxxxxxx
Subject: Re: [AD] Don't use Devpaks

 

On 5/9/2016 at 5:40 AM, Peter Hull <peterhull90@xxxxxxxxxx> wrote: 

Hi again,

That code didn't crash for me on Linux, but it maybe something mouse-related. See the docs for show_mouse (http://liballeg.org/stabledocs/en/alleg004.html#show_mouse). Also, remember to call set_gfx_mode(GFX_TEXT, 0,0,0,0); at the end, and, in updateScreen, you'd be better with a blit than a draw_sprite (blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h);)

Hope that helps,

If I comment out the show_mouse(buffer) function, the program will close without crashing, but then I have an invisible mouse cursor. I am using the example code from the Allegro website (http://www.cppgameprogramming.com/cgi/nav.cgi?page=allegmouse), so I am having a problem with finding accurate instructions.

 

I carefully looked at the program and the code, and I see a problem, I just don't know what it is:

 

It seems to me that show_mouse(buffer) should display a cursor that is the same filled circle it is drawing, but instead I have the system cursor. When I click on the screen, it draws the filled circle where the cursor is located, but then the cursor disappears until I move the mouse again. So I just guessed that the problem is with Allegro not supporting a software cursor for some reason (clearly neither the example code nor I did a check for errors), so I substituted show_os_cursor(MOUSE_CURSOR_ARROW) and now it works perfectly.

 

But I still want to know why it didn't work to begin with. I think a function to release the mouse or something like that is missing from updateScreen(). What do you think?

 

 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/