Beispiel #1
0
void Background::draw()
{
	// Static background that does not scroll with the camera
	TheTextureManager::Instance().drawFrame(getTextureID(),
		0, 0, getWidth(), getHeight(), m_currentAnim.getCurrentFrame(),
		TheGame::Instance().getRenderer(), m_sdlFlip);
}
Beispiel #2
0
void FBO::bindTexture(int nAttachmentPoint) {
	GLuint tex_id = getTextureID(nAttachmentPoint);
	if(tex_id != -1) {
		glBindTexture(GL_TEXTURE_2D, tex_id); eglGetError();
	}
	else {
		printf("Cannot bind texture with attachment point: '%d'", nAttachmentPoint);
	}
}
Beispiel #3
0
void 
drawImage(e2dImage* image)  {
    Texture* tex = getTextureID(image->imagePath);
    unsigned int height = image->height == 0? tex->height:image->height;
    unsigned int width = image->width == 0? tex->width:image->width;
    glBindTexture(GL_TEXTURE_2D, tex->textureID);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0); glVertex2f(image->position.x, image->position.y + height);
    glTexCoord2f(1.0, 0.0); glVertex2f(image->position.x + width, image->position.y + height);
    glTexCoord2f(1.0, 1.0); glVertex2f(image->position.x + width, image->position.y);
    glTexCoord2f(0.0, 1.0); glVertex2f(image->position.x, image->position.y);
    glEnd();
    
    //drawAxis();
    //drawRect(image->element.bboxPosition, image->element.bboxWidth, image->element.bboxHeight);
}
Beispiel #4
0
void Icon::render() const
{
	Screen::drawGraphicsID(getAbsoluteRect(), getTextureID());
}
Beispiel #5
0
FileSystemPile *FileSystemActor::pileize()
{
	StrList dirListing;
	QString dirPath;
	vector<Actor *> objListing;
	FileSystemActor *obj = NULL;
	FileSystemPile *p = NULL;

	// Don't allow Piles to be created recursively
	if (isParentType(BumpPile))
	{
		MessageClearPolicy clearPolicy;
			clearPolicy.setTimeout(4);
		scnManager->messages()->addMessage(new Message("pileize_recPiles", QT_TR_NOOP("Sorry, Items within Piles cannot be viewed as Piles at this time.\nThis feature will be implemented in a later version of BumpTop"), Message::Ok, clearPolicy));
		return NULL;
	}

	// If this item has been pileized, then just return its pile
	if (pileizedPile)
	{
		return pileizedPile;
	}

	if (isFileSystemType(Folder))
	{
		// Get a Directory listing of this folder
		dirPath = getTargetPath();
		dirListing = fsManager->getDirectoryContents(dirPath);

		// Check if this Folder has anything in it
		if (dirListing.empty())
		{
			MessageClearPolicy clearPolicy;
				clearPolicy.setTimeout(4);
			scnManager->messages()->addMessage(new Message("pileize_emptyFolder", QT_TR_NOOP("This folder is empty, so it can't be expanded to a pile"), Message::Ok, clearPolicy));
			return NULL;
		}

		// Create a new Pile
		p = new FileSystemPile();
		if (p)
		{
			for (uint i = 0; i < dirListing.size(); i++)
			{
				obj =  FileSystemActorFactory::createFileSystemActor(dirListing[i]);

				// Create new Actors that represent each item in that directory
				// NOTE: we need to set the initial size of the object, since we try and sync the post it
				//		 in the setFilePath call, which means that it will try and fill to the dims of the
				//		 object, which, in it's default size, is not visible text-wise.
				if (_prevPileizedActorDims.contains(dirListing[i].toLower()))
					obj->setDims(Vec3(_prevPileizedActorDims.value(dirListing[i].toLower())));
				else
					obj->setDims(getDims());
				obj->setGlobalPose(getGlobalPose());
				obj->setFilePath(dirListing[i]);

				objListing.push_back(obj);
			}

			// Add items to this Pile
			for (uint i = 0; i < objListing.size(); i++)
			{
				p->addToPile(objListing[i]);
			}

			// Save and setup initial states
			p->setOwner(this);
			p->setText(getFullText());
			p->stack(getGlobalPosition());
			
			// set the icon to be this actor's 
			if (isFileSystemType(Folder))
				p->setTextIcon(getTextureID());

			// Create custom Animations
			for (uint i = 0; i < objListing.size(); i++)
			{
				objListing[i]->setAlphaAnim(0.0f, 1.0f, 15);
			}

			// Make this actor Non-existent
			this->hideAndDisable();

			// Finish up by setting the pile as the current selection
			pileizedPile = p;
			sel->remove((BumpObject *) this);
			sel->add((Pile *) p);

			textManager->invalidate();

			// record this pilization
			statsManager->getStats().bt.interaction.piles.pilized++;
			return p;
		}		
	}

	return NULL;
}