def __init__(self, contents_w, contents_h): #center the window on the screen screen = pygame.display.get_surface() screen_w, screen_h = screen.get_size() w, h = contents_w+32, contents_h+32 x = (screen_w - w)//2 y = (screen_h - h)//2 Window.__init__(self, x, y, w, h) self.windowskin = load_windowskin('editor.png') self.create_contents() self.contents.fill((0,0,0,0)) self.cancel_allowed = True
def __init__(self, gamemap): w = 512 / 2 + 2 * self.offset h = 640 / 2 + 2 * self.offset screen_w, screen_h = pygame.display.get_surface().get_size() x = screen_w - w y = screen_h - h Window.__init__(self, x, y, w, h) self.map = gamemap self.selected_rect = Rect(self.offset, self.offset, 32, 32) self.tileset = 0 self._tileref = 0 self.create_contents() self.need_refresh = True self.windowskin = Cache.load_windowskin("editor.png")
def __init__(self, window_tileset): h_max = WindowThumbTile.H_MAX w = 2 * self.offset + 64 + self.font.size("h = 99 ")[0] h = 2 * self.offset + 32 + 8 * h_max + self.font.get_linesize() screen_w, screen_h = pygame.display.get_surface().get_size() x = screen_w - w y = 0 Window.__init__(self, x, y, w, h) self.tile = IsoTile(0, 0) self.h = 0 # map.get_height(i, j) self.window_tileset = window_tileset self.last_param = None self.create_contents() self.windowskin = Cache.load_windowskin("editor.png") self.update()