|
Problems with mouse flicker |
cdxrd
Member #7,061
March 2006
|
Ok, been playing with this for a couple days now and I have the mouse working in my menu, but there is an awful flicker. All im doing is using double buffering. I read in the manual that you need to hide the mouse when drawing and then show it again when your done or 'bad stuff will happen' but this doesnt help. Im using a custom bitmap, it loads and displays ok. Here is some pseudo showing how Im doing it: show_mouse(screen); This causes a horrid flicker tho. Ive checked the exmouse example and they are using it the same way, except when they show their custom mouse cursor its not in a loop, it just waits for a readkey() . I've also tried showing the mouse on the buffer, and still got the flicker. Im tempted to just draw my cursor as a sprite and set x & y via the mouse_x & y instead of using allegros routines. |
spunit262
Member #5,545
February 2005
|
I alway use the hardwere mouse now to avoid that problem. |
Kitty Cat
Member #2,815
October 2002
|
Quote: I also think the hardwere mouse looks better, why isn't it the default? Because then the mouse mickeys won't work. But basically what you have to do is eith er use a hardware cursor, or double-buffer the mouse. Like so:
-- |
Evert
Member #794
November 2000
|
Quote: Because then the mouse mickeys won't work.
May not work as you expect. The mouse mickeys will work, but you won't get an infinate range of movement in, say, X11. |
cdxrd
Member #7,061
March 2006
|
Well, thanx for the help, I think I am going to do it like you suggested Kitty Cat. I was drawing the mouse as a sprite, I was trying to use allegro's routines: set_mouse_sprite(mouse_cursor); And using the scare, unscare(); But that way is giving way too much flicker, and I really dont want to use the hardware mouse, so displaying it as a sprite will probably be the easiest solution.. See how it is? The one time I go and do my reasearch and look it up in the manual and it turns out to be a horrid way of doing it.. =) |
Evert
Member #794
November 2000
|
Quote: I really dont want to use the hardware mouse Why? It's by far the best way of displaying the mouse if your OS supports it. Quote: The one time I go and do my reasearch and look it up in the manual and it turns out to be a horrid way of doing it Meaning? |
cdxrd
Member #7,061
March 2006
|
Meaning exactly what I said.. When I use allegro's mouse routines for a custom cursor, I get a horrid flicker, and nothing I have done so far is eliminating it. If I use the hardware cursor, will it still show me the custom cursor I have chosen or does it limit me to the stock OS default one? |
Kitty Cat
Member #2,815
October 2002
|
It will show the one you select, as long as the OS supports it (eg. isn't larger than 32x32 in Windows). Can't hurt to try.. it's only a few lines of code. -- |
Evert
Member #794
November 2000
|
Quote: If I use the hardware cursor, will it still show me the custom cursor I have chosen or does it limit me to the stock OS default one? There wouldn't be much point if all you could get were the default OS cursors. |
cdxrd
Member #7,061
March 2006
|
Even after enabling the hardware cursor, the flicker is just as horrid as before. So I just resorted to a good old standby. Move the sprite to Mouse_x & y.. No flicker, etc... Really no difference there except how its drawn, I'm still detecting clicks and setting my bounding boxes, only difference is I gotta remember to blit the cursor.. big deal. |
Evert
Member #794
November 2000
|
Quote: Even after enabling the hardware cursor, the flicker is just as horrid as before. Did you check you actually get a hardware cursor? Can you post your code? Quote: only difference is I gotta remember to blit the cursor.. big deal. The update rate of your on-screen mouse pointer is also limited to your framerate, and if you don't redraw frames unless things have changed (which is normally a good idea) it won't update either (basically forcing you to do the update whenever you can). |
|