def pygame_init(): """ Eventually refactor out of prepare """ global JOYSTICKS global FONTS global MUSIC global SFX global GFX global SCREEN global SCREEN_RECT import pygame as pg # Configure locale from tuxemon.core.locale import T T.collect_languages(CONFIG.recompile_translations) # Configure databases from tuxemon.core.db import db db.load() logger.debug("pygame init") pg.init() pg.display.set_caption(CONFIG.window_caption) fullscreen = pg.FULLSCREEN if CONFIG.fullscreen else 0 flags = pg.HWSURFACE | pg.DOUBLEBUF | fullscreen SCREEN = pg.display.set_mode(SCREEN_SIZE, flags) SCREEN_RECT = SCREEN.get_rect() # Disable the mouse cursor visibility pg.mouse.set_visible(not CONFIG.hide_mouse) # Set up any gamepads that we detect # The following event types will be generated by the joysticks: # JOYAXISMOTION JOYBALLMOTION JOYBUTTONDOWN JOYBUTTONUP JOYHATMOTION JOYSTICKS = list() pg.joystick.init() devices = [pg.joystick.Joystick(x) for x in range(pg.joystick.get_count())] # Initialize the individual joysticks themselves. for joystick in devices: name = joystick.get_name() print("Found joystick: \"{}\"".format(name)) blacklisted = any(i.match(name) for i in joystick_blacklist) if blacklisted: print("Ignoring joystick: \"{}\"".format(name)) else: print("Configuring joystick: \"{}\"".format(name)) joystick.init() JOYSTICKS.append(joystick) from tuxemon.core.platform import android # Map the appropriate android keys if we're on android if android: android.init() android.map_key(android.KEYCODE_MENU, pg.K_ESCAPE)
def build_translations(): from tuxemon.core.locale import T T.collect_languages()