示例#1
0
文件: gui.py 项目: irskep/Gluball
def draw_card():
    global last_card, current_card, next_card, transition_time
    draw.set_color(1, 1, 1, 1)
    draw.rect(0, 0, env.norm_w, env.norm_h)
    try:
        current_card.draw()
    except:
        pass
    if transition_time > 0:
        if next_card != None:
            a = 1.0 - transition_time / 0.5
        else:
            a = transition_time / 0.5
        draw.set_color(1, 1, 1, a)
        draw.rect(0, 0, env.norm_w, env.norm_h)
        transition_time -= env.dt
        if transition_time <= 0:
            if next_card != None:
                last_card = current_card
                current_card = next_card
                next_card = None
                transition_time = 0.5
            else:
                transition_time = 0.0
                push_handlers()
示例#2
0
文件: gui.py 项目: irskep/Gluball
 def draw(self):
     """Internal use only."""
     color = (1,1,1,1)
     if self.parent_group != None and self.selected: color = (0.8, 0.8, 0.8, 1)
     if self.pressed: color = (0.7, 0.7, 0.7, 1)
     draw.set_color(color=color)
     draw.image(self.image,self.x,self.y)
     draw.set_color(1,1,1,1)
     draw.label(self.label)
     if self.more_draw != None: self.more_draw()
示例#3
0
 def draw(self):
     for edge in self.edges.viewvalues():
         ax, ay = self.points[edge.a]
         bx, by = self.points[edge.b]
         if edge.counterpart:
             draw.line(ax, ay, bx, by, colors=(0, 255, 0, 255, 0, 255, 0, 255))
         else:
             draw.line(ax, ay, bx, by, colors=(255, 0, 0, 255, 0, 0, 255, 255))
     draw.set_color(1,0,0,1)
     for point in self.points.viewvalues():
         draw.rect(point[0]-5, point[1]-5, point[0]+5, point[1]+5)
示例#4
0
文件: gui.py 项目: irskep/Gluball
 def draw(self):
     color = (1,1,1,1)
     if self.parent_group != None and self.selected:
         color = (0.8, 0.8, 0.8, 1)
     if self.pressed: color = (0.7, 0.7, 0.7, 1)
     draw.set_color(color=color)
     draw.image(self.image,self.x,self.y)
     if self.image_2 != None:
         if self.anchor == 'bottomleft':
             draw.image(self.image_2, self.x, self.y)
         elif self.anchor == 'center':
             draw.image(
                 self.image_2, 
                 self.x+self.image.width/2, self.y+self.image.height/2
             )
示例#5
0
 def draw(self):
     for edge in self.edges.viewvalues():
         ax, ay = self.points[edge.a]
         bx, by = self.points[edge.b]
         if edge.counterpart:
             draw.line(ax,
                       ay,
                       bx,
                       by,
                       colors=(0, 255, 0, 255, 0, 255, 0, 255))
         else:
             draw.line(ax,
                       ay,
                       bx,
                       by,
                       colors=(255, 0, 0, 255, 0, 0, 255, 255))
     draw.set_color(1, 0, 0, 1)
     for point in self.points.viewvalues():
         draw.rect(point[0] - 5, point[1] - 5, point[0] + 5, point[1] + 5)
示例#6
0
 def draw(self):
     draw.set_color(color=self.main_color)
     pyglet.gl.glLineWidth(2.0)
     draw.line(self.x, self.y, self.x+self.width, self.y)
     pyglet.gl.glLineWidth(1.0)
     slider_x = self.x + self.width * self.position
     draw.set_color(color=self.outline_color)
     pyglet.gl.glPointSize(self.size)
     draw.points((slider_x, self.y))
     draw.set_color(color=self.main_color)
     pyglet.gl.glPointSize(self.size-2)
     draw.points((slider_x, self.y))
示例#7
0
 def draw_level(self):
     draw.set_color(1,1,1,1)
     if level.background_image != None:
         try:
             level.background_image.blit_tiled(
                 0, 0, 0, level.width, level.height
             )
         except:
             level.background_image.blit(0,0)
     
     draw.set_color(1, 0, 1, 0.5)
     draw.grid(level.camera_x, level.camera_y,
                 graphics.width, graphics.height)
     draw.set_color(0,0,0,1)
     draw.line(0,0,0,level.height)
     draw.line(0,level.height,level.width,level.height)
     draw.line(level.width,level.height,level.width,0)
     draw.line(level.width,0,0,0)
     level.draw_level_objects()
     draw.set_color(0,1,0,1)
     draw.circle(level.player_x, level.player_y, 80)
     if graphics.drawing: self.current_tool.keep_drawing_static()
示例#8
0
 def draw_tools(self):
     #toolbar background
     draw.set_color(0.8, 0.8, 0.8, 1)
     draw.rect(0,graphics.canvas_y,graphics.canvas_x,graphics.height)
     draw.rect(0,0,graphics.width,graphics.canvas_y)
     
     #buttons
     draw.set_color(1,1,1,1)
     for button in self.toolbar: button.draw()   #toolbar buttons
     for button in self.buttons: button.draw()   #bottom buttons
     for label in self.labels: draw.label(label) #text labelsr
     
     tool.controlspace.draw()
     
     #divider lines
     draw.set_color(0,0,0,1)
     graphics.set_line_width(1.0)
     draw.line(0, graphics.canvas_y, graphics.width, graphics.canvas_y)
     draw.line(
         graphics.canvas_x, graphics.canvas_y, 
         graphics.canvas_x, graphics.height
     )
示例#9
0
 def draw(self):
     draw.set_color(*self.color)
     draw.rect_outline(self.x, self.y, self.x+self.w, self.y+self.h)
示例#10
0
 def draw(self):
     draw.set_color(*self.color)
     draw.line(self.x1, self.y1, self.x2, self.y2)
示例#11
0
文件: level.py 项目: irskep/Gluball
def draw_level_objects():
    colors = {
        True: prim_color,
        False: (1,0,0,1)
    }
    for obj in primitives:
        if obj.yaml_tag == u"!Line":
            if obj.visible:
                draw.set_color(*prim_color)
            else:
                if obj.collides:
                    draw.set_color(0,1,0,1)
                else:
                    draw.set_color(1,0,0,1)
            draw.line(obj.x1, obj.y1, obj.x2, obj.y2)
        elif obj.yaml_tag == u"!Circle":
            if obj.visible:
                draw.set_color(*prim_color)
            else:
                if obj.collides:
                    draw.set_color(0,1,0,1)
                else:
                    draw.set_color(1,0,0,1)
            draw.circle(obj.x, obj.y, obj.radius)
        elif obj.yaml_tag == u"!FilledRect":
            draw.set_color(*colors[obj.visible])
            draw.rect(obj.x1, obj.y1, obj.x2, obj.y2)
        elif obj.yaml_tag == u"!FilledTriangle":
            draw.set_color(*colors[obj.visible])
            draw.polygon((obj.x1, obj.y1, obj.x2, obj.y2, obj.x3, obj.y3))
        elif obj.yaml_tag == u"!Door":
            draw.set_color(*resources.key_colors[obj.key])
            graphics.set_line_width(5.0)
            draw.line(obj.x1, obj.y1, obj.x2, obj.y2)
            draw.set_color(*colors[True])
            graphics.set_line_width(1.0)
            draw.line(obj.x1, obj.y1, obj.x2, obj.y2)
        elif obj.yaml_tag == u"!Key":
            draw.set_color(1,1,1,1)
            resources.key_images[obj.number].blit(obj.x, obj.y)
            
    simple_objects_batch.draw()
    draw.set_color(1,1,1,1)
    for label in labels:
        draw.rect(
            label.x-label.content_width/2-3, label.y-label.content_height/2,
            label.x+label.content_width/2+3, label.y+label.content_height/2
        )
    label_batch.draw()