Hosting courtesy of Sourceforge

SourceForge Logo
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

EditorTile.cpp

Go to the documentation of this file.
00001 //
00002 //                                 EditorTile.cpp
00003 //                             -------------------
00004 //    begin                : Tue Mar 19 2002
00005 //    copyright           : (C) 2002 by Rob Renaud
00006 //    email                : rrenaud@eden.rutgers.edu
00007 //
00008 //   This program is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License as published by
00010 //   the Free Software Foundation; either version 2 of the License, or
00011 //   (at your option) any later version.
00012 //
00013 
00014 #include "EditorTile.h"
00015 
00016 using namespace Editor;
00017 
00018 EditorTile::EditorTile(Game::AbstractTile* t, int i) :
00019 tile(t),
00020 curIndex(i)
00021 { }
00022 
00023 EditorTile::~EditorTile() {
00024         if (tile != NULL) delete tile;
00025 }
00026 
00027 void EditorTile::drawAt(SDL_Surface* surf, SDL_Rect* rect) {
00028         if (tile != NULL) tile->drawAt(surf, rect);
00029 }
00030 
00031 void EditorTile::setAsTile(const TileSetEditor& ts, int index) {
00032         if (tile!= NULL) delete tile;   
00033         tile = ts.copyTile(index);
00034         curIndex = index;
00035 }
00036 
00037 void EditorTile::incrementTile(const TileSetEditor& ts) {
00038         curIndex = (curIndex + 1) % ts.numTiles();
00039         delete tile;
00040         tile = ts.copyTile(curIndex);
00041 }
00042 
00043 void EditorTile::decrementTile(const TileSetEditor& ts) {
00044         curIndex = (curIndex - 1) % ts.numTiles();
00045         if (curIndex < 0) curIndex = ts.numTiles() - 1;
00046         delete tile;
00047         tile = ts.copyTile(curIndex);
00048 }
00049 
00050 void EditorTile::reload(const TileSetEditor& ts) {
00051         delete tile;
00052         tile = ts.copyTile(curIndex);
00053 }
00054 
00055 int EditorTile::getIndex() const {
00056         return curIndex;
00057 }

Generated on Tue May 21 07:26:51 2002 for BomberLAN by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001