コード例 #1
0
 def drawO(self, posXY):
     [px, py] = self.boardPositionToPixelCenter(posXY)
     circle = Circle(x=px,
                     y=py,
                     z=1,
                     width=self.cell_size * 0.9,
                     color=self.colorO,
                     stroke=5)
     circle.render()
コード例 #2
0
ファイル: radio.py プロジェクト: grapesmoker/pyglet-gui
    def render(self, batch, group=None):

        self.frame.render(batch)
        l_x, l_y = self.calc_label_position(self.label)
        label = pyglet.text.Label(self.text, x=l_x, y=l_y, batch=batch)
        circ_y = l_y + round(self.label.content_height * 0.33)
        circ_x = round((self.frame.x + 10))
        circle = Circle(5, circ_x, circ_y, fill=self.selected)
        circle.render(batch)
コード例 #3
0
ファイル: game.py プロジェクト: steinitzu/platformy
    def draw(self):
        super(CollidableSprite, self).draw()
        if not isinstance(self, BallMan):
            return

        if log.level == logging.DEBUG:
            path_nodes = self.get_ancestor(Level).path_nodes
            for node in path_nodes:
                x,y = node.x, node.y
                c = Circle(x,y,width=10,color=(0.,.9,0.,1.))
                c.render()
コード例 #4
0
    def render(self):
        c = Circle(self.a[0], self.a[1], width=10, color=(0., .9, 0., 1.))
        c.render()
        c = Circle(self.ac[0], self.ac[1], width=10, color=(0., .9, 0.5, 1.))
        c.render()
        l = Line(self.a, self.ac, stroke=2, color=(0, 1., 1., 1.))
        l.render()

        c = Circle(self.b[0], self.b[1], width=10, color=(0., .9, 1., 1.))
        c.render()
        c = Circle(self.bc[0], self.bc[1], width=10, color=(0., .9, 1., 0.5))
        c.render()
        l = Line(self.b, self.bc, stroke=2, color=(0, 1., 1., 1.))
        l.render()

        steps = 100.0
        bz = self.bezier()
        last = self.a
        for i in range(int(steps)):
            t = (i + 1) / steps
            val = bz.at(t)
            val = val[0] + self.a.x, val[1] + self.a.y

            glBegin(GL_LINES)
            glVertex2f(last[0], last[1])
            glVertex2f(val[0], val[1])
            glEnd()

            last = val
コード例 #5
0
ファイル: path_draw.py プロジェクト: Jasonscor/cocos
    def render(self):
        c = Circle(self.a[0], self.a[1], width=10, color=(0.0, 0.9, 0.0, 1.0))
        c.render()
        c = Circle(self.ac[0], self.ac[1], width=10, color=(0.0, 0.9, 0.5, 1.0))
        c.render()
        l = Line(self.a, self.ac, stroke=2, color=(0, 1.0, 1.0, 1.0))
        l.render()

        c = Circle(self.b[0], self.b[1], width=10, color=(0.0, 0.9, 1.0, 1.0))
        c.render()
        c = Circle(self.bc[0], self.bc[1], width=10, color=(0.0, 0.9, 1.0, 0.5))
        c.render()
        l = Line(self.b, self.bc, stroke=2, color=(0, 1.0, 1.0, 1.0))
        l.render()

        steps = 100.0
        bz = self.bezier()
        last = self.a
        for i in range(int(steps)):
            t = (i + 1) / steps
            val = bz.at(t)
            val = val[0] + self.a.x, val[1] + self.a.y

            glBegin(GL_LINES)
            glVertex2f(last[0], last[1])
            glVertex2f(val[0], val[1])
            glEnd()

            last = val
コード例 #6
0
ファイル: assessment.py プロジェクト: kjarmuzynska/tictactoe
 def drawCell(self, posXY, pixelCenter, cell_size):
     x = self.board.xyToIndex(posXY)
     v = self.assessments[x]
     if v <= -100:
         return
     if not self.dev:
         return
     stand = (v - self.average) / self.dev
     circle = Circle(x=pixelCenter[0],
                     y=pixelCenter[1],
                     z=1,
                     width=cell_size * 0.5,
                     color=(stand, 0, 0, 0.98 * stand),
                     stroke=5)
     circle.render()
コード例 #7
0
ファイル: path_draw.py プロジェクト: allenzha/space_seeker
 def draw(self):
     if self.stop:
         director.scene.end()
         
     if self.state == self.SWITCH:
         text = font.Text(self.font, 'switch to:',color=(0.,0.5,0.5,0.5))
         text.x = 20
         text.y = 300
         text.draw()
         text = font.Text(self.font, self.number ,color=(0.,0.5,0.5,0.5))
         text.x = 20
         text.y = 250
         text.draw()
         
     elif self.state in (self.SHOW, self.DRAG):
         self.path.render()
         if self.near:
             c = Circle(
                 self.near.x,self.near.y,
                 width=15,color=(0.,1.,1.,1.)
                 )
             c.render()
             
     elif self.state == self.ANIMATE:
         dt = time.time() - self.anim_start
         bz = self.path.bezier()
         if dt >= self.duration:
             self.state = self.SHOW
         else:
             x,y = bz.at( (dt/self.duration)**self.time_warp )
             c = Circle(
                     x+self.path.a.x,y+self.path.a.y,
                     width=45,color=(0.,1.,1.,1.)
                     )
             c.render()
                 
             
     text = font.Text(self.font, '[%i,%i] t**%0.2f d=%0.2f n=%d p=%d'%(
                 self.mouse.x, self.mouse.y,
                 self.time_warp,
                 self.duration,
                 len(self.paths), self.pathp
             ),
             color=(0.,0.5,0.5,0.5))
     text.x = 100
     text.y = 20
     text.draw()
コード例 #8
0
    def draw(self):
        if self.stop:
            director.scene.end()

        if self.state == self.SWITCH:
            text = "switch to: %s" % self.number
            label = pyglet.text.Label(text,
                                      font_name=self.font_name,
                                      font_size=self.font_size,
                                      color=(0, 128, 128, 128),
                                      x=20,
                                      y=300)
            label.draw()

        elif self.state in (self.SHOW, self.DRAG):
            self.path.render()
            if self.near:
                c = Circle(self.near.x,
                           self.near.y,
                           width=15,
                           color=(0., 1., 1., 1.))
                c.render()

        elif self.state == self.ANIMATE:
            dt = time.time() - self.anim_start
            bz = self.path.bezier()
            if dt >= self.duration:
                self.state = self.SHOW
            else:
                x, y = bz.at((dt / self.duration)**self.time_warp)
                c = Circle(x + self.path.a.x,
                           y + self.path.a.y,
                           width=45,
                           color=(0., 1., 1., 1.))
                c.render()

        text = '[%i,%i] t**%0.2f d=%0.2f n=%d p=%d' % (
            self.mouse.x, self.mouse.y, self.time_warp, self.duration,
            len(self.paths), self.pathp)
        label = pyglet.text.Label(text,
                                  font_name=self.font_name,
                                  font_size=self.font_size,
                                  color=(0, 128, 128, 128),
                                  x=100,
                                  y=20)
        label.draw()
コード例 #9
0
ファイル: path_draw.py プロジェクト: DatRollingStone/nwidget
    def render(self):
        c = Circle(
            self.a[0],self.a[1],
            width=10,color=(0.,.9,0.,1.)
            )
        c.render()
        c = Circle(
            self.ac[0],self.ac[1],
            width=10,color=(0.,.9,0.5,1.)
            )
        c.render()
        l = Line(self.a,self.ac,stroke=2,color=(0,1.,1.,1.))
        l.render()
        
        c = Circle(
            self.b[0],self.b[1],
            width=10,color=(0.,.9,1.,1.)
            )
        c.render()
        c = Circle(
            self.bc[0],self.bc[1],
            width=10,color=(0.,.9,1.,0.5)
            )
        c.render()
        l = Line(self.b,self.bc,stroke=2,color=(0,1.,1.,1.))
        l.render()
        
        steps=100.0
        bz = self.bezier()
        last = self.a
        for i in range(steps):
            t = (i+1)/steps
            next = bz.at( t )
            next = next[0] + self.a.x, next[1] + self.a.y
            
            glBegin(GL_LINES);
            glVertex2f(last[0], last[1]); 
            glVertex2f(next[0], next[1]); 
            glEnd( );

            last = next