本文整理汇总了C#中Spinner.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Spinner.Add方法的具体用法?C# Spinner.Add怎么用?C# Spinner.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spinner
的用法示例。
在下文中一共展示了Spinner.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupGC
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);
}
示例2: SetupCC
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);
}
示例3: SetupTerrainComponents
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));
}