def play_the_game(): try: # running in a bundle gamedir = sys._MEIPASS except Exception: # running live gamedir = os.path.dirname(__file__) #print '"'+gamedir+'"' pbge.init('GearHead Caramel', 'ghcaramel', gamedir, poster_pattern='eyecatch_*.png') pbge.please_stand_by() gears.init_gears() tsrd = TitleScreenRedraw() mymenu = pbge.rpgmenu.Menu(TitleScreenRedraw.MENU_DEST.dx, TitleScreenRedraw.MENU_DEST.dy, TitleScreenRedraw.MENU_DEST.w, TitleScreenRedraw.MENU_DEST.h, predraw=tsrd, font=pbge.my_state.huge_font) mymenu.add_item("Start Game", start_game) mymenu.add_item("Import GH1 Character", import_arena_character) mymenu.add_item("Config Options", open_config_menu) mymenu.add_item("Quit", None) action = True while action: pbge.my_state.start_music(TITLE_THEME) action = mymenu.query() if action: action(tsrd)
def play_the_game(): try: # running in a bundle gamedir = sys._MEIPASS except Exception: # running live gamedir = os.path.dirname(__file__) # print '"'+gamedir+'"' pbge.init('GearHead Caramel', 'ghcaramel', gamedir, poster_pattern='eyecatch_*.png') pbge.please_stand_by() gears.init_gears() game.init_game() #myfoo = game.content.ghplots.test.Foo() #with open(pbge.util.user_dir('bar.p'), "wb") as f: # pickle.dump(myfoo, f, -1) #with open(pbge.util.user_dir('bar.p'), "rb") as f: # foo2 = pickle.load(f) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta),flags=pygame.RLEACCELOK)""",setup='import pygame, pbge, gears',number=10) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta))""",setup='import pbge, gears',number=10) #mypic = pbge.image.Image('Zerosaiko.png',color=gears.factions.ProDuelistAssociation.mecha_colors) #mydest = pygame.Surface((mypic.frame_width, mypic.frame_height)) #mydest.fill((0, 0, 255)) #mypic.render((0,0),dest_surface=mydest) #pygame.image.save(mydest, pbge.util.user_dir("out_Kerebos.png")) # mypor = gears.portraits.Portrait() # mypor.bits = ["FBA NoBody","Haywire B3 Head"] # mypic = mypor.build_portrait(None,False,True) # pygame.image.save(mypic.bitmap, pbge.util.user_dir("out.png")) tsrd = TitleScreenRedraw() mymenu = pbge.rpgmenu.Menu(TitleScreenRedraw.MENU_DEST.dx, TitleScreenRedraw.MENU_DEST.dy, TitleScreenRedraw.MENU_DEST.w, TitleScreenRedraw.MENU_DEST.h, predraw=tsrd, font=pbge.my_state.huge_font ) mymenu.add_item("Load Campaign", load_game) mymenu.add_item("Start Campaign", start_game) mymenu.add_item("Create Character", open_chargen_menu) mymenu.add_item("Import GH1 Character", import_arena_character) mymenu.add_item("Config Options", open_config_menu) mymenu.add_item("Browse Mecha", game.mechabrowser.MechaBrowser()) mymenu.add_item("Edit Mecha", game.geareditor.LetsEditSomeMeks) if pbge.util.config.getboolean("GENERAL", "dev_mode_on"): mymenu.add_item("Eggzamination", game.devstuff.Eggzaminer) mymenu.add_item("Quit", None) action = True while action: pbge.my_state.start_music(TITLE_THEME) action = mymenu.query() if action: action(tsrd)
def play_the_game(): try: # running in a bundle gamedir = sys._MEIPASS except Exception: # running live gamedir = os.path.dirname(__file__) # print '"'+gamedir+'"' pbge.init('GearHead Caramel', 'ghcaramel', gamedir, poster_pattern='eyecatch_*.png') pbge.please_stand_by() gears.init_gears() game.content.backstory.init_backstory() # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta),flags=pygame.RLEACCELOK)""",setup='import pygame, pbge, gears',number=10) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta))""",setup='import pbge, gears',number=10) #mypic = pbge.image.Image('SHD_22C_Dielancer.png',color=list(gears.factions.BladesOfCrihna.mecha_colors)) #mydest = pygame.Surface((mypic.frame_width, mypic.frame_height)) #mydest.fill((0, 0, 255)) #mypic.render((0,0),dest_surface=mydest) #pygame.image.save(mydest, pbge.util.user_dir("out.png")) # mypor = gears.portraits.Portrait() # mypor.bits = ["FBA NoBody","Haywire B3 Head"] # mypic = mypor.build_portrait(None,False,True) # pygame.image.save(mypic.bitmap, pbge.util.user_dir("out.png")) tsrd = TitleScreenRedraw() mymenu = pbge.rpgmenu.Menu(TitleScreenRedraw.MENU_DEST.dx, TitleScreenRedraw.MENU_DEST.dy, TitleScreenRedraw.MENU_DEST.w, TitleScreenRedraw.MENU_DEST.h, predraw=tsrd, font=pbge.my_state.huge_font) mymenu.add_item("Load Campaign", load_game) mymenu.add_item("Start Campaign", start_game) mymenu.add_item("Create Character", open_chargen_menu) mymenu.add_item("Import GH1 Character", import_arena_character) mymenu.add_item("Config Options", open_config_menu) mymenu.add_item("Browse Mecha", game.mechabrowser.MechaBrowser()) mymenu.add_item("Edit Mecha", game.geareditor.LetsEditSomeMeks) mymenu.add_item("Quit", None) action = True while action: pbge.my_state.start_music(TITLE_THEME) action = mymenu.query() if action: action(tsrd)
def play_the_game(): gears.init_gears() game.init_game() check_rpg_saves() logging.basicConfig(level=logging.DEBUG, filename=pbge.util.user_dir("errors.log")) #pbge.namegen.KoreanNameGen.generate_library2(pbge.util.data_dir("KoreanNames.txt"), pbge.util.data_dir("ng_korean2.json")) #mynamegen = pbge.namegen.KoreanNameGen(pbge.util.data_dir("ng_korean2.json")) #for t in range(200): # print(mynamegen.gen_word2()) #print(os.getenv("APPDATA")) # myfoo = game.content.ghplots.test.Foo() # with open(pbge.util.user_dir('bar.p'), "wb") as f: # pickle.dump(myfoo, f, -1) # with open(pbge.util.user_dir('bar.p'), "rb") as f: # foo2 = pickle.load(f) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta),flags=pygame.RLEACCELOK)""",setup='import pygame, pbge, gears',number=10) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta))""",setup='import pbge, gears',number=10) #fname = "mecha_wraith.png" #mypic = pbge.image.Image(fname, color=gears.factions.RegExCorporation.mecha_colors) #mydest = pygame.Surface((mypic.frame_width, mypic.frame_height)) #mydest.fill((15, 15, 50)) #mypic.render((0,0),dest_surface=mydest) #pygame.image.save(mydest, pbge.util.user_dir("out_"+fname)) # mypor = gears.portraits.Portrait() # mypor.bits = ["FBA NoBody","Haywire B3 Head"] # mypic = mypor.build_portrait(None,False,True) # pygame.image.save(mypic.bitmap, pbge.util.user_dir("out.png")) try: tsrd = TitleScreenRedraw() pbge.my_state.view = tsrd action = True while action: mymenu = pbge.rpgmenu.Menu(TitleScreenRedraw.MENU_DEST.dx, TitleScreenRedraw.MENU_DEST.dy, TitleScreenRedraw.MENU_DEST.w, TitleScreenRedraw.MENU_DEST.h, predraw=tsrd, font=pbge.my_state.huge_font, no_escape=pbge.util.config.getboolean( "GENERAL", "no_escape_from_title_screen")) mymenu.add_item("Load Campaign", LoadGameMenu) mymenu.add_item("Start Campaign", StartGameMenu) mymenu.add_item("Create Character", open_chargen_menu) mymenu.add_item("Import GH1 Character", import_arena_character) mymenu.add_item("Config Options", open_config_menu) mymenu.add_item("Browse Mecha", game.mechabrowser.MechaBrowser()) mymenu.add_item("Edit Mecha", game.geareditor.LetsEditSomeMeks) if quarantined_files: mymenu.add_item("Quarantined Saves", view_quarantine) if pbge.util.config.getboolean("GENERAL", "dev_mode_on"): mymenu.add_item("Edit Scenario", game.scenariocreator.start_plot_creator) mymenu.add_item("Compile Plot Bricks", game.scenariocreator.PlotBrickCompiler) mymenu.add_item("Eggzamination", game.devstuff.Eggzaminer) mymenu.add_item("Just Show Background", just_show_background) mymenu.add_item("Steam The Eggs", prep_eggs_for_steam) mymenu.add_item("Quit", None) pbge.my_state.start_music(TITLE_THEME) action = mymenu.query() if action: action(tsrd) except Exception as e: print(traceback.format_exc()) pbge.alert( "Python Exception ({}) occurred- please send the error.log in your ghcaramel user folder to [email protected].\nK THX gonna crash now." .format(e)) logging.exception(e) logging.critical("Please email this file to [email protected]")
def play_the_game(): # Step one is to find our gamedir. The process is slightly different depending on whether we are running from # source, running from a PyInstaller build, or running from a cx_Freeze build. if getattr(sys, "_MEIPASS", False): # PyInstaller build. gamedir = sys._MEIPASS elif getattr(sys, "frozen", False): # cx_Freeze build. gamedir = os.path.dirname(sys.executable) else: # The application is not frozen gamedir = os.path.dirname(__file__) pbge.init('GearHead Caramel', 'ghcaramel', gamedir, poster_pattern='eyecatch_*.png') pbge.please_stand_by() gears.init_gears() game.init_game() #myfoo = game.content.ghplots.test.Foo() #with open(pbge.util.user_dir('bar.p'), "wb") as f: # pickle.dump(myfoo, f, -1) #with open(pbge.util.user_dir('bar.p'), "rb") as f: # foo2 = pickle.load(f) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta),flags=pygame.RLEACCELOK)""",setup='import pygame, pbge, gears',number=10) # print timeit.timeit("""mypic = pbge.image.Image('mecha_buruburu.png',color=(gears.color.ArmyDrab,gears.color.ShiningWhite,gears.color.ElectricYellow,gears.color.GullGrey,gears.color.Terracotta))""",setup='import pbge, gears',number=10) #mypic = pbge.image.Image('Onawa.png',color=(gears.color.Viridian, gears.color.MediumSkin, gears.color.BlackRose, gears.color.AeroBlue, gears.color.AeroBlue)) #mydest = pygame.Surface((mypic.frame_width, mypic.frame_height)) #mydest.fill((0, 0, 25)) #mypic.render((0,0),dest_surface=mydest) #pygame.image.save(mydest, pbge.util.user_dir("out_Joust.png")) # mypor = gears.portraits.Portrait() # mypor.bits = ["FBA NoBody","Haywire B3 Head"] # mypic = mypor.build_portrait(None,False,True) # pygame.image.save(mypic.bitmap, pbge.util.user_dir("out.png")) tsrd = TitleScreenRedraw() mymenu = pbge.rpgmenu.Menu(TitleScreenRedraw.MENU_DEST.dx, TitleScreenRedraw.MENU_DEST.dy, TitleScreenRedraw.MENU_DEST.w, TitleScreenRedraw.MENU_DEST.h, predraw=tsrd, font=pbge.my_state.huge_font) mymenu.add_item("Load Campaign", load_game) mymenu.add_item("Start Campaign", start_game) mymenu.add_item("Create Character", open_chargen_menu) mymenu.add_item("Import GH1 Character", import_arena_character) mymenu.add_item("Config Options", open_config_menu) mymenu.add_item("Browse Mecha", game.mechabrowser.MechaBrowser()) mymenu.add_item("Edit Mecha", game.geareditor.LetsEditSomeMeks) mymenu.add_item("Edit Scenario", game.plotcreator.start_plot_creator) if pbge.util.config.getboolean("GENERAL", "dev_mode_on"): mymenu.add_item("Eggzamination", game.devstuff.Eggzaminer) mymenu.add_item("Quit", None) action = True while action: pbge.my_state.start_music(TITLE_THEME) action = mymenu.query() if action: action(tsrd)