throw hierarchy_error("not an ancestor");
}
+void Widget::map_coords_to_root(int &x, int &y) const
+{
+ for(const Widget *w=this; w; w=w->get_parent())
+ {
+ const Geometry &wgeom = w->get_geometry();
+ x += wgeom.x;
+ y += wgeom.y;
+ }
+}
+
void Widget::set_parent(Container *p)
{
if(parent && p)
if(!style)
throw logic_error(format("Attempt to render a widget with null style (class=\"%s\", style_name=\"%s\")", get_class(), style_name));
+ static const GL::Tag texture_tag("ui_tex");
+
GL::Renderer::Push _push(renderer);
- renderer.transform(GL::Matrix::translation(geom.x, geom.y, 0));
+ int x = 0;
+ int y = 0;
+ map_coords_to_root(x, y);
+ renderer.set_matrix(GL::Matrix::translation(x, y, 0));
const PartCache::PartList &parts = part_cache.get_parts();
for(PartCache::PartList::const_iterator i=parts.begin(); i!=parts.end(); ++i)
{
if(i->mesh && i->texture)
{
- renderer.set_texture(i->texture);
+ renderer.set_texture(texture_tag, i->texture, &style->get_sampler());
i->mesh->draw(renderer);
}
else if(i->part)