Bmp flicker, noob question
Nelson Cole

For some reason I've got this flicker on my mouse pointer, I'm not for sure why everything else draw to the screen seems to be perfectly fine. The following code is all located in the main loop, with the latter in the while. Maybe you can tell me what I've done wrong, thanks.

// Load the custom mouse pointer
BITMAP *reticle = load_bitmap("reticle.bmp", NULL);
set_mouse_sprite(reticle);
set_mouse_sprite_focus(reticle->w/2,reticle->h/2);
show_mouse(screen);

// Blit the double buffer 
vsync();
acquire_screen();
blit(buffer, screen, 0, 0, 0, 0, WIDTH-1, HEIGHT-1);
release_screen();

Ceagon Xylas

You're drawing the mouse to the screen, not the buffer. Draw it to the buffer and then draw the buffer on the screen like you're already doing.

show_mouse(buffer);
or

show_mouse(NULL); //not sure if you're allowed to use this line...

while(game_loop) {
  draw_spirte(buffer,mouse_sprite,mouse_x,mouse_y);
}

CosmicR

you can still show the mouse to the screen, but you have to hide it first before blitting the buffer.

ie

hidemouse
blit buffer to screen
showmouse

Nelson Cole

Yo guys thanks, i got it working.

Kitty Cat

Don't use show_mouse on the buffer. It's not safe, and just wastes the CPU by redrawing a lot when it'll never show. Use the show_mouse(NULL) and draw_sprite method.

Thread #573845. Printed from Allegro.cc