Exemple #1
0
GUI::ProgressBar::ProgressBar( rString name, rString parent , Rectangle boundingBox ) :
	Object( name, parent, boundingBox )
{
	m_Background = SpriteDefinition( "", boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height, glm::vec4( 0.1f, 0.1f, 0.1f, 1.0f ) );
	m_Background.BorderSize = 1;
	
	m_Bar = SpriteDefinition( "", boundingBox.X + 1, boundingBox.Y + 1, boundingBox.Width - 2, boundingBox.Height - 2, glm::vec4( 0.1, 0.1, 0.7f, 1.0f ) );
	
	m_BarWidth = boundingBox.Width - 2;
	
	
}
SpriteData::SpriteData()
{
    // Load Sprite Definitions
    QDomDocument xmlSpriteData;
    QFile f1(QCoreApplication::applicationDirPath() + "/coinkiller_data/spritedata.xml");
    if (!f1.open(QIODevice::ReadOnly))
        return;
    xmlSpriteData.setContent(&f1);
    f1.close();

    QDomElement spriteElement = xmlSpriteData.documentElement().firstChild().toElement();
    while (!spriteElement.isNull())
    {
        spriteDefs.append(SpriteDefinition(spriteElement));

        spriteElement = spriteElement.nextSiblingElement();
    }

    // Load Sprite Views
    QDomDocument xmlSpriteViews;
    QFile f2(QCoreApplication::applicationDirPath() + "/coinkiller_data/spritecategories.xml");
    if (!f2.open(QIODevice::ReadOnly))
        return;
    xmlSpriteViews.setContent(&f2);
    f2.close();

    // Add "All (Sorted by Number)" View
    spriteView allView;
    allView.name = "All (Sorted by Number)";
    foreach (SpriteDefinition sprDef, spriteDefs)
    {
        allView.simpleSprites.append(sprDef.getID());
    }
SpriteDefinition GraphicsManager::GetSpriteDefinition(SpriteIdentifier index)
{
	for (size_t i = 0; i < _sprite_def.size(); i++)
	{
		if (_sprite_def[i].index == index)
			return _sprite_def[i];
	}
	return SpriteDefinition();
}
Exemple #4
0
	Window::Window( const rString& name, const rString& parent, Rectangle boundingBox , bool border ) :
		Object( name, parent, boundingBox )
	{
		m_Border = border;
		if( border )
		{
			m_BackgroundColour = glm::vec4( 0.0f, 0.0f, 0.0f, 0.5f );
			m_BorderColour = glm::vec4( 0.0f, 0.0f, 0.0f, 0.7f );

			m_Background = SpriteDefinition( "", 0, 0, boundingBox.Width, boundingBox.Height, m_BackgroundColour );
			m_Background.BorderSize = 1;
			m_Background.BorderColour = m_BorderColour;
		}
		
		m_IsWindow = true;
	}
Exemple #5
0
	TextBox::TextBox( const rString& name, const rString& parent, Rectangle boundingBox ) : 
		Object( name, parent, boundingBox )
	{
		m_TextDefinition = TextDefinition( "", boundingBox.X + 5, boundingBox.Y , boundingBox.Width, boundingBox.Height );
		m_TextDefinition.Alignment = ALIGNMENT_MIDDLE_LEFT;
		
		m_BackgroundColour = glm::vec4( 0.0f, 0.0f, 0.0f, 0.7f );
		m_BorderColour = glm::vec4( 0.2f, 0.2f, 0.2f, 0.7f );

		m_Background = SpriteDefinition( "", boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height, m_BackgroundColour );
		m_Background.BorderSize = 1;
		m_Background.BorderColour = m_BorderColour;

		m_Focused = false;
		
		m_InputStringID = g_TextInput.ReserveAndGetInputID();
	}