peng3d/gui/__init__.py
def draw(self):
        """
        Draws the submenu and its background.
        
        Note that this leaves the OpenGL state set to 2d drawing.
        """
        # Sets the OpenGL state for 2D-Drawing
        self.window.set2d()
        
        # Draws the background
        if isinstance(self.bg,Layer):
            self.bg._draw()
        elif hasattr(self.bg,"draw") and callable(self.bg.draw):
            self.bg.draw()
        elif isinstance(self.bg,list) or isinstance(self.bg,tuple):
            self.bg_vlist.draw(GL_QUADS)
        elif callable(self.bg):
            self.bg()
        elif isinstance(self.bg,Background):
            # The background will be drawn via the batch
            if not self.bg.initialized:
                self.bg.init_bg()
                self.bg.redraw_bg()
                self.bg.initialized=True
        elif self.bg=="blank":
            pass
        else:
            raise TypeError("Unknown background type")
        
        # In case the background modified relevant state
        self.window.set2d()
        
        # Check that all widgets that need redrawing have been redrawn
        for widget in self.widgets.values():
            if widget.do_redraw:
                widget.on_redraw()
                widget.do_redraw = False
        
        # Actually draw the content
        self.batch2d.draw()
        
        # Call custom draw methods where needed
        for widget in self.widgets.values():
            widget.draw()
def draw(self):
        # Sets the OpenGL state for 2D-Drawing
        self.window.set2d()
        
        # Draws the background
        if isinstance(self.bg,Layer):
            self.bg._draw()
        elif hasattr(self.bg,"draw") and callable(self.bg.draw):
            self.bg.draw()
        elif isinstance(self.bg,list) or isinstance(self.bg,tuple):
            self.bg_vlist.draw(GL_QUADS)
        elif callable(self.bg):
            self.bg()
        elif isinstance(self.bg,Background):
            # The background will be drawn via the batch
            if not self.bg.initialized:
                self.bg.init_bg()
                self.bg.redraw_bg()
                self.bg.initialized=True
        elif self.bg=="blank":
            pass
        else:
            raise TypeError("Unknown background type")
        
        # In case the background modified relevant state
        self.window.set2d()
        
        # Check that all widgets that need redrawing have been redrawn
        for widget in self.widgets.values():
            if widget.do_redraw:
                widget.on_redraw()
                widget.do_redraw = False
        
        # Actually draw the content
        self.batch2d.draw()
        
        # Call custom draw methods where needed
        for widget in self.widgets.values():
            widget.draw()
def draw ( self ) : # Sets the OpenGL state for 2D-Drawing self . window . set2d ( ) # Draws the background if isinstance ( self . bg , Layer ) : self . bg . _draw ( ) elif hasattr ( self . bg , "draw" ) and callable ( self . bg . draw ) : self . bg . draw ( ) elif isinstance ( self . bg , list ) or isinstance ( self . bg , tuple ) : self . bg_vlist . draw ( GL_QUADS ) elif callable ( self . bg ) : self . bg ( ) elif isinstance ( self . bg , Background ) : # The background will be drawn via the batch if not self . bg . initialized : self . bg . init_bg ( ) self . bg . redraw_bg ( ) self . bg . initialized = True elif self . bg == "blank" : pass else : raise TypeError ( "Unknown background type" ) # In case the background modified relevant state self . window . set2d ( ) # Check that all widgets that need redrawing have been redrawn for widget in self . widgets . values ( ) : if widget . do_redraw : widget . on_redraw ( ) widget . do_redraw = False # Actually draw the content self . batch2d . draw ( ) # Call custom draw methods where needed for widget in self . widgets . values ( ) : widget . draw ( )
Draws the submenu and its background.
        
        Note that this leaves the OpenGL state set to 2d drawing.
Draws the submenu and its background . Note that this leaves the OpenGL state set to 2d drawing .