Sfoglia il codice sorgente

Added getScreenEntityById and getScreenEntitiesByTag helper accessors to ScreenEntity

Ivan Safrin 12 anni fa
parent
commit
37266b8e9d

+ 3 - 0
Core/Contents/Include/PolyScreenEntity.h

@@ -190,6 +190,9 @@ class _PolyExport ScreenEntity : public Entity {
 		bool hasFocus;
 		
 		
+		ScreenEntity *getScreenEntityById(String id, bool recursive);
+		std::vector<ScreenEntity*> getScreenEntitiesByTag(String tag, bool recursive);
+		
 		/**
 		* If set to true, will block mouse events for underlaying entities.
 		* (NOTE: processInputEvents must be set to true)

+ 14 - 0
Core/Contents/Source/PolyScreenEntity.cpp

@@ -722,3 +722,17 @@ void ScreenEntity::adjustMatrixForChildren() {
 		}
 	}
 }
+
+ScreenEntity *ScreenEntity::getScreenEntityById(String id, bool recursive) {
+	return (ScreenEntity*)getEntityById(id, recursive);
+}
+
+std::vector<ScreenEntity*> ScreenEntity::getScreenEntitiesByTag(String tag, bool recursive) {
+	std::vector<Entity*> entities = getEntitiesByTag(tag, recursive);
+	std::vector<ScreenEntity*> retEntities;
+	for(int i=0; i < entities.size(); i++) {
+		retEntities.push_back((ScreenEntity*)entities[i]);
+	}
+	return retEntities;
+}
+