mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-12 01:20:13 +03:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user