vehicletypeimage.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  ***************************************************************************/
00009 
00010 #include <pgdraw.h>
00011 
00012 #include "vehicletypeimage.h"
00013 
00014 #include "../typen.h"
00015 #include "../player.h"
00016 #include "../vehicletype.h"
00017 
00018 #include <pgapplication.h>
00019 
00020 VehicleTypeImage::VehicleTypeImage( PG_Widget* parent, const PG_Point& pos, const VehicleType* vehicletype, const Player& owningPlayer )
00021    : PG_Widget( parent, PG_Rect( pos.x, pos.y, fieldsizex, fieldsizey )),
00022                 vt( vehicletype ), player( owningPlayer )
00023 {
00024    
00025 }
00026 
00027 
00028 Surface VehicleTypeImage::clippingSurface;
00029 
00030 void VehicleTypeImage::display( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst )
00031 {
00032    if ( !getClippingSurface().valid() )
00033       getClippingSurface() = Surface::createSurface( fieldsizex + 10, fieldsizey + 10, 32, 0 );
00034 
00035    getClippingSurface().Fill(0);
00036 
00037    vt->paint( getClippingSurface(), SPoint(5,5), player.getPlayerColor(), 0 );
00038    PG_Draw::BlitSurface( getClippingSurface().getBaseSurface(), PG_Rect( src.x + 5, src.y + 5, src.w, src.h), surface, dst);
00039 }
00040 
00041 void VehicleTypeImage::eventBlit ( SDL_Surface * surface, const PG_Rect & src, const PG_Rect & dst )
00042 {
00043    display( PG_Application::GetScreen(), src, dst );
00044 };
00045 

Generated on Mon May 21 01:26:39 2012 for Advanced Strategic Command by  doxygen 1.5.1