示例#1
0
    def __init__(self,
                 width,
                 height,
                 x=0,
                 y=0,
                 theme=None,
                 bg=None,
                 mouse_control=MOUSE_LOOSE,
                 blocking=True):
        Model.__init__(self)
        Div.__init__(self, width, height, False, theme)
        self.x = x
        self.y = y
        self.cursor = None
        self.menu = self
        self.all_widgets = []
        self.init_bg(bg)
        assert mouse_control in (Menu.MOUSE_OFF,
                                 Menu.MOUSE_STRICT,
                                 Menu.MOUSE_LOOSE),\
                                'mouse_control must be 0, 1 or 2'
        self.mouse_control = mouse_control
        self.blocking = blocking

        self.should_close = False
示例#2
0
文件: menu.py 项目: Eronarn/libRPG
    def __init__(self, width, height, x=0, y=0, theme=None, bg=None,
                 mouse_control=MOUSE_LOOSE, blocking=True):
        Model.__init__(self)
        Div.__init__(self, width, height, False, theme)
        self.x = x
        self.y = y
        self.cursor = None
        self.menu = self
        self.all_widgets = []
        self.init_bg(bg)
        assert mouse_control in (Menu.MOUSE_OFF,
                                 Menu.MOUSE_STRICT,
                                 Menu.MOUSE_LOOSE),\
                                'mouse_control must be 0, 1 or 2'
        self.mouse_control = mouse_control
        self.blocking = blocking

        self.should_close = False
示例#3
0
文件: map.py 项目: xjzpguob/libRPG
    def __init__(self, map_file, terrain_tileset_files,
                 scenario_tileset_files_list):
        """
        *Constructor:*

        Initialize the MapModel with a layout defined by *map_file* (a .map
        file).

        The terrain tileset is specified by *terrain_tileset_files*, which
        is a tuple (tileset image filename, tileset boundaries filename).
        Tileset image filename should be a bitmap file (.png typically)
        and tileset boundaries filename) should be a .bnd file.

        The scenario tilesets are specified by
        *scenario_tileset_files_list*, a list of tuples like the one passed
        as *terrain_tileset_files*. Each will correspond to a scenario
        layer.
        """
        Model.__init__(self)

        self.world = None
        self.id = None

        self.music = None

        # Set up party
        self.party = None
        self.party_avatar = None

        # Load file data
        self.map_file = map_file
        self.terrain_tileset_files = terrain_tileset_files
        self.scenario_tileset_files_list = scenario_tileset_files_list

        self.terrain_tileset = Tileset(self.terrain_tileset_files[0],
                                       self.terrain_tileset_files[1])
        self.scenario_tileset = [Tileset(i, j) for i, j in\
                                 self.scenario_tileset_files_list]

        self.load_from_map_file()

        # Set up local state
        self.local_state = None

        # Set up objects
        self.objects = []
        self.below_objects = []
        self.obstacle_objects = []
        self.above_objects = []
        self.updatable_objects = []
        self.object_layer = Matrix(self.width, self.height)
        for x in range(self.width):
            for y in range(self.height):
                self.object_layer[x, y] = ObjectCell()

        # Set up areas
        self.areas = []
        self.area_layer = Matrix(self.width, self.height)
        for x in range(self.width):
            for y in range(self.height):
                self.area_layer[x, y] = []

        # Set up context system
        self.pause_delay = 0
        self.contexts = []
示例#4
0
文件: map.py 项目: Eronarn/libRPG
    def __init__(self, map_file, terrain_tileset_files,
                 scenario_tileset_files_list):
        """
        *Constructor:*

        Initialize the MapModel with a layout defined by *map_file* (a .map
        file).

        The terrain tileset is specified by *terrain_tileset_files*, which
        is a tuple (tileset image filename, tileset boundaries filename).
        Tileset image filename should be a bitmap file (.png typically)
        and tileset boundaries filename) should be a .bnd file.

        The scenario tilesets are specified by
        *scenario_tileset_files_list*, a list of tuples like the one passed
        as *terrain_tileset_files*. Each will correspond to a scenario
        layer.
        """
        Model.__init__(self)

        self.world = None
        self.id = None

        self.music = None

        # Set up party
        self.party = None
        self.party_avatar = None

        # Load file data
        self.map_file = map_file
        self.terrain_tileset_files = terrain_tileset_files
        self.scenario_tileset_files_list = scenario_tileset_files_list

        self.terrain_tileset = Tileset(self.terrain_tileset_files[0],
                                       self.terrain_tileset_files[1])
        self.scenario_tileset = [Tileset(i, j) for i, j in\
                                 self.scenario_tileset_files_list]

        self.load_from_map_file()

        # Set up local state
        self.local_state = None

        # Set up objects
        self.objects = []
        self.below_objects = []
        self.obstacle_objects = []
        self.above_objects = []
        self.updatable_objects = []
        self.object_layer = Matrix(self.width, self.height)
        for x in range(self.width):
            for y in range(self.height):
                self.object_layer[x, y] = ObjectCell()

        # Set up areas
        self.areas = []
        self.area_layer = Matrix(self.width, self.height)
        for x in range(self.width):
            for y in range(self.height):
                self.area_layer[x, y] = []

        # Set up context system
        self.pause_delay = 0
        self.contexts = []