示例#1
0
文件: game.py 项目: piratf/Game_Boxes
    def initAttr(self):
        self.turn = True
        self.hudWidth = HUD["HUD_WIDTH"]
        self.edgeWidth = GAME["EDGE_WIDTH"]

        # 先获取 board 部分的大小,再自适应自己的大小
        self.board = Board((self.hudWidth, self.edgeWidth))
        Div.__init__(self, (self.board.width + self.hudWidth, self.board.height + self.edgeWidth * 2))
        # 根据窗口高度设置 HUD 高度
        self.hud = Hud((0, self.height), (0, 0))
        self.hud.setMark(self.turn)
        self.board.setTurn(self.turn)
        self.gameID = 0
        self.order = None
示例#2
0
    def initAttr(self):
        self.turn = True
        self.hudWidth = HUD["HUD_WIDTH"]
        self.edgeWidth = GAME["EDGE_WIDTH"]

        # 先获取 board 部分的大小,再自适应自己的大小
        self.board = Board((self.hudWidth, self.edgeWidth))
        Div.__init__(self, (self.board.width + self.hudWidth,
                            self.board.height + self.edgeWidth * 2))
        # 根据窗口高度设置 HUD 高度
        self.hud = Hud((0, self.height), (0, 0))
        self.hud.setMark(self.turn)
        self.board.setTurn(self.turn)
        self.gameID = 0
        self.order = None
示例#3
0
 def __init__(self, width, height):
     # super(SetLevel, self).__init__()
     Div.__init__(self, (width, height))
     self.initAttr(width, height)
示例#4
0
# -*- coding: utf-8 -*
# Filename: backGround.py

__author__ = "Piratf"

from div import Div
import pygame


class Background(Div, object):
    """draw background"""

    def __init__(self, (width, height), (x, y)=(0, 0)):
        # super(Background, self).__init__()
        Div.__init__(self, (width, height), (x, y))
        self.panel = pygame.Surface((self.width, self.height), depth=32)

    def setColor(self, color):
        if isinstance(color, pygame.Surface):
            self.panel = color
        else:
            self.panel.fill(color)

    def draw(self, screen):
        screen.blit(self.panel, (self.x, self.y))
示例#5
0
 def __init__(self, width, height):
     # super(SetLevel, self).__init__()
     Div.__init__(self, (width, height))
     self.initAttr(width, height)
示例#6
0
# -*- coding: utf-8 -*
# Filename: backGround.py

__author__ = 'Piratf'

from div import Div
import pygame


class Background(Div, object):
    """draw background"""
    def __init__(self, (width, height), (x, y)=(0, 0)):
        # super(Background, self).__init__()
        Div.__init__(self, (width, height), (x, y))
        self.panel = pygame.Surface((self.width, self.height), depth=32)

    def setColor(self, color):
        if isinstance(color, pygame.Surface):
            self.panel = color
        else:
            self.panel.fill(color)

    def draw(self, screen):
        screen.blit(self.panel, (self.x, self.y))