def init_screen(self): screen_info = display.Info() self.desktop_width = screen_info.current_w self.desktop_height = screen_info.current_h self.get_screen_size() display.set_icon(load_image(self.main_path, 'iancraft.ico', convert=False)) self.screen = display.set_mode((self.sw, self.sh), self.flags) display.set_caption('IanCraft')
def __init__(self): self.init_paths() self.init_config() self.init_screen() self.unit_images = {} self.scaled_unit_images = {} for u in UNITS: self.unit_images[u] = load_image(self.main_path, 'units/%s.png' % u, -1) self.tile_images = {} self.scaled_tile_images = {} for s in TILE_SHEETS: self.tile_images[s] = load_image(self.main_path, 'tiles/%s.png' % s) self.button_images = {} self.scaled_button_images = {} for b in BUTTONS: self.button_images[b] = load_image(self.main_path, 'buttons/%s.png' % b, -1) self.background_images = {} self.scaled_background_images = {} for b in BACKGROUNDS: self.background_images[b] = load_image(self.main_path, 'backgrounds/%s.jpg' % b) self.unit_sounds = {} for u in UNITS: self.unit_sounds[u] = {} self.unit_sounds[u]['move'] = load_sound(self.main_path, 'units/%s.move.ogg' % u) self.unit_sounds[u]['fire'] = load_sound(self.main_path, 'units/%s.fire.ogg' % u) self.unit_sounds[u]['target'] = load_sound(self.main_path, 'units/%s.target.ogg' % u) self.unit_sounds[u]['die'] = load_sound(self.main_path, 'units/%s.die.ogg' % u) self.update_scale()