def __init__(self, title): vresx, vresy = (1920, 1080) super(FileChooser, self).__init__(title, (vresx / 2 - FileChooser.WINDOW_WIDTH/ 2, vresy / 2 - FileChooser.WINDOW_HEIGHT / 2, FileChooser.WINDOW_WIDTH, FileChooser.WINDOW_HEIGHT), pf.NK_WINDOW_BORDER | pf.NK_WINDOW_NO_SCROLLBAR | pf.NK_WINDOW_TITLE, (vresx, vresy)) import os self.mapstring = os.path.realpath(pf.get_basedir()) + "/assets/maps/" self.scenestring = os.path.realpath(pf.get_basedir()) + "/assets/maps/" self.scene_flag = False self.title = title
def __init__(self): vresx, vresy = (1920, 1080) super(SessionWindow, self).__init__( "Session", (vresx / 2 - SessionWindow.WINDOW_WIDTH / 2, vresy / 2 - SessionWindow.WINDOW_HEIGHT / 2, SessionWindow.WINDOW_WIDTH, SessionWindow.WINDOW_HEIGHT), pf.NK_WINDOW_BORDER | pf.NK_WINDOW_NO_SCROLLBAR | pf.NK_WINDOW_TITLE | pf.NK_WINDOW_CLOSABLE, (vresx, vresy)) self.filestring = pf.get_basedir()
def __init__(self): resx, resy = pf.get_resolution() super(FileChooser, self).__init__( "FileChooser", (resx / 2 - FileChooser.WINDOW_WIDTH / 2, resy / 2 - FileChooser.WINDOW_HEIGHT / 2, FileChooser.WINDOW_WIDTH, FileChooser.WINDOW_HEIGHT), NK_WINDOW_BORDER | NK_WINDOW_NO_SCROLLBAR) import os self.filestring = os.path.realpath(pf.get_basedir()) + "/assets/maps/"
def on_okay(): scenepath = self.scenestring if self.scene_flag else None pf.global_event( EVENT_FILE_CHOOSER_OKAY, (pf.get_basedir() + "/" + self.mapstring, scenepath))
pf.set_ambient_light_color((1.0, 1.0, 1.0)) pf.set_emit_light_color((1.0, 1.0, 1.0)) pf.set_emit_light_pos((1664.0, 1024.0, 384.0)) pf.set_active_font("OptimusPrinceps.ttf") pf.disable_unit_selection() pf.disable_fog_of_war() mouse_events.install() ############################################################ # Setup Map, Scene # ############################################################ if len(sys.argv) > 1: pf.load_map(pf.get_basedir(), sys.argv[1], update_navgrid=False) globals.active_map = map.Map.from_filepath(pf.get_basedir() + "/" + sys.argv[1]) else: pf.load_map_string(globals.active_map.pfmap_str(), update_navgrid=False) if len(sys.argv) > 2: globals.active_objects_list = pf.load_scene(sys.argv[2], update_navgrid=False) globals.scene_filename = sys.argv[2] for obj in globals.active_objects_list: obj.selectable = True else: pf.add_faction(DEFAULT_FACTION_NAME, DEFAULT_FACTION_COLOR) ############################################################
import pf import sys sys.path += [pf.get_basedir() + 'scripts/rts']