Ejemplo n.º 1
0
void AssetList::showFolder(String folderPath) {

	currentFolderPath = folderPath;

	for(int i=0; i < assetEntries.size(); i++) {
		removeChild(assetEntries[i]);
		delete assetEntries[i];
	}
	assetEntries.clear();
	
	currentEntry = NULL;
	
	vector<OSFileEntry> assets = OSBasics::parseFolder(folderPath, false);	
	
	Number xPos = 20;
	Number yPos = 20;
	
	for(int i=0; i < assets.size(); i++) {
		OSFileEntry entry = assets[i];
		if(entry.type != OSFileEntry::TYPE_FOLDER) {
			if(hasExtension(entry.extension)) {
				AssetEntry *newEntry = new AssetEntry(entry.fullPath, entry.name, entry.extension);
				newEntry->selectShape->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
				assetEntries.push_back(newEntry);
				newEntry->setPosition(xPos, yPos);
				xPos += 120;
				if(xPos > 500) {
					xPos = 20;
					yPos += 100;
				}
				addChild(newEntry);
			}
		}
	}
	
	width = 640;
	
	if(xPos == 20) {
		height = yPos+20;
	} else {
		height = yPos + 120;	
	}

	
	bgShape->setShapeSize(width, height);
	bgShape->rebuildTransformMatrix();
	rebuildTransformMatrix();	
}
Ejemplo n.º 2
0
void AssetList::showFolder(String folderPath) {

	currentFolderPath = folderPath;

    clearList();
	
	vector<OSFileEntry> assets = OSBasics::parseFolder(folderPath, false);	
	
	Number xPos = 20;
	Number yPos = 30;
	
	for(int i=0; i < assets.size(); i++) {
		OSFileEntry entry = assets[i];
		if(entry.type != OSFileEntry::TYPE_FOLDER) {
			if(hasExtension(entry.extension)) {
				AssetEntry *newEntry = new AssetEntry(entry.fullPath, entry.name, entry.extension, NULL);
				newEntry->selectShape->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
				newEntry->selectShape->addEventListener(this, InputEvent::EVENT_DOUBLECLICK);
				assetEntries.push_back(newEntry);
				newEntry->setPosition(xPos, yPos);
				xPos += 120;
				if(xPos > 500) {
					xPos = 20;
					yPos += 100;
				}
				addChild(newEntry);
			}
		}
	}
	
	setWidth(640);
	
	if(xPos == 20) {
		setHeight(yPos+20);
	} else {
		setHeight(yPos + 120);
	}

	
	rebuildTransformMatrix();	
}
Ejemplo n.º 3
0
void AssetList::showResourcePool(ResourcePool *pool, int resourceFilter) {
	
    clearList();
    
	Number xPos = 20;
	Number yPos = 30;
	
    std::vector<Resource*> resources = pool->getResources(resourceFilter);
    
    String extension;
    
    if(resourceFilter == Resource::RESOURCE_MATERIAL ) {
        extension = "material_resource";
    } else if(resourceFilter == Resource::RESOURCE_SPRITE ) {
        extension = "sprite_resource";
    }
    
	for(int i=0; i < resources.size(); i++) {
        AssetEntry *newEntry = new AssetEntry(pool->getName(), resources[i]->getResourceName(), extension, resources[i]);
        newEntry->selectShape->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
        assetEntries.push_back(newEntry);
        newEntry->setPosition(xPos, yPos);
        xPos += 120;
        if(xPos > 500) {
            xPos = 20;
            yPos += 100;
        }
        addChild(newEntry);
	}
	
	setWidth(640);
	
	if(xPos == 20) {
		setHeight(yPos+20);
	} else {
		setHeight(yPos + 120);
	}
}