Exemplo n.º 1
0
Image::Image(const char *filename): Widget(), m_color(Color::WHITE)
{
    Graphics::TextureBuilder b = Graphics::TextureBuilder::UI(filename);
    m_quad.Reset(new TexturedQuad(b.GetOrCreateTexture(Gui::Screen::GetRenderer(), "ui")));

    const Graphics::TextureDescriptor &descriptor = b.GetDescriptor();
    m_width = descriptor.dataSize.x*descriptor.texSize.x;
    m_height = descriptor.dataSize.y*descriptor.texSize.y;

    SetSize(m_width, m_height);
}
Exemplo n.º 2
0
Image::Image(Context *context, const std::string &filename, StretchMode stretchMode): Widget(context),
	m_stretchMode(stretchMode)
{
	Graphics::TextureBuilder b = Graphics::TextureBuilder::UI(filename);
	m_texture.Reset(b.GetOrCreateTexture(GetContext()->GetRenderer(), "ui"));

	const Graphics::TextureDescriptor &descriptor = b.GetDescriptor();
	m_initialSize = Point(descriptor.dataSize.x*descriptor.texSize.x,descriptor.dataSize.y*descriptor.texSize.y);

	Graphics::MaterialDescriptor material_desc;
	material_desc.textures = 1;
	m_material.Reset(GetContext()->GetRenderer()->CreateMaterial(material_desc));
	m_material->texture0 = m_texture.Get();
}
Exemplo n.º 3
0
void Image::InitTexture(const char* filename)
{
	Graphics::TextureBuilder b = Graphics::TextureBuilder::UI(filename);
	m_quad.Reset(new TexturedQuad(b.GetOrCreateTexture(Gui::Screen::GetRenderer(), "ui")));
}