All pastes #186665 Raw Edit

mirchiss

public cpp v1 · immutable
#186665 ·published 2006-09-30 09:08 UTC
rendered paste body
#include "SDLsidekick.h"int main( int argc, char* args[] ){  //Init function  init_SDL();    while (quit == false)      {       }return 0;}#ifdef SDL_VALUE_H_111#define SDL_VALUE_H_111//The headers#include "SDL/SDL.h"//EventSDL_Event event;//For ending programbool quit = false;//The attributes of the screenconst int SCREEN_WIDTH = 640;const int SCREEN_HEIGHT = 480;const int SCREEN_BPP = 32;//SurfacesSDL_Surface *screen = NULL;SDL_Surface *background = NULL;#endif#ifdef SDLSIDEKICK_H_111#define SDLsidekick_H_111#include "SDL_value.h"#include <windows.h>SDL_Surface *load_image( char filename[100] ) {    //Temporary storage for the image that's loaded    SDL_Surface* loadedImage = NULL;        //The optimized image that will be used    SDL_Surface* optimizedImage = NULL;        //Load the image    loadedImage = SDL_LoadBMP( filename );        //If nothing went wrong in loading the image    if( loadedImage != NULL )    {        //Create an optimized image        optimizedImage = SDL_DisplayFormat( loadedImage );                //Free the old image        SDL_FreeSurface( loadedImage );    }        //Return the optimized image    return optimizedImage;}void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination ){    //Make a temporary rectangle to hold the offsets    SDL_Rect offset;        //Give the offsets to the rectangle    offset.x = x;    offset.y = y;        //Blit the surface    SDL_BlitSurface( source, NULL, destination, &offset );}void init_SDL(){  //Set the window caption  SDL_WM_SetCaption( "", NULL );       //Initialize all SDL subsystems  if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )  {    //If there was in error in initializing SDL    MessageBox(NULL,"ERROR","SDL has failed to init",MB_OK);    quit = true;     }  //Set up the screen  screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );      //If there was in error in setting up the screen  if( screen == NULL )  {    MessageBox(NULL,"ERROR","Error setting video mode",MB_OK);    quit = true;      }}#endif