Ejemplo n.º 1
0
def save_settings():
    fullscreen_option = logic.getCurrentScene().objects['fullscreen_option']
    post_option = logic.getCurrentScene().objects['post_option']
    ssao_option = logic.getCurrentScene().objects['ssao_option']
    LOD_option = logic.getCurrentScene().objects['LOD_option']
    resolution_option = logic.getCurrentScene().objects['resolution_option']
    difficulty_option = logic.getCurrentScene().objects['difficulty_option']
    ui_scale_option = logic.getCurrentScene().objects['ui_scale_option']

    cfg_fullscreen = str(fullscreen_option['option'])
    res = resolution_option['option']
    res = res.split('x')
    cfg_screen_width = str(res[0])
    cfg_screen_height = str(res[1])

    print('Saving config file...')
    #print (cfg_fullscreen, cfg_screen_width, cfg_screen_height)
    set_settings = open('sintel_config.ini', 'w')
    set_settings.write(cfg_screen_width + "\n")
    set_settings.write(cfg_screen_height + "\n")
    set_settings.write(cfg_fullscreen)
    set_settings.close()

    logic.globalDict['cfg_post'] = post_option['option']
    logic.globalDict['cfg_ssao'] = ssao_option['option']
    logic.globalDict['cfg_LOD'] = LOD_option['option']
    logic.globalDict['cfg_difficulty'] = difficulty_option['option']
    logic.globalDict['cfg_UI'] = ui_scale_option['option']
    print(logic.globalDict['cfg_difficulty'])
    logic.saveGlobalDict()

    render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height))
Ejemplo n.º 2
0
def save_settings():
	fullscreen_option = logic.getCurrentScene().objects['fullscreen_option']
	post_option = logic.getCurrentScene().objects['post_option']
	ssao_option = logic.getCurrentScene().objects['ssao_option']
	LOD_option = logic.getCurrentScene().objects['LOD_option']
	resolution_option = logic.getCurrentScene().objects['resolution_option']
	difficulty_option = logic.getCurrentScene().objects['difficulty_option']
	ui_scale_option = logic.getCurrentScene().objects['ui_scale_option']
	
	cfg_fullscreen = str(fullscreen_option['option'])
	res = resolution_option['option']
	res = res.split('x')
	cfg_screen_width = str(res[0])
	cfg_screen_height = str(res[1])
	
	print ('Saving config file...')
	#print (cfg_fullscreen, cfg_screen_width, cfg_screen_height)
	set_settings = open('sintel_config.ini', 'w')
	set_settings.write(cfg_screen_width+"\n")
	set_settings.write(cfg_screen_height+"\n")
	set_settings.write(cfg_fullscreen)
	set_settings.close()
	
	logic.globalDict['cfg_post'] = post_option['option']
	logic.globalDict['cfg_ssao'] = ssao_option['option']
	logic.globalDict['cfg_LOD'] = LOD_option['option']
	logic.globalDict['cfg_difficulty'] = difficulty_option['option']
	logic.globalDict['cfg_UI'] = ui_scale_option['option']
	print (logic.globalDict['cfg_difficulty'])
	logic.saveGlobalDict()
	
	render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height)) 
Ejemplo n.º 3
0
def main_intro():
    # Aggrandissement de la fenêtre
    render.setWindowSize(1000, 1000)

    if gl.info == "":
        gl.all_obj["Cube"].visible = False
        gl.all_obj["brouillard"].visible = False
        gl.info = "H = Help"
Ejemplo n.º 4
0
def maintain_asr(ratio: float, width=None):
    """
    Sets the window's size to be the width specified and the width divided by the desired aspect ratio as the height.
    You can use this to ensure you maintain a 16:9 view, or 4:3, or whatever ratio you desire.
    :param width:Int - Desired width of the window. If left to None, is left to the current window width.
    :param ratio:Float - Desired aspect ratio to maintain.
    :return:None
    """

    if width is None:
        width = render.getWindowWidth()

    render.setWindowSize(int(width), int(width / ratio))
Ejemplo n.º 5
0
def main_music_to_shot():
    """Idem music_and_letters mais sans music et
    idem get_shot mais sans le json get shot
    """

    # Aggrandissement de la fenêtre
    render.setWindowSize(gl.shot_size, gl.shot_size)

    gl.all_obj['Cube'].visible = False

    if gl.fond == "video":
        gl.all_obj["Video"].visible = True
        gl.all_obj["brouillard"].visible = False
        # Avance de la video
        video_refresh()

    if gl.fond == "brouillard":
        gl.all_obj["Video"].visible = False
        gl.all_obj["brouillard"].visible = True

    if gl.fond == "noir":
        gl.all_obj["Video"].visible = False
        gl.all_obj["brouillard"].visible = False

    tempo = gl.tempo['shot'].tempo

    if tempo == 5:
        # Reset de la liste des noms d'objets blender à afficher
        gl.obj_name_list_to_display = []

        # Affiche les notes de la frame
        frame_notes = get_frame_notes()
        notes = get_notes(frame_notes)
        display_frame_notes(notes)

        # Décalage des lettres non jouées
        hide_unplayed_letters()

    # Save position des lettres frame avant d'enreg
    if tempo == 10:
        gl.previous_datas = get_objets_position_size()

    # Enregistre les shots
    if tempo == 15:
        gl.png = save_music_to_shot_shot()
        sleep(0.01)
        gl.numero += 1

    # Fin du json
    end()
Ejemplo n.º 6
0
def GenerateGraphicsData():
	save = False
	file = logic.globalDict["DATA"]["GAMEPATH"]+"Graphics.cfg"
	data = LoadJSON(file)

	if data == None:
		print("NOTICE: No Graphics Config...")
		save = True
		data = {}

	dict = {
		"Shaders": data.get("Shaders", "HIGH"),
		"Vsync": data.get("Vsync", True),
		"Fullscreen": data.get("Fullscreen", True),
		"Resolution": data.get("Resolution", None),
		"Debug": data.get("Debug", [True, True, True, True])
	}

	if config.EMBEDDED_FIX == False:
		render.setFullScreen(dict["Fullscreen"])

	X = render.getWindowWidth()
	Y = render.getWindowHeight()

	if dict["Resolution"] == None:
		print("NOTICE: Initializing Resolution...")
		dict["Resolution"] = [X, Y]
	if dict["Resolution"][0] > X or dict["Resolution"][1] > Y or len(dict["Resolution"]) >= 3:
		print("WARNING: Resolution out of Range...")
		dict["Resolution"] = [X, Y]

	if config.EMBEDDED_FIX == False:
		if dict["Resolution"][0] % 2 != 0:
			dict["Resolution"][0] -= 1
			print("NOTICE: Resolution Fix")
		if dict["Resolution"][1] % 2 != 0:
			dict["Resolution"][1] -= 1
			print("NOTICE: Resolution Fix")

		render.setWindowSize(dict["Resolution"][0], dict["Resolution"][1])
		if save == True:
			SaveJSON(file, dict)

	elif len(dict["Resolution"]) <= 2:
		dict["Resolution"].append("EMBEDDED")

	print("...")

	return dict
Ejemplo n.º 7
0
	def resize(self, winx, winy):
		""" Resize the window, the new size will maintain the same aspect ratio.

		:param integer winx: Window width in pixels.
		:param integer winy: Window height in pixels.
		"""


		_winx = self.width
		_winy = self.height
		_wins = self.scale
		try: wins = winx/winy
		except: wins = 0.001
		diff = _wins-wins
		if not (diff > 0.01 or diff < -0.01): return

		if winx != _winx: winy = int(winx/_wins)
		else:
			if winy != _winy: winx = int(winy*_wins)
		render.setWindowSize(winx, winy)
		self.width = winx
		self.height= winy
Ejemplo n.º 8
0
def main():
	cont = logic.getCurrentController()
	own = cont.owner
	
	#defualt settings
	#cfg_screen_width = '1024'
	#cfg_screen_height = '768'
	cfg_fullscreen = 'True'

	try:
		load_settings = open('sintel_config.ini', 'r')
		#load screen width
		cfg_screen_width = load_settings.readline()
		cfg_screen_width = cfg_screen_width[0:-1]
		#screen height
		cfg_screen_height = load_settings.readline()
		cfg_screen_height = cfg_screen_height[0:-1]
		#fullscreen option
		cfg_fullscreen = load_settings.readline()
		cfg_fullscreen = cfg_fullscreen
		load_settings.close()
		
		render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height))
		
	except:
		print ('Creating config file')
		
		cfg_screen_width = render.getWindowWidth()
		cfg_screen_height = render.getWindowHeight()
		
		set_settings = open('sintel_config.ini', 'w')
		set_settings.write(str(cfg_screen_width)+"\n")
		set_settings.write(str(cfg_screen_height)+"\n")
		set_settings.write(cfg_fullscreen)
		set_settings.close()
		
	cont.activate('start_game')
	#print (cfg_fullscreen)
Ejemplo n.º 9
0
def main():
    cont = logic.getCurrentController()
    own = cont.owner

    #defualt settings
    #cfg_screen_width = '1024'
    #cfg_screen_height = '768'
    cfg_fullscreen = 'True'

    try:
        load_settings = open('sintel_config.ini', 'r')
        #load screen width
        cfg_screen_width = load_settings.readline()
        cfg_screen_width = cfg_screen_width[0:-1]
        #screen height
        cfg_screen_height = load_settings.readline()
        cfg_screen_height = cfg_screen_height[0:-1]
        #fullscreen option
        cfg_fullscreen = load_settings.readline()
        cfg_fullscreen = cfg_fullscreen
        load_settings.close()

        render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height))

    except:
        print('Creating config file')

        cfg_screen_width = render.getWindowWidth()
        cfg_screen_height = render.getWindowHeight()

        set_settings = open('sintel_config.ini', 'w')
        set_settings.write(str(cfg_screen_width) + "\n")
        set_settings.write(str(cfg_screen_height) + "\n")
        set_settings.write(cfg_fullscreen)
        set_settings.close()

    cont.activate('start_game')
    #print (cfg_fullscreen)
Ejemplo n.º 10
0
    def resize(self, winx, winy):
        """ Resize the window, the new size will maintain the same aspect ratio.

		:param integer winx: Window width in pixels.
		:param integer winy: Window height in pixels.
		"""

        _winx = self.width
        _winy = self.height
        _wins = self.scale
        try:
            wins = winx / winy
        except:
            wins = 0.001
        diff = _wins - wins
        if not (diff > 0.01 or diff < -0.01): return

        if winx != _winx: winy = int(winx / _wins)
        else:
            if winy != _winy: winx = int(winy * _wins)
        render.setWindowSize(winx, winy)
        self.width = winx
        self.height = winy
Ejemplo n.º 11
0
def main_music_and_letters():
    # Aggrandissement de la fenêtre
    if gl.conf["music_and_letters"]["fullscreen"] == 1:
        render.setFullScreen(True)
    else:
        render.setWindowSize(gl.music_size, gl.music_size)

    if gl.tempo["cube"].tempo < 120:
        gl.all_obj["Cube"].visible = True
    else:
        gl.all_obj["Cube"].visible = False

    gl.all_obj["brouillard"].visible = False
    # Reset de la liste des noms d'objet blender à afficher
    gl.obj_name_list_to_display = []

    # Joue et affiche les notes de la frame
    frame_notes = get_frame_notes()
    notes = get_notes(frame_notes)
    display_frame_notes(notes)
    play_frame_notes(notes)

    # Décalage des lettres non jouées
    hide_unplayed_letters()
Ejemplo n.º 12
0
def RESOLUTION(args=[], kwa=None):
    """Set Render Resolution

	-x              Window Width
	-y              Window Height
	-f              Fullscreen Toggle
	-l              Set Recommended Low (1280x720)
	-m              Set Recommended Medium (1600x900)
	-h              Set Recommended High (1920x1080)"""

    if "f" in args:
        logic.globalDict["GRAPHICS"]["Fullscreen"] ^= True
        fs = logic.globalDict["GRAPHICS"]["Fullscreen"]
        logic.CLASS.NEWLINE("Fullscreen: " + str(fs) + " (Relaunch Required)",
                            2, 2, (1, 1, 1, 1))

    X = None
    Y = None

    if "l" in args:
        X = 1280
        Y = 720

    elif "m" in args:
        X = 1600
        Y = 900

    elif "h" in args:
        X = 1920
        Y = 1080

    elif len(args) > 1:
        for i in args:
            if "x " in i:
                X = int(i.split(" ")[1])
                if X % 2 != 0:
                    X -= 1
            if "y " in i:
                Y = int(i.split(" ")[1])
                if Y % 2 != 0:
                    Y -= 1

    else:
        X = render.getWindowWidth()
        Y = render.getWindowHeight()

        logic.CLASS.NEWLINE("Resolution: " + str(X) + "x" + str(Y), 2, 2,
                            (1, 1, 1, 1))
        return

    if X != None and Y != None:
        render.setWindowSize(X, Y)

    X = render.getWindowWidth()
    Y = render.getWindowHeight()

    logic.globalDict["GRAPHICS"]["Resolution"] = [X, Y]
    logic.CLASS.NEWLINE("Resolution: " + str(X) + "x" + str(Y), 2, 2,
                        (1, 1, 1, 1))

    settings.SaveJSON(logic.globalDict["DATA"]["GAMEPATH"] + "Graphics.cfg",
                      logic.globalDict["GRAPHICS"])
Ejemplo n.º 13
0
 def height(self, v):
     render.setWindowSize(self._width, v)
Ejemplo n.º 14
0
 def width(self, v):
     render.setWindowSize(v, self._height)
Ejemplo n.º 15
0
 def height(self, v):
     render.setWindowSize(self._width, v)
Ejemplo n.º 16
0
 def width(self, v):
     render.setWindowSize(v, self._height)
Ejemplo n.º 17
0
def main_get_shot():
    """Shot tous les 20 frames
     5 = reset, nouvelle image de notes
    affichage fixe
    10 = enregistrement des positions
    15 = shot
    affichage fixe
    """

    # Aggrandissement de la fenêtre
    render.setWindowSize(gl.shot_size, gl.shot_size)

    # Avance de la video
    video_refresh()

    gl.all_obj["Cube"].visible = False

    if gl.fond == "video":
        gl.all_obj["Video"].visible = True
        gl.all_obj["brouillard"].visible = False

    if gl.fond == "brouillard":
        gl.all_obj["Video"].visible = False
        gl.all_obj["brouillard"].visible = True

    if gl.fond == "noir":
        gl.all_obj["Video"].visible = False
        gl.all_obj["brouillard"].visible = False

    tempo = gl.tempo['shot'].tempo

    if tempo == 5:
        # Reset de la liste des noms d'objets blender à afficher
        gl.obj_name_list_to_display = []

        # Affiche les notes de la frame
        frame_notes = get_frame_notes()
        notes = get_notes(frame_notes)
        display_frame_notes(notes)

        # Eclairage
        set_sun_color_energy()

        # Décalage des lettres non jouées
        hide_unplayed_letters()

    # Save position des lettres frame avant d'enreg
    if tempo == 10:
        gl.previous_datas = get_objets_position_size()

    # Enregistre les shots
    if tempo == 15:
        sub_dir = get_sub_dir()
        save_txt_file(gl.previous_datas, sub_dir)
        sleep(0.01)
        save_shot(sub_dir)
        sleep(0.01)
        gl.numero += 1
        if gl.numero % 100 == 0:
            for i in range(10):
                print(gl.comptage[i])

    # Fin du jeu
    end()