All pastes #749459 Raw Edit

Anonymous

public text v1 · immutable
#749459 ·published 2007-10-25 18:29 UTC
rendered paste body
#ifndef SDL_INCLUDES
#include <SDL/SDL.h>
#endif

#ifndef STD_INCLUDES
#include <stdio.h>
#include <stdlib.h>
#endif

#include "video.h"

int main()
{
    	// Variable Initialization
	SDL_Surface *screen;
    	SDL_Surface *image;
    	SDL_Rect src, dest;	
	
    	screen=f_init_screen();
	if (screen=NULL)
	{
		return 1;
	}
	
	// We unload SDL in case of quitting
	atexit(SDL_Quit);
	
	image = f_load_bmp("test_image.bmp");
	if (image == NULL)
	{
		return 1;
	}
	
	src.x = 0;
	src.y = 0;
	src.w = image->w;
	src.h = image->h;
	dest.x =  0;
	dest.y =  0;
	dest.w =  image->w;
	dest.h =  image->h;
	
	SDL_BlitSurface(image, &src, screen, &dest);
	
	/* Ask SDL to update the entire screen. */
	SDL_UpdateRect(screen, 0, 0, 0, 0);
	
	/* Pause for a few seconds as the viewer gasps in awe. */
	SDL_Delay(3000);
	
	/* Free the memory that was allocated to the bitmap. */
	// SDL_FreeSurface(image);
	
	printf("Bye!\n");	
	return 0;
}