Example #1
0
def SAVE(args=[], kwa=None):
    """Save Current Profile"""

    current = logic.globalDict["CURRENT"]
    profile = logic.globalDict["PROFILES"][current["Profile"]]
    portal = logic.globalDict["DATA"]["Portal"]

    path = logic.globalDict["DATA"]["GAMEPATH"]
    name = "Base"

    if "_" not in current["Profile"]:
        name = current["Profile"]

    profile["Last"]["CURRENT"] = current.copy()
    profile["Last"]["PORTAL"] = portal.copy()
    dict = profile

    if "Switch" in args and len(args) == 1:
        return

    settings.SaveJSON(path + name + "Profile.json", dict, "\t")
    logic.CLASS.NEWLINE("Profile Saved!", 2, 2, (1, 1, 1, 1))

    settings.SaveJSON(logic.globalDict["DATA"]["GAMEPATH"] + "Graphics.cfg",
                      logic.globalDict["GRAPHICS"])
Example #2
0
def QUALITY(args=[], kwa=None):
    """Set the Graphics Quality

	-l              Disable Lights and Shaders
	-m              Disable Specular Lighting and Anisotropic Filtering
	-h              Full Shading with Anisotropic x16"""

    if len(args) == 1:
        setting = logic.globalDict["GRAPHICS"]["Shaders"]
        logic.CLASS.NEWLINE("Quality: " + setting, 2, 2, (1, 1, 1, 1))
        return

    if args[1] == "l":
        setting = "LOW"
    elif args[1] == "m":
        setting = "MEDIUM"
    elif args[1] == "h":
        setting = "HIGH"
    else:
        setting = None

    if setting in ["LOW", "MEDIUM", "HIGH"]:
        logic.globalDict["GRAPHICS"]["Shaders"] = setting
        logic.CLASS.NEWLINE("Quality: " + setting, 2, 2, (1, 1, 1, 1))

        settings.SaveJSON(
            logic.globalDict["DATA"]["GAMEPATH"] + "Graphics.cfg",
            logic.globalDict["GRAPHICS"])
Example #3
0
def VSYNC(args=[], kwa=None):
    """Switch Vsync On/Off"""

    if logic.globalDict["GRAPHICS"]["Vsync"] == False:
        logic.globalDict["GRAPHICS"]["Vsync"] = True
    else:
        logic.globalDict["GRAPHICS"]["Vsync"] = False

    logic.CLASS.NEWLINE("Vsync: " + str(logic.globalDict["GRAPHICS"]["Vsync"]),
                        2, 2, (1, 1, 1, 1))

    settings.SaveJSON(logic.globalDict["DATA"]["GAMEPATH"] + "Graphics.cfg",
                      logic.globalDict["GRAPHICS"])
Example #4
0
def DEBUG(args=[], kwa=None):
    """Switch Debug On/Off"""

    debug = logic.globalDict["GRAPHICS"]["Debug"]

    if debug[0] == False:
        logic.globalDict["GRAPHICS"]["Debug"][0] = True
        logic.CLASS.NEWLINE("Debug Stats ON", 2, 2, (1, 1, 1, 1))
    else:
        logic.globalDict["GRAPHICS"]["Debug"][0] = False
        logic.CLASS.NEWLINE("Debug Stats OFF", 2, 2, (1, 1, 1, 1))

    render.showFramerate(debug[1] and debug[0])
    render.showProfile(False)
    render.showProperties(debug[3] and debug[0])

    settings.SaveJSON(logic.globalDict["DATA"]["GAMEPATH"] + "Graphics.cfg",
                      logic.globalDict["GRAPHICS"])
Example #5
0
def openBlend(map, scn=None):
    gd = logic.globalDict

    if map == "RESUME":
        if "NEWLEVEL" not in base.WORLD:
            return
        map = base.WORLD["NEWLEVEL"]
        scn = base.WORLD["NEWSCENE"]
        blend = "MAPS\\" + map
    elif map == "LAUNCHER":
        blend = config.LAUNCHER_BLEND + ".blend"
    elif map == "KEYMAP":
        blend = config.KEYMAP_BLEND + ".blend"
    else:
        base.WORLD["NEWLEVEL"] = map
        base.WORLD["NEWSCENE"] = scn
        blend = "MAPS\\" + map

    gd["TRAVELING"] = True

    for cls in logic.UPDATELIST:
        if cls.UPDATE == True:
            cls.doUpdate()
    for cls in logic.PLAYERLIST:
        if cls.UPDATE == True:
            cls.doUpdate()
    if logic.VIEWPORT != None:
        logic.VIEWPORT.doUpdate()
    logic.UPDATELIST = []

    print("OPEN MAP:\n\t" + blend)

    if config.UPBGE_FIX == True:
        settings.SaveJSON(gd["DATA"]["GAMEPATH"] + "gd_dump", gd, "\t")
    logic.startGame(gd["DATA"]["GAMEPATH"] + blend)
    base.GAME_STATE = "BLEND"
Example #6
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"])