Example #1
0
    def __init__(self, behavior, pos=(0,0,0)):
        """Create the emitter.
           behavior must be the behavior class (not instance) that will control how the emitter and particles will behave
           pos must be a three-part tuple of the position of the emitter"""
        BaseSceneObject.__init__(self)

        self.pos = pos
        self.behavior = behavior(self)
        self.particles = numpy.empty(self.behavior.max_particles, dtype=object)
        self.empty_spaces = []
        self.last_number = 0

        self.array = data.get_best_array_type(GL_POINTS, self.behavior.max_particles, 5)

        self.pickable = False
        self.particle_type = ParticlePoint
Example #2
0
    def __init__(self, font, text, char_height, color=(1,1,1,1),
                 underline=False, italic=False, bold=False,
                 linewrap=None, break_words=False):
        BaseSceneObject.__init__(self)
        self.font = font
        self.char_height = char_height
        self._bold = bold
        self._italic = italic
        self._underline = underline
        self.underline_count = 0
        self._color = None
        self._linewrap = linewrap
        self._break_words = break_words

        if underline:
            tsize = len(text)+1 #works because new lines are replaced by the underlines...
        else:
            tsize = len(text)-text.count("\n")

        self.text_array = data.get_best_array_type(GL_TRIANGLES, 6*tsize, 5) #create array!
        self.text_array.texture = self.font.font_tex

        self.text = text
        self.color = color