Exemplo n.º 1
0
        static void SetupWindows()
        {
            WindowManager.WindowTitleText = Resources.WindowTitle;

            if (PreferencesManager.GetValueB(PrefNames.Headless))
            {
                return;
            }

            WindowManager.WindowInfo info = new WindowManager.WindowInfo();
            info.Size.x = PreferencesManager.GetValueI(PrefNames.MainWindowWidth, 1280);
            info.Size.y = PreferencesManager.GetValueI(PrefNames.MainWindowHeight, 900);

            info.AntiAliasingFactor = PreferencesManager.GetValueI(PrefNames.FSAA, 0);
            info.SizeType           = (WindowManager.WindowInfo.WindowSizeTypes)PreferencesManager.GetValueI(PrefNames.Fullscreen, 0);

            if (info.AntiAliasingFactor > 0)
            {
                if (info.AntiAliasingFactor < 2)
                {
                    info.AntiAliasingFactor = 2;
                }
            }
            if (info.SizeType == WindowManager.WindowInfo.WindowSizeTypes.Fullscreen)
            {
                info.Size.x = OpenTK.DisplayDevice.Default.Width;
                info.Size.y = OpenTK.DisplayDevice.Default.Height;
            }

            WindowManager.Init(info);

            WindowManager.ClearRenderLayers();

            Graphics.BackgroundLayer = WindowManager.AddRenderLayer(new RenderLayer());
            Graphics.ObjectLayer     = WindowManager.AddRenderLayer(new RenderLayer());
            Graphics.EffectLayer     = WindowManager.AddRenderLayer(new RenderLayer());
            Graphics.HudLayer        = WindowManager.AddRenderLayer(GUIManager.GetGUILayer(WindowManager.MainWindowID));
            Graphics.MouseLayer      = WindowManager.AddRenderLayer(new RenderLayer());

            RenderLayer.DefaultLayer = Graphics.ObjectLayer;

            Graphics.GlitchPostProcessor = WindowManager.AddRenderLayer(new PostProcessor("glitch")) as PostProcessor;
            Graphics.GlitchPostProcessor.Enable(false);
            Graphics.WarpPostProcessor = WindowManager.AddRenderLayer(new PostProcessor("warp")) as PostProcessor;
            Graphics.WarpPostProcessor.Enable(false);

            if (PreferencesManager.GetValueB(PrefNames.DisableShader))
            {
                PostProcessor.EnableEffects(false);
            }

            MenuManager.MainFont    = FontManager.LoadFont(ThemeManager.GetThemeAsset("ui/fonts/BebasNeue Regular.otf"));
            MenuManager.BoldFont    = FontManager.LoadFont(ThemeManager.GetThemeAsset("ui/fonts/BebasNeue Bold.otf"));
            FontManager.DefaultFont = MenuManager.MainFont;
        }