board.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:eduActiv8 作者: imiolek-ireneusz 项目源码 文件源码
def __init__(self, board, grid_x=0, grid_y=0, grid_w=1, grid_h=1, value="", color=(0, 0, 0), alpha=False, **kwargs):
        pygame.sprite.Sprite.__init__(self)
        self.grid_x = grid_x
        self.grid_y = grid_y
        self.grid_w = grid_w
        self.grid_h = grid_h
        self.grid_last_x = grid_x
        self.grid_last_y = grid_y
        self.alpha = alpha
        self.board = board
        self.initcolor = color
        self.color = color
        self.decolorable = True
        self.locked = False
        self.lockable = False
        self.value = value
        self.speaker_val = value
        self.speaker_val_update = True
        self.outline = False
        self.perm_outline = False
        self.perm_outline_color = [255, 0, 0]
        self.perm_outline_width = 2
        self.hasimg = False
        self.draggable = True
        self.animable = True
        self.keyable = True
        self.show_value = True
        self.readable = True
        self.highlight = True
        self.audible = False  # use true to enable sounds on unit move
        self.outline_highlight = False
        self.font_color = (0, 0, 0, 0)
        self.align = 0  # align: 0 - centered, 1 - left, 2 - right
        self.valign = 0  # align: 0 - centered, 1 - top
        self.idx = 0  # position in sequence
        self.update_me = True

        self.check_display = None  # None - none, True - correct, False - wrong
        self.checkable = False
        # Set height, width, the -1 is to give it some space around for the margin
        if self.alpha:
            self.image = pygame.Surface([grid_w * board.scale - 1, grid_h * board.scale - 1], flags=pygame.SRCALPHA)
        else:
            self.image = pygame.Surface([grid_w * board.scale - 1, grid_h * board.scale - 1])
        self.image.fill(self.color)

        # http://www.pygame.org/docs/ref/surface.html - surface.fill() comment
        # self.image = pygame.Surface([grid_w*board.scale-1, grid_h*board.scale-1],flags=pygame.SRCALPHA)
        # self.image.fill(self.color,special_flags=pygame.BLEND_RGBA_MIN)
        self.painting = self.image

        # Make our top-left corner the passed-in location. The +1 is the margin
        self.rect = self.image.get_rect()
        self.rect.topleft = [grid_x * board.scale + 1, grid_y * board.scale + 1]

        # scale font size:
        self.font = board.font_sizes[0]
        self.text_wrap = True
        self.is_door = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号