Ejemplo n.º 1
0
        public void Initialize(ScreenManager screenManager, PixelizerRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = this.GetType().GetMethod("MainMenu")
            });


            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 35), "Random points", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("Random"),
                Toggle       = (bool)renderer.GetType().GetField("Random").GetValue(renderer)
            });

            baseList.AddElement(_splitChance = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Split Chance: " + renderer.SplitChance, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("SplitChance"),
                SliderValue  = (float)renderer.GetType().GetField("SplitChance").GetValue(renderer)
            });

            baseList.AddElement(_endChance = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "End Chance: " + renderer.EndChance, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("EndChance"),
                SliderValue  = (float)renderer.GetType().GetField("EndChance").GetValue(renderer)
            });

            baseList.AddElement(_scale = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Scale: " + renderer.Scale, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 0, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("Scale"),
                SliderValue  = (int)renderer.GetType().GetField("Scale").GetValue(renderer)
            });

            baseList.AddElement(new GUIColorPicker(Vector2.Zero, new Vector2(200, 200), Color.Gray, GUIRenderer.MonospaceFont)
            {
                ReferenceObject = renderer,
                ReferenceField  = renderer.GetType().GetField("LineColor")
            });

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 55), "Click to add effect ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Ejemplo n.º 2
0
        public void Initialize(ScreenManager screenManager, RadialBlurRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = typeof(RadialBlurGUILogic).GetMethod("MainMenu")
            });

            GuiTextBlockLoadDialog textureLoader;

            baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(Vector2.Zero, new Vector2(200, 35), "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D, GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                                );


            baseList.AddElement(_intensityBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: " + renderer.BlurIntensity, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurIntensity"),
                SliderValue  = (float)typeof(RadialBlurRenderer).GetField("BlurIntensity").GetValue(renderer)
            });

            baseList.AddElement(_samplesBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Samples: " + renderer.BlurSamples, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 64, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurSamples"),
                SliderValue  = (int)typeof(RadialBlurRenderer).GetField("BlurSamples").GetValue(renderer)
            });

            baseList.AddElement(_passBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Passes: " + renderer.BlurPasses, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurPasses"),
                SliderValue  = (int)typeof(RadialBlurRenderer).GetField("BlurPasses").GetValue(renderer)
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 55), "Click to freeze center point ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            renderer._backgroundTextureLoader = textureLoader;

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Ejemplo n.º 3
0
        public void Initialize(ScreenManager screenManager)
        {
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GUIList(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.Center, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            //baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 35), "debug info", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            //{
            //    ToggleField = typeof(GameSettings).GetField("ui_debug"),
            //    Toggle = (bool)typeof(GameSettings).GetField("ui_debug").GetValue(null)
            //});

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Radial Blur", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.RadialBlur }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Pixelizer", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Pixelizer }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Bokeh", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Bokeh }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Particle Physics", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.ParticlePhysics }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "SSS (WIP)", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Subsurface }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "FourierTransform (WIP)", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.FourierTransform }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Exit", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("ExitProgram")
            });

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Ejemplo n.º 4
0
        public void Initialize(ScreenManager screenManager, BokehRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = this.GetType().GetMethod("MainMenu")
            });

            GuiTextBlockLoadDialog textureLoader;

            baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(Vector2.Zero, new Vector2(200, 35), "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D, GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                                );


            baseList.AddElement(_sizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: " + renderer.BokehSize, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 2, 20, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(BokehRenderer).GetField("BokehSize"),
                SliderValue  = (float)typeof(BokehRenderer).GetField("BokehSize").GetValue(renderer)
            });

            baseList.AddElement(_brightnessBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Brightness: " + renderer.Brightness, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0.1f, 3, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(BokehRenderer).GetField("Brightness"),
                SliderValue  = (float)typeof(BokehRenderer).GetField("Brightness").GetValue(renderer)
            });

            baseList.AddElement(_downsizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Scale: " + renderer.Downsize, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("Downsize"),
                SliderValue  = (int)renderer.GetType().GetField("Downsize").GetValue(renderer)
            });

            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "32-bit precision", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("FullPrecision"),
                Toggle       = renderer.FullPrecision,
            });

            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Dynamic Scaling", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("DynamicScaling"),
                Toggle       = renderer.DynamicScaling,
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bokeh Shape: ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            //Radio list
            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Pentagon", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Pentagon }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Hexagon", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Hexagon }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Circle", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Circle }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Star", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Star }
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(_polyCount = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "PolyCount: ", GUIRenderer.MonospaceFont, Color.DimGray, Color.White));


            renderer._backgroundTextureLoader = textureLoader;

            baseList.ParentResized(screenCanvas.Dimensions);
        }