Exemplo n.º 1
0
        public virtual bool Setup()
        {
            Splash splash = new Splash();

            splash.Show();
            splash.SetStepsCount(10);
            bool   carryOn      = true;
            string splashFormat = "{0}...";

            try
            {
                splash.Increment(
                    String.Format(splashFormat, LanguageResources.GetString(LanguageKey.CreatingTheRootObject)));


                root = new Root();

                LogManager.Singleton.LogMessage("Starting Wings of Fury 2 ver. ");


                splash.Increment(String.Format(splashFormat, LanguageResources.GetString(LanguageKey.SetupingResources)));
                FrameWorkForm.SetupResources();
                // Setup RenderSystem
                RenderSystem rs = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem");
                // or use "OpenGL Rendering Subsystem"
                root.RenderSystem = rs;
                rs.SetConfigOption("Full Screen", "No");

                rs.SetConfigOption("Video Mode", Width + " x " + Height + " @ 32-bit colour");
                // Create Render Window
                root.Initialise(false, "Wingitor RenderWindow");
                NameValuePairList misc = new NameValuePairList();
                misc["externalWindowHandle"] = Handle.ToString();
                window = root.CreateRenderWindow("Wingitor RenderWindow", (uint)ClientSize.Width, (uint)ClientSize.Height, false, misc.ReadOnlyInstance);


                splash.Activate();

                // Load resources
                splash.Increment(String.Format(splashFormat, LanguageResources.GetString(LanguageKey.LoadingResources)));
                FrameWorkForm.LoadResources();

                splash.Increment(
                    String.Format(splashFormat, LanguageResources.GetString(LanguageKey.CreatingGameObjects)));

                ChooseSceneManager();
                CreateCamera();
                CreateViewports();

                splash.Increment(4);

                SetupEngineConfig();

                // Create the scene
                splash.Increment(String.Format(splashFormat, LanguageResources.GetString(LanguageKey.CreatingScene)));
                CreateScene();


                splash.Increment(String.Format(splashFormat, LanguageResources.GetString(LanguageKey.CreatingInput)));
                CreateInput();

                CreateFrameListeners();
            }
            finally
            {
                splash.Close();
                splash.Dispose();
                if (carryOn)
                {
                    window.SetVisible(true);
                }
            }
            return(true);
        }