コード例 #1
0
ファイル: GLWidget.py プロジェクト: celx/OpenAnt
    def paintGL(self):
        '''
        Drawing routine
        '''

        glClear(GL_COLOR_BUFFER_BIT)

        glPushMatrix()
        glTranslatef(self.camera[0], self.camera[1], 0)
        glScaled(self.zoom, self.zoom, 1)

        if self.vbos:
            glmod.drawVBO()
        else:
            for layer in self.layers:
                for img in self.images[layer]:
                    self.drawImage(img)

        for text in self.texts:
            _split = text[1].split("\n")
            brk = lambda x, n, acc=[]: brk(x[n:], n, acc+[(x[:n])]) if x else acc
            split = []
            for item in _split:
                split.extend(brk(item, 35))
            if len(split[0]) == 0:
                split.pop(0)
            pos = -16 * (len(split) - 1)
            for t in split:
                if len(t) == 0:
                    continue
                
                self.renderText(float(text[2][0]), float(text[2][1])+pos, 0, t)
                pos += 16

        glPopMatrix()
コード例 #2
0
ファイル: glwidget.py プロジェクト: Oipo/Fantasia-Majestical
    def paintGL(self):
        '''
        Drawing routine
        '''

        glClear(GL_COLOR_BUFFER_BIT)

        glPushMatrix()
        glTranslatef(self.camera[0], self.camera[1], 0)
        glScaled(self.zoom, self.zoom, 1)

        if self.vbos:
            glmod.drawVBO()
        else:
            for layer in self.layers:
                for img in self.images[layer]:
                    self.drawImage(img)

        if mod:
            glmod.drawLines(self.lines)
        else:
            for layer in self.lines:
                glLineWidth(layer)
                glBegin(GL_LINES)
                for line in self.lines[layer]:
                    glVertex2f(line[0], line[1])
                    glVertex2f(line[2], line[3])
                glEnd()

        for text in self.texts:
            split = text[1].split("\n")
            if len(split[0]) == 0:
                split.pop(0)
            pos = -16 * (len(split) - 1)
            for t in split:
                if len(t) == 0:
                    continue
                
                self.renderText(float(text[2][0]), float(text[2][1])+pos, 0, t)
                pos += 16

        glScaled(1/self.zoom, 1/self.zoom, 1)
        glTranslatef(-self.camera[0], -self.camera[1], 0)
        glPopMatrix()
コード例 #3
0
ファイル: GLWidget.py プロジェクト: phire/OpenAnt
    def paintGL(self):
        '''
        Drawing routine
        '''
        
        glClear(GL_COLOR_BUFFER_BIT)

        glPushMatrix()
        glTranslatef(self.camera[0], self.camera[1], 0)
        glScaled(self.zoom, self.zoom, 1)

        if Globals.vbos:
            glmod.drawVBO()
        else:
            for layer in self.layers:
                for img in self.images[layer]:
                    self.drawImage(img)

        glScaled(1/self.zoom, 1/self.zoom, 1)
        glTranslatef(-self.camera[0], -self.camera[1], 0)
        glPopMatrix()
コード例 #4
0
ファイル: GLWidget.py プロジェクト: peakcyber/OpenAnt
    def paintGL(self):
        '''
        Drawing routine
        '''

        glClear(GL_COLOR_BUFFER_BIT)

        glPushMatrix()
        glTranslatef(self.camera[0], self.camera[1], 0)
        glScaled(self.zoom, self.zoom, 1)

        if self.vbos:
            glmod.drawVBO()
        else:
            for layer in self.layers:
                for img in self.images[layer]:
                    self.drawImage(img)

        for text in self.texts:
            _split = text[1].split("\n")
            brk = lambda x, n, acc=[]: brk(x[n:], n, acc + [(x[:n])]
                                           ) if x else acc
            split = []
            for item in _split:
                split.extend(brk(item, 35))
            if len(split[0]) == 0:
                split.pop(0)
            pos = -16 * (len(split) - 1)
            for t in split:
                if len(t) == 0:
                    continue

                self.renderText(float(text[2][0]),
                                float(text[2][1]) + pos, 0, t)
                pos += 16

        glPopMatrix()