public override void Initialize() { Viewport vp = manager.UI.GraphicsDevice.Viewport; settings = new ControlGroup(); int pad = (int)(0.05f * vp.Width); Rectangle pArea = new Rectangle(pad, (int)(0.15f * vp.Height), vp.Width - 2 * pad, (int)(0.35f * vp.Height)); settings.Add(new Panel("Main Panel", pArea, new Color(0, 0, 0, 100))); settings.Add(new Label("Graphics Settings", new Rectangle(pArea.X, pArea.Y, pArea.Width, (int)Fonts.Arial.MeasureString("Graphics Settings").Y), Label.Fit.AlignCenter)); ControlMat mat = new ControlMat(pArea, 4, 3, 5); Checkbox drawDetailBox = new Checkbox("Terrain Detail", new Rectangle(0, 0, 50, 50)); drawDetailBox.SetState(Sim.Settings.Graphics.Default.TerrainDetail); drawDetailBox.StateChanged += delegate() { Sim.Settings.Graphics.Default.TerrainDetail = drawDetailBox.State; }; settings.Add(drawDetailBox); int bHeight = (int)(0.05f * vp.Height); int bWidth = (int)(0.125f * vp.Width); Button backButton = new Button("Back", new Rectangle(pad, vp.Height - bHeight - pad, bWidth, bHeight), delegate() { manager.ChangeScreen(new MenuScreen(manager)); }); settings.Add(backButton); Button applyButton = new Button("Apply", new Rectangle(vp.Width - bWidth - pad, backButton.Area.Y, bWidth, bHeight), delegate() { }); settings.Add(applyButton); }
public override void Initialize() { Viewport vp = manager.UI.GraphicsDevice.Viewport; settings = new ControlGroup(); int pad = (int)(0.05f * vp.Width); Rectangle pArea = new Rectangle(pad, (int)(0.15f * vp.Height), vp.Width - 2 * pad, (int)(0.35f * vp.Height)); settings.Add(new Panel("Main Panel", pArea, new Color(0, 0, 0, 100))); settings.Add(new Label("Graphics Settings", new Rectangle(pArea.X, pArea.Y, pArea.Width, (int)Fonts.Arial.MeasureString("Graphics Settings").Y), Label.Fit.AlignCenter)); ControlMat mat = new ControlMat(pArea, 4, 3, 5); Checkbox drawDetailBox = new Checkbox("Terrain Detail", new Rectangle(0, 0, 50, 50)); drawDetailBox.SetState(Sim.Settings.Graphics.Default.TerrainDetail); drawDetailBox.StateChanged += delegate() { Sim.Settings.Graphics.Default.TerrainDetail = drawDetailBox.State; }; settings.Add(drawDetailBox); int bHeight = (int)(0.05f * vp.Height); int bWidth = (int)(0.125f * vp.Width); Button backButton = new Button("Back", new Rectangle(pad, vp.Height - bHeight - pad, bWidth, bHeight), delegate() { manager.ChangeScreen(new MenuScreen(manager)); }); settings.Add(backButton); Button applyButton = new Button("Apply", new Rectangle(vp.Width - bWidth - pad, backButton.Area.Y, bWidth, bHeight), delegate() { }); settings.Add(applyButton); }
private void SetupAC(Viewport vp) { Rectangle area = new Rectangle(0, 0, vp.Width / 3, vp.Height / 3); ControlMat mat = new ControlMat(area, 10, 1, 2, ControlMat.FillOrder.RowsFirst); Label selectionLabel = new Label("Selected Target", mat.Spaces[0], Label.Fit.AlignLeft); Label nameLabel = new Label("Name: ", mat.Spaces[1], Label.Fit.AlignLeft); Label positionLabel = new Label("Position: ", mat.Spaces[2], Label.Fit.AlignLeft); Label infoLabel = new Label("Info: ", mat.Spaces[3], Label.Fit.AlignLeft); SelectionInfoChanged += delegate(object src, EventArgs e) { nameLabel.Text = src == null ? "Name:" : "Name: " + selected.Name; positionLabel.Text = src == null ? "Position:" : "Position: " + selected.Position; infoLabel.Text = src == null ? "Info:" : "Info: " + selected.Info; }; Slider separationSlider = new Slider("Separation", mat.Spaces[4], 0.0f, 1.0f); Slider cohesionSlider = new Slider("Cohesion", mat.Spaces[5], 0.0f, 1.0f); Slider wanderSlider = new Slider("Wander", mat.Spaces[6], 0.0f, 1.0f); Slider alignmentSlider = new Slider("Alignment", mat.Spaces[7], 0.0f, 1.0f); //alignmentSlider.Use += delegate(float v) { world.Wildlife.ApplySteerParameters( ac.Add(selectionLabel); ac.Add(nameLabel); ac.Add(positionLabel); ac.Add(infoLabel); ac.Disable(manager.UI); }
public override void Initialize() { Viewport vp = manager.UI.GraphicsDevice.Viewport; menu = new ControlGroup(); int mW = vp.Width / 4; int mH = vp.Height / 3; Rectangle mArea = new Rectangle((vp.Width - mW) / 2, (vp.Height - mH) / 2, mW, mH); ControlMat mat = new ControlMat(mArea, 5, 1, (int)(0.0125f * vp.Height)); menu.Add(new Button("New", mat.Spaces[1], delegate() { manager.ChangeScreen(new SetupScreen(manager)); })); //menu.Add(new Button("Settings", mat.Spaces[1], // delegate() { manager.ChangeScreen(new SettingsScreen(manager)); })); menu.Add(new Button("Return", mat.Spaces[2], delegate() { manager.ChangeScreen(manager.WorldScreen); })); menu.Add(new Button("Exit", mat.Spaces[3], delegate() { manager.UI.Game.Exit(); })); }
public override void Initialize() { Viewport vp = manager.UI.GraphicsDevice.Viewport; menu = new ControlGroup(); int mW = vp.Width / 4; int mH = vp.Height / 3; Rectangle mArea = new Rectangle((vp.Width - mW) / 2, (vp.Height - mH) / 2, mW, mH); ControlMat mat = new ControlMat(mArea, 5, 1, (int)(0.0125f * vp.Height)); menu.Add(new Button("New", mat.Spaces[1], delegate() { manager.ChangeScreen(new SetupScreen(manager)); })); //menu.Add(new Button("Settings", mat.Spaces[1], // delegate() { manager.ChangeScreen(new SettingsScreen(manager)); })); menu.Add(new Button("Return", mat.Spaces[2], delegate() { manager.ChangeScreen(manager.WorldScreen); })); menu.Add(new Button("Exit", mat.Spaces[3], delegate() { manager.UI.Game.Exit(); })); }
private void SetupCC(Viewport vp) { Camera c = manager.UI.Camera; Rectangle ccArea = new Rectangle(0, 0, (int)(vp.Width * 0.5f), vp.Height / 3); ControlMat ccSpace = new ControlMat(ccArea, 7, 1, 2, ControlMat.FillOrder.RowsFirst); cc.Add(new Label("Camera Options", ccSpace.Spaces[0], Label.Fit.AlignCenter)); Spinner <Camera.Mode> mode = new Spinner <Camera.Mode>("Mode", ccSpace.Spaces[1]); foreach (Camera.Mode cMode in Enum.GetValues(typeof(Camera.Mode))) { mode.Add(cMode); } mode.Use += delegate() { manager.UI.Camera.SetMode(mode.GetSelected()); }; c.Changed += delegate(object src, EventArgs e) { mode.Select(c.CurrentMode); }; cc.Add(mode); Slider transSpeed = new Slider("TSpeed", ccSpace.Spaces[2], 0.1f, 5.0f); transSpeed.SetValue(manager.UI.Camera.TranslateSpeed); transSpeed.Use += delegate(float v) { manager.UI.Camera.TranslateSpeed = v; }; c.Changed += delegate(object src, EventArgs e) { transSpeed.SetValue(c.TranslateSpeed); }; cc.Add(transSpeed); Slider rotSpeed = new Slider("RSpeed", ccSpace.Spaces[3], 0.02f, 0.1f); rotSpeed.SetValue(manager.UI.Camera.RotateSpeed); rotSpeed.Use += delegate(float v) { manager.UI.Camera.RotateSpeed = v; }; c.Changed += delegate(object src, EventArgs e) { rotSpeed.SetValue(c.RotateSpeed); }; cc.Add(rotSpeed); Label posInfo = new Label("Position: " + manager.UI.Camera.Position, ccSpace.Spaces[4], Label.Fit.AlignCenter); cc.Add(posInfo); Label rotInfo = new Label("Rotation: " + manager.UI.Camera.Rotation, ccSpace.Spaces[5], Label.Fit.AlignLeft); cc.Add(rotInfo); c.Changed += delegate(object src, EventArgs e) { posInfo.SetText("Position: " + c.Position, Label.Fit.AlignLeft); rotInfo.SetText("Rotation: " + c.Rotation, Label.Fit.AlignLeft); }; cc.Disable(manager.UI); }
private void SetupMenu(Viewport vp) { menu.Clear(); int menuHeight = vp.Height / 20; menuArea = new Rectangle(0, vp.Height - menuHeight, (int)(vp.Width * 0.7f), menuHeight); ControlMat menuSpace = new ControlMat(menuArea, 1, 5, 2, ControlMat.FillOrder.ColumnsFirst); int i = 0; Panel mPanel = new Panel("Menu Panel", new Rectangle(0, menuArea.Y, vp.Width, menuHeight), new Color(0, 0, 0, 128)); mPanel.Texture = UserInterface.TexButtonM; menu.Add(mPanel); menu.Add(new Button("Menu", menuSpace.Spaces[i ++], delegate() { manager.ChangeScreen(new MenuScreen(manager)); })); menu.Add(new Button("Drawing", menuSpace.Spaces[i ++], delegate() { ChangeActiveCG(gc); })); menu.Add(new Button("Wildlife", menuSpace.Spaces[i ++], delegate() { ChangeActiveCG(ac); })); menu.Add(new Button("Weather", menuSpace.Spaces[i ++], delegate() { ChangeActiveCG(wc); })); menu.Add(new Button("Camera", menuSpace.Spaces[i ++], delegate() { ChangeActiveCG(cc); })); timeLabel = new Label("Time", new Rectangle(menuSpace.Spaces[i - 1].Right, menuArea.Y, vp.Width - menuArea.Width, menuArea.Height), Label.Fit.AlignCenter); menu.Add(timeLabel); }
private void SetupWC(Viewport vp) { wc.Clear(); Sim.Environment.World world = manager.UI.Sim.World; wc.Disable(manager.UI); Rectangle wcArea = new Rectangle(0, 0, vp.Width / 2, vp.Height / 3); ControlMat wcSpace = new ControlMat(wcArea, 7, 1, 2, ControlMat.FillOrder.RowsFirst); int i = 0; wc.Add(new Label("Weather Options", wcSpace.Spaces[i++], Label.Fit.AlignCenter)); ToggleButton rain = new ToggleButton("Active", wcSpace.Spaces[i++]); rain.Use += delegate() { world.Weather.Active = !world.Weather.Active; }; wc.Add(rain); Slider turbSlider = new Slider("Turbulence", wcSpace.Spaces[i++], 0, 30); turbSlider.SetValue(Sim.Settings.Graphics.Default.WindTurbulence); turbSlider.Use += delegate(float v) { Sim.Settings.Graphics.Default.WindTurbulence = v; }; wc.Add(turbSlider); Slider windX = new Slider("Wind X", wcSpace.Spaces[i++], -75.0f, 75.0f); windX.SetValue(Sim.Settings.Graphics.Default.WindX); windX.Use += delegate(float v) { Sim.Settings.Graphics.Default.WindX = v; }; wc.Add(windX); Slider windZ = new Slider("Wind Z", wcSpace.Spaces[i++], -75.0f, 75.0f); windZ.SetValue(Sim.Settings.Graphics.Default.WindZ); windZ.Use += delegate(float v) { Sim.Settings.Graphics.Default.WindZ = v; }; wc.Add(windZ); Slider overcast = new Slider("Overcast", wcSpace.Spaces[i++], 1, 5); overcast.SetValue(Sim.Settings.Graphics.Default.Overcast); overcast.Use += delegate(float v) { Sim.Settings.Graphics.Default.Overcast = v; Shaders.Common.Parameters["overcast"].SetValue(v); }; wc.Add(overcast); }
private void SetupGC(Viewport vp) { gc.Clear(); Sim.Environment.World world = manager.UI.Sim.World; Rectangle gcArea = new Rectangle(0, 0, vp.Width / 3, (int)(vp.Height / 1.5f)); ControlMat gcSpace = new ControlMat(gcArea, 16, 1, 2, ControlMat.FillOrder.RowsFirst); int i = 0; gc.Add(new Label("Drawing Options", gcSpace.Spaces[i++], Label.Fit.AlignCenter)); Spinner <FillMode> gcFillSpinner = new Spinner <FillMode>("Fill Mode", gcSpace.Spaces[i++]); gcFillSpinner.Add(FillMode.Solid); gcFillSpinner.Add(FillMode.WireFrame); gcFillSpinner.Add(FillMode.Point); gcFillSpinner.Use += delegate() { world.FillMode = gcFillSpinner.GetSelected(); }; gc.Add(gcFillSpinner); gc.Disable(manager.UI); Sim.Settings.Graphics gs = Sim.Settings.Graphics.Default; gc.Add(new Button("Sky", gcSpace.Spaces[i ++], delegate() { world.Sky.Visible = !world.Sky.Visible; })); gc.Add(new Button("Terrain", gcSpace.Spaces[i ++], delegate() { world.Terrain.Visible = !world.Terrain.Visible; })); gc.Add(new Button("Water", gcSpace.Spaces[i ++], delegate() { world.Water.Visible = !world.Water.Visible; })); gc.Add(new Button("Axes", gcSpace.Spaces[i ++], delegate() { world.DrawAxes = !world.DrawAxes; })); gc.Add(new Button("Vegetation", gcSpace.Spaces[i ++], delegate() { world.Vegetation.Visible = !world.Vegetation.Visible; })); gc.Add(new Button("AI Nodes", gcSpace.Spaces[i ++], delegate() { world.Terrain.DrawNodes = !world.Terrain.DrawNodes; })); gc.Add(new Button("Terrain Normals", gcSpace.Spaces[i ++], delegate() { world.Terrain.DrawNormals = !world.Terrain.DrawNormals; })); gc.Add(new Button("Detail Texturing", gcSpace.Spaces[i ++], delegate() { gs.TerrainDetail = !gs.TerrainDetail; world.Terrain.Effect.Parameters["bDetailEnabled"].SetValue(gs.TerrainDetail); })); gc.Add(new Button("Bump Mapping", gcSpace.Spaces[i ++], delegate() { gs.BumpEnabled = !gs.BumpEnabled; world.Terrain.Effect.Parameters["bBumpEnabled"].SetValue(gs.BumpEnabled); })); gc.Add(new Button("Shadow Mapping", gcSpace.Spaces[i ++], delegate() { gs.ShadowsEnabled = !gs.ShadowsEnabled; Shaders.Common.Parameters["bShadowsEnabled"].SetValue(gs.ShadowsEnabled); })); gc.Add(new Button("Bloom", gcSpace.Spaces[i ++], delegate() { gs.BloomEnabled = !gs.BloomEnabled; })); Slider biSlider = new Slider("Bloom Intes.", gcSpace.Spaces[i++], 0, 10); biSlider.SetValue(1.25f); biSlider.Use += delegate(float v) { manager.UI.Sim.PostProcessManager.Bloom.SetIntensity(v); }; gc.Add(biSlider); Slider btSlider = new Slider("Bloom Thres.", gcSpace.Spaces[i++], 0, 1); btSlider.SetValue(0.6f); btSlider.Use += delegate(float v) { manager.UI.Sim.PostProcessManager.Bloom.SetThreshold(v); }; gc.Add(btSlider); Slider bbSlider = new Slider("Bloom Blur", gcSpace.Spaces[i++], 0, 20); bbSlider.SetValue(8); bbSlider.Use += delegate(float v) { manager.UI.Sim.PostProcessManager.Bloom.SetBlur(v); }; gc.Add(bbSlider); }
private void SetupTerrainComponents(Viewport vp, Rectangle settingsPanelArea) { int sliderHeight = (int)(0.05f * vp.Height); ControlMat mat = new ControlMat(settingsPanelArea, 7, 1, 10); Slider scaleX = new Slider("Length Scale", mat.Spaces[0], 0.1f, 10.0f); scaleX.SetValue(bs.ScaleX); scaleX.Use += delegate(float v) { bs.ScaleX = v; }; controls.Add(scaleX); Slider scaleY = new Slider("Height Scale", mat.Spaces[1], 0.1f, 10.0f); scaleY.SetValue(bs.ScaleY); scaleY.Use += delegate(float v) { bs.ScaleY = v; }; controls.Add(scaleY); Slider scaleZ = new Slider("Width Scale", mat.Spaces[2], 0.1f, 10.0f); scaleZ.SetValue(bs.ScaleZ); scaleZ.Use += delegate(float v) { bs.ScaleZ = v; }; controls.Add(scaleZ); Slider vegetationDensity = new Slider("Vegetation", mat.Spaces[3], 0.0f, 1.0f); vegetationDensity.SetValue(bs.VegDensity); vegetationDensity.Use += delegate(float v) { bs.VegDensity = v; }; controls.Add(vegetationDensity); Slider treeDensity = new Slider("Trees", mat.Spaces[4], 0.0f, 1.0f); treeDensity.SetValue(bs.TreeDensity); treeDensity.Use += delegate(float v) { bs.TreeDensity = v; }; controls.Add(treeDensity); Slider smoothing = new Slider("Smoothing", mat.Spaces[5], 0, 50); smoothing.SetValue(bs.Smoothing); smoothing.Use += delegate(float v) { bs.Smoothing = (int)v; }; controls.Add(smoothing); Spinner <Climate> cSpin = new Spinner <Climate>("Climate", mat.Spaces[6]); cSpin.Use += delegate() { bs.Climate = cSpin.GetSelected().ToString(); }; foreach (Climate climate in Enum.GetValues(typeof(Climate))) { cSpin.Add(climate); } cSpin.Select((Climate)Enum.Parse(typeof(Climate), bs.Climate)); controls.Add(cSpin); int y = (int)(vp.Height * 0.05f); controls.Add(new Label("Setup", new Rectangle(0, y / 2, vp.Width, y * 2), Label.Fit.AlignCenter)); }