def run_optimized(): if __debug__: # start subprocess subp_args = [str(sys.executable), "-O", str(__file__)] for arg in sys.argv[1:]: subp_args.append(arg) #subprocess.Popen(subp_args) subprocess.call(subp_args) else: # running optimized # import the game from gamelib import main main.main()
def run_debug(): # running in debug mode if u"-profile" in sys.argv: import cProfile import tempfile import os profile_data_fname = "t.profile" # tempfile.mktemp("prf") try: cProfile.run("main.main()", profile_data_fname) finally: pass else: main.main()
#! /usr/bin/env python from gamelib import main main.main()
#Importando as bibliotecas import pygame, os, sys from pygame.locals import * from gamelib import main #Chamando a class main no arquivo main.py main.main() #O main é responsavel por definir o tamanho do display, iniciar as funções da pygame e chamar a class menu()
#! /usr/bin/env python from gamelib import main import sys sound = True fps = False if '--nosound' in sys.argv: sound = False if '--fps' in sys.argv: fps = True main.main(sound, fps)
sound = True def usage(argv): print "Usage: %s [OPTIONS]" % argv[0] print print "Option Description" print "--nosound Turn off in game music" print "--vsync Turn on monitor verticle sync" print try: opts, args = getopt.getopt(sys.argv[1:], "", ["vsync", "nosound"]) except getopt.GetoptError, err: print "unrecognized command" usage(sys.argv) sys.exit(1) for opt, arg in opts: if opt == "--vsync": print "vsync on" vsync = True elif opt == "--nosound": print "sound off" sound = False main.main(vsync, sound)
vsync = False sound = True def usage(argv): print "Usage: %s [OPTIONS]" % argv[0] print print "Option Description" print "--nosound Turn off in game music" print "--vsync Turn on monitor verticle sync" print try: opts, args = getopt.getopt(sys.argv[1:], '', ['vsync', 'nosound']) except getopt.GetoptError, err: print "unrecognized command" usage(sys.argv) sys.exit(1) for opt, arg in opts: if opt == '--vsync': print "vsync on" vsync = True elif opt == '--nosound': print "sound off" sound = False main.main(vsync, sound)