Ejemplo n.º 1
0
def SetDisplay():
    global DISPLAY
    global ScreenWidth
    global ScreenHeight

    if not tge.RunInFullScreen:
        DISPLAY = pygame.display.set_mode(
            (ScreenWidth, ScreenHeight),
            pygame.DOUBLEBUF | pygame.HWACCEL | pygame.HWSURFACE)

    else:
        DISPLAY = pygame.display.set_mode(
            (ScreenWidth, ScreenHeight), pygame.DOUBLEBUF | pygame.HWACCEL
            | pygame.HWSURFACE | pygame.FULLSCREEN)

    pygame.display.set_caption("Taiyou Framework v" +
                               Utils.FormatNumber(tge.TaiyouGeneralVersion))
Ejemplo n.º 2
0
    def LoadRegKeysInFolder(self):
        """
        Load all keys on Specified Folder
        :param reg_dir:Specified Folder
        :return:
        """
        if self.Reg_Path == "":
            raise Exception("Registry Path was not set.")

        reg_dir = self.Reg_Path
        # -- FIX for working on Windows -- #
        self.Reg_Path = self.SourceFolder + reg_dir.replace(self.SourceFolder, "")
        self.Reg_Path = self.Reg_Path.replace("/", tge.TaiyouPath_CorrectSlash)

        start_time = time.time()
        # -- Unload the Registry -- #
        self.UnloadRegistry()

        print("Taiyou.ContentManager.LoadRegistry : Loading Registry...")

        temp_reg_keys = Utils.Directory_FilesList(reg_dir)
        index = -1

        for x in temp_reg_keys:
            index += 1

            CorrectKeyName = x.replace(reg_dir, "").replace(".data", "")
            file = open(x, "r")

            CurrentLine = file.read().splitlines()
            AllData = ""
            for x in CurrentLine:
                if not x.startswith("#"):
                    AllData += x + "\n"

            # -- Format the Text -- #
            AllData = AllData.rstrip().replace("%n", "\n").replace("%t", "\t").replace("%s", " ")

            self.reg_keys.append(CorrectKeyName)
            self.reg_contents.append(AllData)

            print("Taiyou.ContentManager.LoadRegistry : KeyLoaded[" + CorrectKeyName + "]")

        print("Taiyou.ContentManager.LoadRegistry : Total of {0} registry keys loaded. In {1} seconds.".format(str(len(self.reg_keys)), Utils.FormatNumber(time.time() - start_time, 4)))

        Utils.GarbageCollector_Collect()