|
vsynv() and mouse? |
count
Member #5,401
January 2005
|
I have a problem with my mouse cursor again. I have this peace of code: if (do_vsync == 1) vsync(); scare_mouse(); blit(temp, screen, 0,0,0,0,800,600); unscare_mouse(); If do_vsync is != 1 and no vsync() is done then it works fine. But if do_vsync = 1 then the mouse cursor will flicker at the TOP of the screen (don't know. Maybe 20 pixels of the top screen). This happens only at the top of the screen and when vsync is enabled. I searched for this problem and found out that spellcaster mentioned this problem in 2003 in this thread http://www.allegro.cc/forums/thread/240147#post_240147. The quistion was not solved in this thread. Is there no way to use allegros mouse functions when using vsync since allegro version 4.0.3 (beta1)?? So the mouse functions are useless if used together with vsync?
|
ReyBrujo
Moderator
January 2001
|
Actually, you should blit your mouse into the temp bitmap, like: if (do_vsync == 1) vsync(); show_mouse(temp); blit(temp, screen, 0,0,0,0,800,600); I have only used the scare functions inside dialogs. -- |
count
Member #5,401
January 2005
|
Hmm.. In a discussion in another thread we came to the point, that blitting the mouse somewere else then the screen is not a good idea. read it here: So I don't want to do that. If I HAVE TO blit the mousepointer to my buffer, then indeed the mouse functions of allegro where kind of pointless. No other solution?
|
Kitty Cat
Member #2,815
October 2002
|
Use a hardware/OS cursor. After setting it, you can check if it was actually enabled and just double buffer the pointer if not. -- |
count
Member #5,401
January 2005
|
How do I use a hardware/os cursor? Thanks!
|
Kitty Cat
Member #2,815
October 2002
|
It should "fix" the mouse problem, if the problem isn't that the mouse_x/y values get foobar'd. // At startup: enable_hardware_cursor(); show_mouse(screen); // Make sure a hardware cursor is set. if not, double // buffer the mouse if(!(gfx_capabilities&GFX_HW_MOUSE)) show_mouse(NULL); // In display loop, before blitting to screen: if(!(gfx_capabilities&GFX_HW_MOUSE)) draw_sprite(buffer, mouse_sprite, mouse_x, mouse_y);
-- |
count
Member #5,401
January 2005
|
Thank you very much! It did work. But I had to change GFX_HW_MOUSE to GFX_HW_CURSOR.
|
Kitty Cat
Member #2,815
October 2002
|
Yeah, sorry. I mistyped it even after looking at the docs. -- |
count
Member #5,401
January 2005
|
No problem.
|
|