Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » flikkering bitmaps

This thread is locked; no one can reply to it. rss feed Print
flikkering bitmaps
felixh
Member #8,226
January 2007

Hello,
I'm a beginner in programming C and a totally beginner in programming allegro.
My problem is, when i want to render 2 bitmaps, the second seems to 'flikker'.
in one Frame it is Rendered, in the next it isn't rendered, then it is rendered again...
My code:

1void mainmenu() {
2 arrow = load_pcx("pic//arrow.pcx", palette);
3 BG_main = load_pcx("pic//menu//BG_main.pcx", palette);
4 newgame = load_tga("pic//menu//neuesspiel.tga", palette);
5 newgame_ = load_tga("pic//menu//neuesspiel_.tga", palette);
6
7 set_alpha_blender();
8 //set_write_alpha_blender();
9
10 while(!key[KEY_ESC])
11 {
12 draw_sprite(screen, BG_main, 0, 0); // hintergrund
13
14 if ((mouse_x > 350 && mouse_x < 650)&&(mouse_y > 100 && mouse_y < 200))
15 {
16 draw_trans_sprite(screen, newgame_, 350, 100); }
17 else { draw_trans_sprite(screen, newgame, 350, 100); }
18
19 show_mouse(screen);
20 }
21}

I tried to youse the GUI, but i don't understand it.

ps: sorry for my bad English

Archon
Member #4,195
January 2004
avatar

Look for tutorials that explain 'double buffering', it is the solution to your problem.

Kauhiz
Member #4,798
July 2004

Well, you shouldn't blit directly to the screen. Blit everything to another bitmap, then blit that bitmap to the screen. It's called double buffering, if you want to search for examples or something.

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

felixh
Member #8,226
January 2007

THX!!!

Go to: