how to hide mouse pointer
raja peter

while i am file_select_ex() i am getting a default mouse cusor. How to hid it.

piccolo

try hidemouse();;)

Evert

Yes, that's very useful. What's the point in telling someone to try a function that doesn't exist?

Anyway, Allegro's dialog routines always display the mouse cursor, you cannot change that easily (there are workarounds, like removing the mouse driver before displaying the dialog). It's a bit easier if you're using your own dialog struct, in which case you can add a function to hide the mouse.
However, why do you want to do that? Navigating the file selection box is easier with the mouse than with the keyboard or gamepad. If you don't want to hide the mouse at all, but want to use your own cursor instead, use set_mouse_sprite().

Ceagon Xylas

He ment, "try show_mouse(NULL)"

But follow Evert's instructions.

raja peter

this is the code

set_mouse_sprite(img);
show_mouse(img);
scare_mouse();
while(1)
{
draw_sprite(screen,buf,0,0);
draw_sprite(buf,img22....
...
...
unscare_mouse();
file_select_ex();

}

where to put show_mouse()here.

Also tried scare and unscare. But didn't work.

what is the proper order of displaying?

Ceagon Xylas

Use the code tags. One mistake I noticed was you're drawing your buffer to the screen first... That needs to come last in your drawing operations.

while() {
  logic();
  
  draw_sprite(buffer,img22,...);
  blit(buffer,screen,0,0,0,0,buffer->w,buffer->h);
}

show_mouse(BITMAP*) tells allegro to draw the mouse to the specified bitmap (default is BITMAP *screen) So show_mouse(NULL), as I said earlier, should get rid of it. But you're unscaring the mouse right before you call file_select_ex(). This is exactly what you don't want to do.

while() {
...
  scare_mouse();
  file_select_ex();
  unscare_mouse(); //optional
}

Make sure you're not manually drawing the mouse to buffer or screen.

raja peter

I usually draw the mouse pointer using draw_sprite at mouse_x, mouse_y.

Because of not knowing the correct order of these drawings.

Since the file_select invoked the default mouse pointer extra, I wanted to use the alternative method to draw the invoked mouse with the cursor i use with draw_sprite and hide the one drawn using draw_sprite.

Thomas Fjellstrom
Quote:

set_mouse_sprite(img);
show_mouse(img);

Don't. Ever.

set_mouse_sprite sets the sprite/bitmap that ALLEGRO will use to draw the mouse. show_mouse sets the bitmap that ALLEGRO draws the mouse_sprite TO.

Quote:

Since the file_select invoked the default mouse pointer extra, I wanted to use the alternative method to draw the invoked mouse with the cursor i use with draw_sprite and hide the one drawn using draw_sprite.

There really isn't a way to draw a mouse cursor yourself while the file select dialog is being displayed. Allegro's gui dialogs run their own event loop, you won't be able to do anything else while they are displayed.

Matthew Dalrymple

How about show_mouse_to_elephant(); ... Oh wait.. we are trying to scare the mouse away.. not the elephant :-P

Thread #588552. Printed from Allegro.cc