All pastes #749456 Raw Edit

Stuff

public text v1 · immutable
#749456 ·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

SDL_Surface* f_load_bmp(const char* p_filename)
{
	SDL_Surface *v_image;

	printf("Attemping to load bitmap %s\n",p_filename);	
	v_image = SDL_LoadBMP(p_filename);
    	if (v_image == NULL)
    	{
        	printf("Unable to load bitmap %s : %s\n",p_filename, SDL_GetError());
        	return NULL;
    	}
	printf("Image Loaded Succesfully : %s\n",p_filename);
	return v_image;
}

SDL_Surface* f_init_screen()
{
	SDL_Surface *v_screen;

	printf("Attemping to initialize SDL Video\n");
	if (SDL_Init(SDL_INIT_VIDEO) != 0)
	{
        	printf("Unable to initialize SDL: %s\n", SDL_GetError());
        	return NULL;
    	}
	
	printf("Attemping to set the video mode\n");
	v_screen = SDL_SetVideoMode(1024, 768, 32, SDL_FULLSCREEN);
    	if (v_screen == NULL)
    	{
        	printf("Unable to set video mode: %s\n", SDL_GetError());
        	return NULL;
    	}
	printf("Video Mode set correctly at %dx%d\n",v_screen->w,v_screen->h);
	return v_screen;
}