Keep it working on the map editor, maps can now be saved, i'll implement the loading next.

Changed a little bit how to load from memory packs.
Fixed some minor bugs on the UI.
And many things that i can't remember, i forgot to make a commit yesterday.
This commit is contained in:
spartanj
2011-06-09 03:37:26 -03:00
parent 05ef7cc0b8
commit a514d37b1d
46 changed files with 1287 additions and 199 deletions

View File

@@ -13,6 +13,7 @@ cObjectLayer::cObjectLayer( cMap * map, Uint32 flags, std::string name, eeVector
}
cObjectLayer::~cObjectLayer() {
DeallocateLayer();
}
void cObjectLayer::AllocateLayer() {
@@ -47,12 +48,48 @@ void cObjectLayer::Update() {
}
}
Uint32 cObjectLayer::GetObjectCount() const {
return mObjects.size();
}
void cObjectLayer::AddGameObject( cGameObject * obj ) {
mObjects.push_back( obj );
}
void cObjectLayer::RemoveGameObject( cGameObject * obj ) {
mObjects.remove( obj );
eeSAFE_DELETE( obj );
}
void cObjectLayer::RemoveGameObject( const eeVector2i& pos ) {
cGameObject * tObj = GetObjectOver( pos );
if ( NULL != tObj ) {
RemoveGameObject( tObj );
}
}
cGameObject * cObjectLayer::GetObjectOver( const eeVector2i& pos ) {
cGameObject * tObj;
register eeVector2f tPos;
register eeSize tSize;
for ( ObjList::reverse_iterator it = mObjects.rbegin(); it != mObjects.rend(); it++ ) {
tObj = (*it);
tPos = tObj->Pos();
tSize = tObj->Size();
if ( Contains( eeRecti( tPos.x, tPos.y, tPos.x + tSize.x, tPos.y + tSize.y ), pos ) )
return tObj;
}
return NULL;
}
cObjectLayer::ObjList& cObjectLayer::GetObjectList() {
return mObjects;
}
}}