Show Tile.h syntax highlighted
/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG *
*Copyright (C) 2006, Tony Sparks *
* *
*This library is free software; you can redistribute it and/or *
*modify it under the terms of the GNU Lesser General Public *
*License as published by the Free Software Foundation; either *
*version 2.1 of the License, or (at your option) any later version. *
* *
*This library is distributed in the hope that it will be useful, *
*but WITHOUT ANY WARRANTY; without even the implied warranty of *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
*Lesser General Public License for more details. *
* *
*You should have received a copy of the GNU Lesser General Public *
*License along with this library; if not, write to the Free Software *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************************
*/
#pragma once
#include "ientity.h"
#include "event.h"
#include "../mmanager.h"
#include "../render/iview2d.h"
#include "../render/image.h"
#include "../render/irender.h"
#include "../shared/geom.h"
#include <string>
#include <map>
//struct Event;
//class IEntity;
/**
=================================
A tile on the map
=================================
*/
class Tile : public IView2D
{
public:
Tile();
Tile(Image* im, int r, int c) { m_image = im; m_row = r; m_col = c; };
/** Initialize the Tile */
int Init( Image* image);
/** Update the animation */
void Update(long dt);
/** Render the tile */
void Render( IRender *r );
/** Set the location of the tile */
void Set(int x, int y){ m_x = x; m_y = y; };
/** Set the Event that is associated with this tile
* Note there is only ONE tile ref, so we have a
* list of Events with a tile at a point. So when
* a tile is drawn at a point, we don't need multiple
* tiles and waste memory.
*/
void AddEvent( MPoint p, MEvent* evnt );
/** Trigger the event */
void Trigger( IEntity* triggerer, MPoint p );
AUTO_SIZE;
virtual ~Tile();
private:
// the image for this time
Image* m_image;
// row and column for the image
int m_row;
int m_col;
// events for each tile of this type
/** NOTE: Must make it std::pair because gives me weird compile errors
when using MPoint
*/
typedef std::map< std::pair<int, int>, MEvent*> type_Events;
type_Events m_events;
public:
int m_x;
int m_y;
int m_width;
int m_height;
};
See more files for this project here