From 5648b3de73fc793307907ef93c6a3f8e1a736d21 Mon Sep 17 00:00:00 2001 From: Ivan Hernandez Date: Sun, 12 Jul 2009 16:27:15 -0500 Subject: [PATCH] Changed window size and removed stuff from main --- Game.cpp | 2 +- main.cpp | 148 --------------------------------------------------------------- 2 files changed, 1 insertion(+), 149 deletions(-) diff --git a/Game.cpp b/Game.cpp index 4bd9ca2..20518f5 100644 --- a/Game.cpp +++ b/Game.cpp @@ -12,7 +12,7 @@ Game::Game() : mCurrentLevel(0), mScreen(0) atexit (SDL_Quit); // Set 800x600 video mode - mScreen = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE | SDL_DOUBLEBUF); + mScreen = SDL_SetVideoMode(640, 468, 32, SDL_SWSURFACE); if (!mScreen) { printf ("Couldn't set 800x600 32b video mode: %s\n", SDL_GetError ()); exit (2); diff --git a/main.cpp b/main.cpp index c5b187e..a63b101 100644 --- a/main.cpp +++ b/main.cpp @@ -17,37 +17,6 @@ template string to_string(const T& t) os << t; return os.str(); } - -// Allocate a pointer to an SDL_Surface for the screen buffer -// and for the image we want to load and display on screen. -SDL_Surface *back = NULL; -SDL_Surface *screen = NULL; -SDL_Surface *image = NULL; - -//Sprite vikings1; -//Sprite vikings2; -//Sprite sun; - -vector SpriteList;//see about differnt containter HERE - -void DrawSprites() -{ - for(int i=0; iformat, 0, 0, 0); - SDL_FillRect (screen, NULL, color); - - // Set the image offset - SDL_BlitSurface(image, NULL, screen, &rect); - - // Flip the working image buffer with the screen buffer - SDL_Flip (screen); - - // Add a little pause... - SDL_Delay (1); -}*/ - -//blits whole image to specified location -void DrawIMG(SDL_Surface *img, int x, int y) -{ - SDL_Rect dest; - dest.x = x; - dest.y = y; - SDL_BlitSurface(img, NULL, screen, &dest); -} - -//blits the part of the image defined by x y w and h to the psecified position -void DrawIMG(SDL_Surface *img, int x, int y, - int w, int h, int x2, int y2) -{ - SDL_Rect dest; - dest.x = x; - dest.y = y; - SDL_Rect src; - src.x = x2; - src.y = y2; - src.w = w; - src.h = h; - SDL_BlitSurface(img, &src, screen, &dest); -} - -void DrawBG() -{ - DrawIMG(back, 0, 0); -} - -//-------------------------------------------------------------------// -// Function : init() - Params : none -// SDL Initialisation function -// Instead of having a heavy and loaded main function, all the -// setting up of our application is handled here - -bool init() -{ - return true; -} - - - -//-------------------------------------------------------------------// -// Function : draw() - Params : none -// Frame rendering function -// This function is called on every loop, to draw the scene -// It draws then swaps the work and screen buffer to display the scene -void DrawScene(SDL_Surface *screen) -{ - /*Tutorial 1 - Slock(screen); - for(int x=0;x<640;x++) - { - for(int y=0;y<480;y++) - { - DrawPixel(screen, x,y,y/2,y/2,x/3); - } - } - Sulock(screen); - */ - - Uint32 color; - - // Create a black background using the screen pixel format (32 bpp) - color = SDL_MapRGB (screen->format, 0, 0, 0); - SDL_FillRect (screen, NULL, color); - - //Draw BG - DrawBG(); - - /* - vikings1.clearBG(); - vikings2.clearBG(); - sun.clearBG(); - - vikings1.updateBG(); - vikings2.updateBG(); - sun.updateBG(); - - vikings1.draw(); - vikings2.draw(); - sun.draw(); - - //*/ - DrawSprites(); - - // Set the image offset (change to draw a set of passed images) - //DrawIMG(image,x,y); - - // Flip the working image buffer with the screen buffer - SDL_Flip (screen); - - // Add a little pause... - SDL_Delay (1); -} - - - //-------------------------------------------------------------------// // Function : main() - Params : argc, argv -- 2.11.0