Pārlūkot izejas kodu

Audio and Font resource loaders will throw an error if their associated subsystems have not been initialized before loading.

master
Bryan Miller pirms 6 gadiem
vecāks
revīzija
69275bb4d4
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. +4
    -1
      game/gbe/resourceLoaders.py

+ 4
- 1
game/gbe/resourceLoaders.py Parādīt failu

if not os.path.isfile(filename): if not os.path.isfile(filename):
raise LoadError("Failed to load '{}'. Path missing or invalid.".format(filename)) raise LoadError("Failed to load '{}'. Path missing or invalid.".format(filename))
try: try:
return pygame.mixer.Sound(filename)
if pygame.mixer.get_init() is not None:
return pygame.mixer.Sound(filename)
except pygame.error as e: except pygame.error as e:
raise LoadError("Pygame Exception: {}".format(e.message)) raise LoadError("Pygame Exception: {}".format(e.message))
raise LoadError("Audio subsystem not initialized before attempting to obtain resource.")


def load_font(filename, params={}): def load_font(filename, params={}):
if not os.path.isfile(filename): if not os.path.isfile(filename):
return pygame.font.Font(filename, size) return pygame.font.Font(filename, size)
except pygame.error as e: except pygame.error as e:
raise LoadError("Pygame Exception: {}".format(e.message)) raise LoadError("Pygame Exception: {}".format(e.message))
raise LoadError("Font subsystem not initialized before attempting to obtain resource.")




def load_JSON(filename, params={}): def load_JSON(filename, params={}):

Notiek ielāde…
Atcelt
Saglabāt