The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
684 B
30 lines
684 B
1 year ago
|
#include "Map.h"
|
||
|
|
||
|
void TileGroup::InsertTile(TileRenderData tile){
|
||
|
if(tiles.size()==0){
|
||
|
range={tile.pos,{24,24}};
|
||
|
}
|
||
|
tiles.push_back(tile);
|
||
|
if(tile.pos.x<range.pos.x){
|
||
|
range.pos.x=tile.pos.x;
|
||
|
range.size.x+=range.pos.x-tile.pos.x;
|
||
|
}
|
||
|
if(tile.pos.x+24>range.pos.x+range.size.x){
|
||
|
range.size.x+=(tile.pos.x+24)-(range.pos.x+range.size.x);
|
||
|
}
|
||
|
if(tile.pos.y<range.pos.y){
|
||
|
range.pos.y=tile.pos.y;
|
||
|
range.size.y+=range.pos.y-tile.pos.y;
|
||
|
}
|
||
|
if(tile.pos.y+24>range.pos.y+range.size.y){
|
||
|
range.size.y+=(tile.pos.y+24)-(range.pos.y+range.size.y);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
geom2d::rect<int>TileGroup::GetRange(){
|
||
|
return range;
|
||
|
}
|
||
|
|
||
|
std::vector<TileRenderData>&TileGroup::GetTiles(){
|
||
|
return tiles;
|
||
|
}
|