Jump to content
  • Advertisement
Sign in to follow this  

Double Buffering Allegro Error source code provided

This topic is 3901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make my Street Fighter II clone with a double buffer to hopefully make the graphics go faster, but when I applied the double buffer my splash screen to my menu didn't work at all. In fact, it worked well without the double buffer. It went to splash screen wait 3 seconds, then it went to my draw menu screen. But with the double buffer it goes straight to the menu and no matter how long you wait it either doesn't show the splash screen at all, or shows it for a split second, and that is it. What am I doing wrong here? If I comment out the draw menu then the buffer draws the splash screen just fine, but if I don't comment it out the way I have my switch statement then the it doesn't draw the splash screen, but goes straight to my menu. What is wrong with my code?
#include <allegro.h>
#include <stdlib.h>
//Global variables
int gold, white;
BITMAP *bmp;
BITMAP *buffer = NULL;
BITMAP *plr_slct;
PALLETE pallete;

int gameflag;

//loading our files
void LoadFiles()
	gameflag = 0;
	bmp = load_bitmap("images/sf2_logo.bmp", pallete);
	if(!bmp) allegro_message("Could load file");


//The Splash screen.
void Splash()
	//define the color for our text
	gold = makecol(255, 255, 10);	
	white = makecol(255, 255, 255);

	//draw the splash creen 
	draw_sprite(buffer, bmp, 200, 100);
	textout_centre_ex(buffer, font, "U.S. Gold", 320, 220, gold, 0); 
	textout_centre_ex(buffer, font, "Creative Materials", 320, 230, gold, 0);
	textout_centre_ex(buffer, font, "Presentation", 320, 240, gold, 0);
	textout_centre_ex(buffer, font, "Street Fighter  II", 320, 250, gold, 0);
	textout_centre_ex(buffer, font, "Is a Reg. Trademark of Capcom USA INC.", 320, 260, white, 0);

//draw the menu of the game
void drawMenu()
	rectfill(buffer, 0, 0, SCREEN_W, SCREEN_H, 15);


int main(void)
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
	buffer = create_bitmap(640, 480);
	//Let's load some files needed.

	//initialize video mode to 640x480
	rectfill(buffer, 0, 0, SCREEN_W, SCREEN_H, 0);

	//while the game is going on!
		blit(buffer, screen, 0, 0, 0, 0, 640, 480);
				case 0:
					gameflag += 1;

				case 1:

	//end program
	return 0;


Please help me

Share this post

Link to post
Share on other sites
You never blit the buffer for the splash page to the screen. You're just drawing it to the buffer and waiting for three seconds.

Share this post

Link to post
Share on other sites
For those who are reading this I simply for got to se the color depth, and something else that was needed before calling the videomode. or I had call them after setting videomode which you can't do. Big no no. Either way everyone go to my bLeftTrigger get the_event.motion post

where i'm trying to use my xbox360 controller to control the mouse around on the screen, so I can make a tutorial putting XInput and SDL together, so no one else has to do what I've done for a straight 2 days.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!