示例#1
0
    def create (self):
        Win.create (self)

        self.bg_color = Colors.gray80
        self.pen_color = Colors.gray10

        self.down_ = True
        self.show_ = True

        self.x_init = self.w / 2.0
        self.y_init = self.h / 2.0
        self.a_init = 0.0

        self.stack = []
        self.reset ()
        return True
示例#2
0
def main():
    win_w, win_h = (640, 480)
    win_bgc = Colors.black
    # win

    win = Win(win_w, win_h)
    win.draw.draw_clear(win_bgc)

    random.seed()

    l = Line(win)
    l.set_pos(win_w / 2.0, win_h / 2.0)

    while win.tick():
        l.set_color(Colors.black + random.randrange(0x1000000))
        for i in range(20):
            l.rotate(math.pi * (-1.0 + (random.random() * 2.0)) / 6.0)
            l.set_rad(1 + random.randrange(4))
            l.calc_end()
            l.draw()
            l.move_seg()
        win.render()

    win.quit()
    return 0
示例#3
0
def main ():
    digs = 7

    font_n = 10
    font_w = 32
    font_h = 32
    font_p = []

    bg_color = Colors.black

    f_in = io.open ('data/font.bgra', 'rb')
    for i in range (font_n):
        font_p += [f_in.read (font_w * font_h * 4)]
    del f_in

    win = Win (digs * font_w, font_h, run_fps = 5)

    c = 0
    while win.tick ():
        win.draw.draw_clear (bg_color)
        for x in range (digs):
            c2 = c + x
            if c2 >= font_n:
                c2 -= font_n
            win.draw.draw_put_rect (font_p[c2], True,
                x * font_w, 0, font_w, font_h)
        c += 1
        if c >= font_n:
           c = 0
           bg_color = Colors.black + random.randrange (0x1000000)
        win.render ()

    win.quit ()