Exemple #1
0
        private BuildResultCode BuildGetGraphicsPlatform()
        {
            var localLogger   = new LoggerResult();
            var simplePackage = Package.Load(localLogger, builderOptions.PackageFile, new PackageLoadParameters
            {
                AutoLoadTemporaryAssets  = true,
                LoadAssemblyReferences   = false,
                AutoCompileProjects      = false,
                TemporaryAssetFilter     = (asset) => asset.AssetPath == GameSettingsAsset.GameSettingsLocation,
                TemporaryAssetsInMsbuild = false,
            });

            if (simplePackage == null ||
                localLogger.HasErrors)
            {
                localLogger.CopyTo(builderOptions.Logger);
                return(BuildResultCode.BuildError);
            }

            var settings          = simplePackage.GetGameSettingsAsset();
            var renderingSettings = settings.Get <RenderingSettings>();

            var buildProfile = simplePackage.Profiles.FirstOrDefault(pair => pair.Name == builderOptions.BuildProfile);

            if (buildProfile == null)
            {
                builderOptions.Logger.Error("Package {0} did not contain platform {1}", builderOptions.PackageFile, builderOptions.BuildProfile);
                return(BuildResultCode.BuildError);
            }

            Console.WriteLine(RenderingSettings.GetGraphicsPlatform(builderOptions.Platform, renderingSettings.PreferredGraphicsPlatform));
            return(BuildResultCode.Successful);
        }
        public static GraphicsPlatform GetGraphicsPlatform(this AssetCompilerContext context, Package package)
        {
            // If we have a command line override, use it first
            string graphicsApi;

            if (context.OptionProperties.TryGetValue("XenkoGraphicsApi", out graphicsApi))
            {
                return((GraphicsPlatform)Enum.Parse(typeof(GraphicsPlatform), graphicsApi));
            }

            // Ohterwise, use game settings, or default as fallback
            var settings = package.GetGameSettingsAsset();

            return(settings == null?context.Platform.GetDefaultGraphicsPlatform() : RenderingSettings.GetGraphicsPlatform(context.Platform, settings.GetOrCreate <RenderingSettings>(context.Profile).PreferredGraphicsPlatform));
        }
Exemple #3
0
        public static GraphicsPlatform GetGraphicsPlatform(this AssetCompilerContext context, Package package)
        {
            var settings = package.GetGameSettingsAsset();

            return(settings == null?context.Platform.GetDefaultGraphicsPlatform() : RenderingSettings.GetGraphicsPlatform(context.Platform, settings.Get <RenderingSettings>(context.Profile).PreferredGraphicsPlatform));
        }