示例#1
0
    def debug_draw(self):
        off_centre = self.camera.adjust_pnt(self.centre, self.parallax_depth)

        calls = []

        call = Draw_call('rect', 10)
        call.set_arg('rect', Rect(self.width, self.height, off_centre-Pnt(self.width,self.height)/2))
        call.set_arg('rgb', (255,255,255))
        calls.append(call)

        return calls
示例#2
0
    def draw(self, debug):
        calls = []

        call = Draw_call('texture', self.draw_depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', self.camera.adjust_pnt(self.pos))
        calls.append(call)

        if debug:
            calls += self.debug_draw()

        return calls
示例#3
0
    def draw(self, debug):

        calls = []

        if debug:
            calls = calls + self.debug_draw()

        call = Draw_call('texture', self.depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', (self.camera.adjust_pnt(self.centre, self.parallax_depth)))
        #call.set_arg('area', Rect(self.width/2, self.height/2, Pnt()))
        calls.append(call)

        return calls
示例#4
0
    def debug_draw(self):
        off_centre = self.camera.adjust_pnt(self.centre, self.parallax_depth)

        calls = []

        call = Draw_call('line', 10)
        call.set_arg('pos1', off_centre-Pnt(5,0))
        call.set_arg('pos2', off_centre+Pnt(5,0))
        call.set_arg('rgb', (150,50,250))
        calls.append(call)

        call = Draw_call('line', 10)
        call.set_arg('pos1', off_centre-Pnt(0,5))
        call.set_arg('pos2', off_centre+Pnt(0,5))
        call.set_arg('rgb', (150,50,250))
        calls.append(call)

        return calls
示例#5
0
    def draw(self, debug=False):
        a = ((-self.dir+math.pi)*180.0)/math.pi
        
        calls = []

        call = Draw_call('texture', 6)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', self.camera.adjust_pnt(self.pos))
        call.set_arg('angle', a)
        calls.append(call)

        if debug:
            calls += self.debug_draw()

        return calls
示例#6
0
    def draw(self, debug):
        off_centre = self.camera.adjust_pnt(self.centre, self.parallax_depth)

        s_dim = draw.get_dimensions()

        calls = []
         
        if debug:
            calls = calls + self.debug_draw()

        #top left tile
        width, height = off_centre.x, off_centre.y
        origin = Pnt(self.width-off_centre.x, self.height-off_centre.y)

        call = Draw_call('texture', self.depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', off_centre+Pnt(-width,-height)/2)
        call.set_arg('area', Rect(width, height, origin))
        calls.append(call)

        #top right tile
        width, height = s_dim.x-off_centre.x, off_centre.y
        origin = Pnt(0,self.height-off_centre.y)

        call = Draw_call('texture', self.depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', off_centre+Pnt(width, -height)/2)
        call.set_arg('area', Rect(width, height, origin))
        calls.append(call)

        #bottom left tile
        width, height = off_centre.x, s_dim.y-off_centre.y
        origin = Pnt(self.width-off_centre.x,0)

        call = Draw_call('texture', self.depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', off_centre+Pnt(-width, height)/2)
        call.set_arg('area', Rect(width, height, origin))
        calls.append(call)

        #bottom right tile
        width, height = s_dim.x-off_centre.x, s_dim.y-off_centre.y
        origin = Pnt(0,0)

        call = Draw_call('texture', self.depth)
        call.set_arg('texture', self.texture)
        call.set_arg('pos', off_centre+Pnt(width, height)/2)
        call.set_arg('area', Rect(width, height, origin))
        calls.append(call)

        return calls
示例#7
0
    def debug_draw(self):
        calls = []

        adjusted_pos = self.camera.adjust_pnt(self.pos)

        call = Draw_call('shape', 10)
        call.set_arg('shape', self.shape)
        call.set_arg('pos', adjusted_pos)
        call.set_arg('rgb', (100, 100, 255))
        calls.append(call)

        call = Draw_call('rect', 10)
        call.set_arg('rect', self.shape.bounding_box())
        call.set_arg('pos', adjusted_pos)
        call.set_arg('rgb', (250, 100, 100))
        calls.append(call)

        return calls
示例#8
0
    def debug_draw(self):
        calls = []

        adjusted_pos = self.camera.adjust_pnt(self.pos)
        adjusted_target_pos = self.camera.adjust_pnt(self.target_pos)

        call = Draw_call('shape', 10)
        call.set_arg('shape', self.shape)
        call.set_arg('pos', adjusted_pos)
        call.set_arg('rgb', (100, 100, 255))
        calls.append(call)

        call = Draw_call('rect', 10)
        call.set_arg('rect', self.shape.bounding_box())
        call.set_arg('pos', adjusted_pos)
        call.set_arg('rgb', (250, 100, 100))
        calls.append(call)

        call = Draw_call('line', 10)
        call.set_arg('pos1', adjusted_pos)
        call.set_arg('pos2', adjusted_pos + self.velocity*100)
        call.set_arg('rgb', (100, 250, 100))
        calls.append(call)

        call = Draw_call('line', 10)
        call.set_arg('pos1', adjusted_pos)
        call.set_arg('pos2', adjusted_target_pos)
        call.set_arg('rgb', (200, 100, 10))
        calls.append(call)

        call = Draw_call('line', 10)
        call.set_arg('pos1', adjusted_target_pos-Pnt(2,0))
        call.set_arg('pos2', adjusted_target_pos+Pnt(2,0))
        call.set_arg('rgb', (250, 100, 100))
        calls.append(call)

        call = Draw_call('line', 10)
        call.set_arg('pos1', adjusted_target_pos-Pnt(0,2))
        call.set_arg('pos2', adjusted_target_pos+Pnt(0,2))
        call.set_arg('rgb', (250, 100, 100))
        calls.append(call)

        return calls