Esempio n. 1
0
    def render(self):
        soya.DEFAULT_MATERIAL.activate()

        if self._changed != self._font._pixels_height:
            self._font.create_glyphs(self._text)

            opengl.glNewList(self._display_list.id, opengl.GL_COMPILE_AND_EXECUTE)
            self.build_display_list()
            opengl.glEndList()
            self._changed = self._font._pixels_height
        else:
            opengl.glCallList(self._display_list.id)
Esempio n. 2
0
 def render(self):
   if self.tree.render_y >= self.tree.render_y2: return
   
   if self.tree.render_y >= self.tree.render_y1 - self.height:
     if self.selected:
       soya.gui.widgets.STYLE.rectangle(-1, -1, self.tree.visible_width, self.height - 3, self.highlight or self.tree.focus)
       
     if soya.gui.widgets.STYLE.char_height < self.icon_height:
       y0 = (self.icon_height - soya.gui.widgets.STYLE.char_height) // 2
     else: y0 = 0
     
     if self.is_expandable():
       if self.expanded:
         soya.gui.widgets.STYLE.triangle(3, self.x, y0, self.x + soya.gui.widgets.STYLE.char_height, y0 + soya.gui.widgets.STYLE.char_height, self.highlight)
       else:
         soya.gui.widgets.STYLE.triangle(1, self.x, y0, self.x + soya.gui.widgets.STYLE.char_height, y0 + soya.gui.widgets.STYLE.char_height, self.highlight)
         
     if self.material:
       x1 = self.x + soya.gui.widgets.STYLE.char_height + 4
       x2 = x1 + self.icon_width
       self.material.activate()
       if self.material.is_alpha(): opengl.glEnable(opengl.GL_BLEND)
       opengl.glBegin   (opengl.GL_QUADS)
       opengl.glTexCoord2f(0.0, 0.0); opengl.glVertex2i(x1, 0)
       opengl.glTexCoord2f(0.0, 1.0); opengl.glVertex2i(x1, self.icon_height)
       opengl.glTexCoord2f(1.0, 1.0); opengl.glVertex2i(x2, self.icon_height)
       opengl.glTexCoord2f(1.0, 0.0); opengl.glVertex2i(x2, 0)
       opengl.glEnd()
       soya.DEFAULT_MATERIAL.activate()
       
     opengl.glColor4f(*soya.gui.widgets.STYLE.text_colors[self.highlight])
     if self.changed != self.tree.font._pixels_height:
       self.tree.font.create_glyphs(self.text)
       
       opengl.glNewList(self._display_list.id, opengl.GL_COMPILE_AND_EXECUTE)
       self.tree.font.draw(self.text, self.x + soya.gui.widgets.STYLE.char_height + 8 + self.icon_width, y0)
       opengl.glEndList()
       self._changed = self.tree.font._pixels_height
     else:
       opengl.glCallList(self._display_list.id)
       
   self.tree.render_y += self.height
   opengl.glTranslatef(0.0, self.height, 0.0)
   
   if self.expanded:
     for child in self.children: child.render()