Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » how to hide mouse pointer

This thread is locked; no one can reply to it. rss feed Print
how to hide mouse pointer
raja peter
Member #7,835
October 2006

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

luv,

raja

piccolo
Member #3,163
January 2003
avatar

try hidemouse();;)

wow
-------------------------------
i am who you are not am i

Evert
Member #794
November 2000
avatar

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
Member #5,495
February 2005
avatar

He ment, "try show_mouse(NULL)"

But follow Evert's instructions.

raja peter
Member #7,835
October 2006

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?

luv,

raja

Ceagon Xylas
Member #5,495
February 2005
avatar

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
Member #7,835
October 2006

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.

luv,

raja

Thomas Fjellstrom
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Matthew Dalrymple
Member #7,922
October 2006
avatar

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

=-----===-----===-----=
I like signatures that only the signer would understand. Inside jokes are always the best, because they exclude everyone else.

Go to: