コード例 #1
0
ファイル: TextureBrowser.cpp プロジェクト: adlawren/Polycode
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();	
}
コード例 #2
0
ファイル: TextureBrowser.cpp プロジェクト: Eaneth/Polycode
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();	
}