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)
import os # 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() import game import pygame import gears import random # import timeit import glob import pickle import copy import math import logging import traceback
import pbge import os from pbge import scenes from pygame import Rect gamedir = os.path.dirname(__file__) pbge.init('GearHead Caramel','dmeternal',gamedir) class Floor( pbge.scenes.terrain.Terrain ): imagename = 'terrain_floor_tile.png' class Wall( pbge.scenes.terrain.WallTerrain ): imagename = 'terrain_wall_rocks.png' myscene = scenes.Scene(30,30,"Testaria") myscene.fill(Rect(0,0,29,29), floor=Floor, wall=Wall) myscene.fill(Rect(5,5,24,24), wall=None) mymenu = pbge.rpgmenu.Menu(-150,-150,300,300) mymenu.add_item('One',1) mymenu.add_item('Two',2) mymenu.add_item('Three',3) mymenu.query()
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)