def DrawChars(self, f, chars): #TODO : gérer correctement les coordonnées l = len(chars) f.LineTo((text_pos[0],text_pos[1]), 0x80000000) for i, ch in enumerate(chars): x_offset = 12 * (l - 3*i) digit_pl_list = ASCII_GRAPHICS[ch+10] for pl in digit_pl_list: pl_draw = [] for xy in pl: xy_draw = vectors.Vector2D(text_pos[0],text_pos[1]) + vectors.Vector2D(xy[0] + x_offset,xy[1]) * self.zoom pl_draw.append(xy_draw.ToTuple()) f.PolyLineOneColor(pl_draw, 0xFFFFFF)
def DrawChars(self, f, chars): #TODO : gérer correctement les coordonnées l = len(chars) for i, ch in enumerate(chars): x_offset = 12 * (l - 1 - 2 * i) digit_pl_list = DIGITS_GRAPHICS[ch] for pl in digit_pl_list: pl_draw = [] for xy in pl: xy_draw = vectors.Vector2D( xy_center[0], xy_center[1]) + vectors.Vector2D( xy[0] + x_offset, xy[1]) * self.zoom pl_draw.append(xy_draw.ToTuple()) f.PolyLineOneColor(pl_draw, 0xFFFFFF)
def Draw(f): c = 0xFFFF xy_list = [] print mc["some_key"] xrand = random.randint(-screen_size[0] / 2, screen_size[0] / 2) yrand = random.randint(-screen_size[1] / 2, screen_size[1] / 2) xy_list.append((LOGO_OFFSET + vectors.Vector2D(xrand, yrand)).ToTuple()) xy_list.append( (LOGO_OFFSET + vectors.Vector2D(xrand + 1, yrand + 1)).ToTuple()) f.PolyLineOneColor(xy_list, c)
def Draw(f): ''' Dessine le logo ''' for pl_color in LOGO: c = pl_color[1] xy_list = [] for xy in pl_color[0]: xy_list.append( (LOGO_OFFSET + vectors.Vector2D(xy[0], xy[1])).ToTuple()) f.PolyLineOneColor(xy_list, c)
def Draw(self, f): xstart = self.x + random.randint(0, 10) - ( (self.strings / 2) * gstt.space) self.ssize = STRING_SIZE - random.randint(0, 10) bordersize = STRING_SIZE + 20 LOGO = [] for i in range(strings): LOGO.append([[(xstart + gstt.space * i, self.y + self.offset[i]), ((xstart + gstt.space * i + bordersize), self.y + self.offset[i])], self.scolors[i]]) for pl_color in LOGO: c = pl_color[1] xy_list = [] for xy in pl_color[0]: xy_list.append( (HARP_OFFSET + vectors.Vector2D(xy[0], xy[1])).ToTuple()) f.PolyLineOneColor(xy_list, c)
def Draw(self, f): xstart = self.x + random.randint(0, 10) - ( (self.strings / 2) * gstt.space) self.ssize = STRING_SIZE - random.randint(0, 10) bordersize = STRING_SIZE + 20 LOGO = [ [[(xstart, self.y), ((xstart + bordersize), self.y)], self.scolors[0]], [[((xstart + gstt.space), self.y), ((xstart + gstt.space + self.ssize), self.y)], self.scolors[1]], [[((xstart + gstt.space * 2), self.y), ((xstart + gstt.space * 2 + self.ssize), self.y)], self.scolors[2]], [[((xstart + gstt.space * 3), self.y), ((xstart + gstt.space * 3 + self.ssize), self.y)], self.scolors[3]], [[((xstart + gstt.space * 4), self.y), ((xstart + gstt.space * 4 + self.ssize), self.y)], self.scolors[4]], [[((xstart + gstt.space * 5), self.y), ((xstart + gstt.space * 5 + self.ssize), self.y)], self.scolors[5]], [[((xstart + gstt.space * 6), self.y), ((xstart + gstt.space * 6 + self.ssize), self.y)], self.scolors[6]], [[((xstart + gstt.space * 7), self.y), ((xstart + gstt.space * 7 + self.ssize), self.y)], self.scolors[7]], [[((xstart + gstt.space * 8), self.y), ((xstart + gstt.space * 8 + bordersize), self.y)], self.scolors[8]], ] for pl_color in LOGO: c = pl_color[1] xy_list = [] for xy in pl_color[0]: xy_list.append( (HARP_OFFSET + vectors.Vector2D(xy[0], xy[1])).ToTuple()) f.PolyLineOneColor(xy_list, c)
# -*- coding: utf-8 -*- from globalVars import * import frame import time import vectors import random import gstt SPEED = 4 SIZE = 20 bordersize = STRING_SIZE HARP_OFFSET = vectors.Vector2D(0, 0) class Harp(object): def __init__(self): self.x, self.y = screen_size[0] / 2, (screen_size[1] / 2) + 100 self.space = space self.strings = strings self.coloron = COLOR_ON self.coloroff = COLOR_OFF self.scolors = [COLOR_OFF] * self.strings self.ssize = STRING_SIZE def Open(self, strings, space): for i in range(60): #print i gstt.hrp.Move(strings, i) time.sleep(0.007)
# L/o [[(-140, -100), (-200, 20), (120, 20)], 0xFF00], # aser [[(-140, -40), ( -100, -40, ), (-120, 0), (-160, 0), (-110, -20)], 0xFFFF], [[(-40, -40), (-60, -40), (-90, -20), (-50, -20), (-80, 0), (-100, 0)], 0xFFFF], [[(-30, -20), (10, -20), (0, -40), (-20, -40), (-30, -20), (-30, 0), (-10, 0)], 0xFFFF], [[(20, 0), (40, -40), (35, -30), (50, -40), (70, -40)], 0xFFFF], ] #LOGO_OFFSET = vectors.Vector2D(200,-100) LOGO_OFFSET = vectors.Vector2D(400, 320) screen_size = [850, 600] def Draw(f): c = 0xFFFF xy_list = [] print mc["some_key"] xrand = random.randint(-screen_size[0] / 2, screen_size[0] / 2) yrand = random.randint(-screen_size[1] / 2, screen_size[1] / 2) xy_list.append((LOGO_OFFSET + vectors.Vector2D(xrand, yrand)).ToTuple()) xy_list.append(
[[(-40, -40), (-60, -40), (-90, -20), (-50, -20), (-80, 0), (-100, 0)], 0xFFFF], [[(-30, -20), (10, -20), (0, -40), (-20, -40), (-30, -20), (-30, 0), (-10, 0)], 0xFFFF], [[(20, 0), (40, -40), (35, -30), (50, -40), (70, -40)], 0xFFFF], # Pinball [[(-185, 50), (-145, 50), (-130, 20), (-170, 20), (-200, 80)], 0xFFFF00], #P [[(-80, 40), (-120, 40), (-140, 80), (-100, 80), (-80, 40)], 0xFFFF], #O [[(-80, 80), (-60, 40), (-65, 50), (-40, 40), (-25, 50), (-40, 80)], 0xFFFF], #N [[(40, 40), (0, 40), (-20, 80), (20, 80), (30, 60), (10, 60)], 0xFFFF], #G ] #LOGO_OFFSET = vectors.Vector2D(200,-100) LOGO_OFFSET = vectors.Vector2D(460, 250) def Draw(f): ''' Dessine le logo ''' for pl_color in LOGO: c = pl_color[1] xy_list = [] for xy in pl_color[0]: xy_list.append( (LOGO_OFFSET + vectors.Vector2D(xy[0], xy[1])).ToTuple()) #print xy_list f.PolyLineOneColor(xy_list, c)