CreateSceneManager() public method

Creates a SceneManager instance based on scene type support.
Creates an instance of a SceneManager which supports the scene types identified in the parameter. If more than one type of SceneManager has been registered as handling that combination of scene types, in instance of the last one registered is returned.
public CreateSceneManager ( SceneType sceneType ) : SceneManager
sceneType SceneType A mask containing one or more flags.
return SceneManager
Esempio n. 1
0
        public void Start(string host, bool userConfigure, bool debugSettings)
        {
            // HACK: Use an English culture so that Axiom.Overlays.Elements.BorderPanel works.
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            // HACK: Get assembly Axiom.Platforms.Win32.dll loaded before any dynamically created assembly.
            // This is to avoid an exception getting thrown from the Root constructor.
            System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(Axiom.Platforms.Win32.Win32InputReader).TypeHandle);

            var service = Connect(host);
            var configuration = ConfigurationManagerFactory.CreateDefault();
            using (var root = new Root("MOOLGOSS.log"))
            using (Globals.Input = new Input())
            {
                root.RenderSystem = root.RenderSystems[0];
                root.RenderSystem.ConfigOptions["VSync"].Value = "Yes";
                root.RenderSystem.ConfigOptions["Full Screen"].Value = "Yes";
                var bestMode =
                    root.RenderSystem.ConfigOptions["Video Mode"].PossibleValues
                    .Where(x => x.Value.Contains("32-bit color"))
                    .LastOrDefault().Value;
                if (bestMode != null) root.RenderSystem.ConfigOptions["Video Mode"].Value = bestMode;
                if (debugSettings)
                {
                    root.RenderSystem.ConfigOptions["Full Screen"].Value = "No";
                    root.RenderSystem.ConfigOptions["Video Mode"].Value = "800 x 600 @ 32-bit color";
                }
                if (userConfigure && !configuration.ShowConfigDialog(root)) return;
                var window = CreateRenderWindow(root.RenderSystem.ConfigOptions["Video Mode"].Value == "Yes");
                Globals.Input.Initialize(window, ownMouse: !debugSettings);
                ResourceGroupManager.Instance.AddResourceLocation("Media", "Folder", true);
                ResourceGroupManager.Instance.InitializeAllResourceGroups();
                Globals.Scene = root.CreateSceneManager(SceneType.Generic);
                Globals.UI = new UserInterface();
                Globals.UI.AddMode(new TitleScreen());
                Globals.UI.AddMode(new Gameplay(service));
                Globals.UI.AddMode(new Docked());
                Globals.UI.SetMode("Title Screen");
                CreateCamera(window);
                root.FrameStarted += FrameStartedHandler;
                root.StartRendering();
            }
        }
Esempio n. 2
0
        public void InitializeSystem()
        {
            configManager = new Config.DefaultConfigurationManager();
            root = new Root(configManager.LogFilename);
            root.FrameRenderingQueued += RootFrameRenderingQueued;

            // Load Config.
            configManager.RestoreConfiguration(root);

            // Render System.
            if (root.RenderSystem == null)
                renderSystem = root.RenderSystem = root.RenderSystems.First().Value;
            else
                renderSystem = root.RenderSystem;

            // Render Window.
            Root.Instance.Initialize(false);
            var parameterList = new NamedParameterList
            {
                {"vsync", "true"},
                {"Anti aliasing", "Level 2"},
                {"FSAA", 1},
                {"colorDepth", 32},
                {"border", "fixed"}
            };
            window = Root.Instance.CreateRenderWindow("EvolutionWarWindow", Constants.Width, Constants.Height, false, parameterList);
            WindowEventMonitor.Instance.RegisterListener(window, this);

            // Content.
            Constants.Load();
            ResourceGroupManager.Instance.AddResourceLocation("Meshes", "Folder", true);
            ResourceGroupManager.Instance.AddResourceLocation("Fonts", "Folder", true);
            ResourceGroupManager.Instance.InitializeAllResourceGroups();

            // Fonts.
            var font = FontManager.Instance.Create("Candara", ResourceGroupManager.DefaultResourceGroupName) as Font;
            if (font != null)
            {
                font.Type = FontType.TrueType;
                font.Source = "Candarab.ttf";
                font.TrueTypeSize = 36;
                font.TrueTypeResolution = 96;
                font.AntialiasColor = false;
                font.Load();
            }

            // Scene Manager.
            sceneManager = root.CreateSceneManager("DefaultSceneManager", "GameSMInstance");
            sceneManager.ClearScene();
        }