text.build(part, geom, first_row, cache);
else if(part.get_name()=="cursor")
{
- if(!text_part || !part.get_graphic(state))
+ const Graphic *graphic = part.get_graphic(state);
+ if(!text_part || !graphic)
{
cache.texture = 0;
return;
Geometry rgeom = text.coords_to_geometry(*text_part, geom, first_row, row, col);
- cache.texture = part.get_graphic(state)->get_texture();
+ cache.texture = graphic->get_texture();
cache.clear_mesh();
GL::MeshBuilder bld(*cache.mesh);
bld.matrix() *= GL::Matrix::translation(rgeom.x, rgeom.y, 0);
- part.get_graphic(state)->build(part.get_geometry().w, part.get_geometry().h, bld);
+ graphic->build(part.get_geometry().w, part.get_geometry().h, bld);
}
}
{
if(part.get_name()=="slider")
{
+ const Graphic *graphic = part.get_graphic(state);
+ if(!graphic)
+ return;
+
Alignment align = part.get_alignment();
if(max>min)
align.x = (value-min)/(max-min);
GL::MeshBuilder bld(*cache.mesh);
bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0);
- part.get_graphic(state)->build(pgeom.w, pgeom.h, bld);
+ graphic->build(pgeom.w, pgeom.h, bld);
}
}
Part::Part(const string &n):
name(n)
{
- for(unsigned i=0; i<N_STATES_; ++i)
- graphic[i] = 0;
+ fill(graphic, graphic+N_STATES_, static_cast<Graphic *>(0));
}
const Graphic *Part::get_graphic(State state) const
{
if(part.get_name()=="slider")
{
+ const Graphic *graphic = part.get_graphic(state);
+ if(!graphic)
+ return;
+
Alignment align = part.get_alignment();
if(max>min)
align.y = (value-min)/(max-min);
GL::MeshBuilder bld(*cache.mesh);
bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0);
- part.get_graphic(state)->build(pgeom.w, pgeom.h, bld);
+ graphic->build(pgeom.w, pgeom.h, bld);
}
}