def __init__(self): self.webcam = Webcam() self.webcam.start() self.glyphs = Glyphs() self.cone = None self.sphere = None self.texture_background = None
def __init__(self): # initialise webcam and start thread self.webcam = Webcam() self.webcam.start() # initialise glyphs self.glyphs = Glyphs() # initialise shapes self.cone = None self.sphere = None # self.hp = HP() # initialise texture self.texture_background = None
SCALE = 10 BORDER = 300 X_SPACE = 40 Y_SPACE = 60 surface = cairo.PDFSurface( "map.pdf", COLS * X_SIZE * SCALE + (COLS - 1) * X_SPACE + 2 * BORDER, ROWS * Y_SIZE * SCALE + (ROWS - 1) * Y_SPACE + 2 * BORDER) context = cairo.Context(surface) context.set_line_cap(cairo.LineCap.ROUND) context.set_font_size(15) context.select_font_face('Arial', cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) glyphs = Glyphs(context, X_SIZE, Y_SIZE, SCALE) for i in range(ROWS * COLS): y = i // COLS x = i % COLS glyphs.drawGlyph(BORDER + X_SIZE // 2 * SCALE + x * (X_SIZE * SCALE + X_SPACE), BORDER + y * (Y_SIZE * SCALE + Y_SPACE), glyph=i) text = '0x{:03X}'.format(i) _, _, textwidth, _, _, _ = context.text_extents(text) context.move_to(