Beispiel #1
0
  def __init__(self, grid, dotRes, dotScale):
    self.dotDim = GameDefine.DOT_DIMENSION * dotScale
    self.dotWidth = len(grid[0])
    self.dotHeight = len(grid)
    self.grid = grid
    self.dotScale = dotScale
    self.dotAlpha = 255
    self.surface = None
    self.dotRes = dotRes
    self.dotImage = None

    RelativeEntity.__init__(self, self.dotDim * self.dotWidth, self.dotDim * self.dotHeight)

    self.setDotScale(dotScale)
Beispiel #2
0
    def __init__(self, grid, dotRes, dotScale):
        self.dotDim = GameDefine.DOT_DIMENSION * dotScale
        self.dotWidth = len(grid[0])
        self.dotHeight = len(grid)
        self.grid = grid
        self.dotScale = dotScale
        self.dotAlpha = 255
        self.surface = None
        self.dotRes = dotRes
        self.dotImage = None

        RelativeEntity.__init__(self, self.dotDim * self.dotWidth,
                                self.dotDim * self.dotHeight)

        self.setDotScale(dotScale)
Beispiel #3
0
    def setText(self, text, size=32, textColor=(0, 0, 0), bgColor=(255, 255, 255), font="assets/fonts/VCR_OSD_MONO.ttf"):
        if self.surface is not None:
            self.surface.fill(bgColor)

        fontObj = pygame.font.Font(font, size)
        textObj = fontObj.render(text, True, textColor)

        self.width = textObj.get_width()
        self.height = textObj.get_height()

        RelativeEntity.__init__(self, self.width, self.height)
        surf = pygame.Surface(fontObj.size(text), pygame.SRCALPHA, 32)
        surf.fill(bgColor)
        self.surface = surf.convert()
        self.surface.blit(textObj, (0, 0))