Main Page | Namespace List | Class List | File List | Class Members | File Members

video_basic.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   NGT (Neopontec Gaming Toolkit                                         *
00003  *   Distributed under the terms of the GNU LGPL License                   *
00004  *   Copyright (C) 2005 by Hector Blanco de Frutos                         *
00005  *   hectorblanco@neopontec.com                                            *
00006  *   Refer to the LICENSE file to read the full license agreement          *
00007  ***************************************************************************/
00008  
00009 
00010 
00011 #include "video_basic.h"
00012 
00013 void NGT_Surface::draw(SDL_Surface *surf){
00014         
00015         SDL_Rect destrect; 
00016     destrect.x = x; 
00017     destrect.y = y;
00018     //printf("*NGT_Surface.draw: x=%i, y=%i\n", x, y);
00019     SDL_BlitSurface(surface, NULL, surf, &destrect);
00020 }
00021 
00022 
00023 int NGT_Surface::LoadIMG(char *filename){
00024         surface=IMG_Load(filename);
00025         if (surface==NULL){
00026                 printf("*NGT_Surface.LoadIMG: ERROR Loading image file: '%s'\n",filename);      
00027                 return 1;
00028         }else{
00029                 // All gone OK
00030                 printf("*NGT_Surface.LoadIMG: Loaded image file: '%s'\n",filename);     
00031                 return 0;       
00032         }
00033 }
00034 
00035 
00036 // Independent functions
00037 // Load an image file
00038 SDL_Surface *NGT_SurfaceLoad(char* file)
00039 {
00040         return(IMG_Load(file));
00041 }    
00042 
00043 //Draw a surface to the screen surface
00044 void NNG_SurfaceDraw(SDL_Surface *screen, SDL_Surface *img, int x, int y)
00045 {
00046     SDL_Rect dest; 
00047     dest.x = x; 
00048     dest.y = y;  
00049     SDL_BlitSurface(img, NULL, screen, &dest); 
00050 }
00051 
00052 // Blit a portion of an image on the screen surface
00053 void NNG_SurfaceDraw(SDL_Surface *screen, SDL_Surface *img, int x, int y, int w, int h, int x2, int y2)
00054 {
00055   SDL_Rect dest;
00056   dest.x = x;
00057   dest.y = y;
00058   SDL_Rect dest2;
00059   dest2.x = x2;
00060   dest2.y = y2;
00061   dest2.w = w;
00062   dest2.h = h;
00063   SDL_BlitSurface(img, &dest2, screen, &dest);
00064 }

Generated on Sat Feb 4 10:15:16 2006 for Neopntec Gaming Toolkit - API reference by  doxygen 1.4.4