public void AddPlayerToLobby(string Player) { G2DLabel label = new G2DLabel(Player); label.Text = Player; label.TextFont = textFont; label.Bounds = new Rectangle(10, (count * 15 + 5), 100, 15); this.AddChild(label); count++; }
private void CreateObject() { G2DPanel frame = new G2DPanel(); frame.Bounds = new Rectangle(0, 0, 800, 600); frame.Border = GoblinEnums.BorderFactory.LineBorder; frame.Transparency = 1.0f; // Ranges from 0 (fully transparent) to 1 (fully opaque) frame.BackgroundColor = Color.Black; SpriteFont textBoxFont = Content.Load<SpriteFont>("TextBoxFont"); SpriteFont textFont = Content.Load<SpriteFont>("TextFont"); G2DLabel label = new G2DLabel(); label.TextFont = textFont; label.TextColor = Color.Yellow; label.Bounds = new Rectangle(10, 100, 780, 200); label.Text = "Type Target ID and Press Enter"; textF = new G2DTextField(); textF.TextFont = textBoxFont; textF.TextColor = Color.Black; textF.Bounds = new Rectangle(10, 200, 780, 200); textF.Editable = false; textF.Text = ""; frame.AddChild(label); frame.AddChild(textF); scene.UIRenderer.Add2DComponent(frame); }
/// <summary> /// Creates the Menus /// </summary> private void CreateMainMenu() { if (!menuMusic.IsPlaying) { menuMusic = soundBank.GetCue("Plunder"); menuMusic.Play(); } // Create the main panel which holds all other GUI components frame = new G2DPanel(); frame.Bounds = new Rectangle(337, 175, 350, 210); frame.Border = GoblinEnums.BorderFactory.LineBorder; frame.Transparency = 0.7f; // Ranges from 0 (fully transparent) to 1 (fully opaque) frame2 = new G2DPanel(); frame2.Bounds = new Rectangle(262, 150, 500, 300); frame2.Border = GoblinEnums.BorderFactory.LineBorder; frame2.Transparency = 0.7f; // Ranges from 0 (fully transparent) to 1 (fully opaque) //Frame after winning winners = new G2DPanel(); winners.Bounds = new Rectangle(175, 400, 350, 210); winners.Border = GoblinEnums.BorderFactory.LineBorder; winners.Transparency = 0f; // Ranges from 0 (fully transparent) to 1 (fully opaque) howto = new G2DPanel(); howto.Bounds = new Rectangle(250, 175, 650, 400); howto.Texture = Content.Load<Texture2D>(tutorial1); howto.Border = GoblinEnums.BorderFactory.LineBorder; howto.Transparency = 1f; G2DButton localPlay = new G2DButton("Local Play"); localPlay.Bounds = new Rectangle(120, 30, 100, 30); localPlay.Name = "localPlay"; localPlay.TextFont = textFont; localPlay.Texture = Content.Load<Texture2D>("Images\\three"); localPlay.HighlightColor = Color.Red; localPlay.ActionPerformedEvent += new ActionPerformed(HandleLocalPlay); G2DButton networkPlay = new G2DButton("Network Play"); networkPlay.Bounds = new Rectangle(120, 70, 100, 30); networkPlay.Name = "networkPlay"; networkPlay.TextFont = textFont; networkPlay.Texture = Content.Load<Texture2D>("Images\\three"); networkPlay.HighlightColor = Color.Red; networkPlay.ActionPerformedEvent += new ActionPerformed(HandleNetworkPlay); G2DButton store = new G2DButton("Store"); store.Bounds = new Rectangle(120, 110, 100, 30); store.Name = "store"; store.TextFont = textFont; store.Texture = Content.Load<Texture2D>("Images\\three"); store.HighlightColor = Color.Red; store.ActionPerformedEvent += new ActionPerformed(HandleStore); G2DButton howToPlay = new G2DButton("How To Play"); howToPlay.Bounds = new Rectangle(120, 150, 100, 30); howToPlay.Name = "howToPlay"; howToPlay.TextFont = textFont; howToPlay.Texture = Content.Load<Texture2D>("Images\\three"); howToPlay.HighlightColor = Color.Red; howToPlay.ActionPerformedEvent += new ActionPerformed(howToPlay_ActionPerformedEvent); ///////////////////////////////////////////////////////////////////////////////// G2DButton startGame = new G2DButton("Start Game"); startGame.Bounds = new Rectangle(120, 30, 100, 30); startGame.Name = "startGame"; startGame.TextFont = textFont; startGame.Texture = Content.Load<Texture2D>("Images\\three"); startGame.HighlightColor = Color.Red; startGame.ActionPerformedEvent += new ActionPerformed(HandleStartGame); G2DButton hostGame = new G2DButton("Host Game"); hostGame.Bounds = new Rectangle(120, 30, 100, 30); hostGame.Name = "hostGame"; hostGame.TextFont = textFont; hostGame.Texture = Content.Load<Texture2D>("Images\\three"); hostGame.HighlightColor = Color.Red; hostGame.ActionPerformedEvent += new ActionPerformed(HandleHostGame); G2DButton joinGame = new G2DButton("Join Game"); joinGame.Bounds = new Rectangle(120, 70, 100, 30); joinGame.Name = "joinGame"; joinGame.TextFont = textFont; joinGame.Texture = Content.Load<Texture2D>("Images\\three"); joinGame.HighlightColor = Color.Red; joinGame.ActionPerformedEvent += new ActionPerformed(HandleJoinGame); G2DButton buyUpgrades = new G2DButton("Buy Upgrades"); buyUpgrades.Bounds = new Rectangle(120, 30, 100, 30); buyUpgrades.Name = "buyUpgrades"; buyUpgrades.TextFont = textFont; buyUpgrades.Texture = Content.Load<Texture2D>("Images\\three"); buyUpgrades.HighlightColor = Color.Red; buyUpgrades.ActionPerformedEvent += new ActionPerformed(HandleBuyUpgrades); G2DButton back = new G2DButton("Back"); back.Bounds = new Rectangle(120, 150, 100, 30); back.Name = "back"; back.TextFont = textFont; back.Texture = Content.Load<Texture2D>("Images\\three"); back.HighlightColor = Color.Red; back.ActionPerformedEvent += new ActionPerformed(HandleBack); G2DButton back2 = new G2DButton("Back"); back2.Bounds = new Rectangle(110, 160, 100, 30); back2.Name = "back2"; back2.TextFont = textFont; back2.Texture = Content.Load<Texture2D>("Images\\three"); back2.HighlightColor = Color.Red; back2.ActionPerformedEvent += new ActionPerformed(HandleBack); G2DButton save = new G2DButton("Save"); save.Bounds = new Rectangle(230, 160, 100, 30); save.Name = "save"; save.TextFont = textFont; save.Texture = Content.Load<Texture2D>("Images\\three"); save.HighlightColor = Color.Red; save.ActionPerformedEvent += new ActionPerformed(HandleSave); G2DButton quit = new G2DButton("Quit"); quit.Bounds = new Rectangle(120, 190, 100, 30); quit.Name = "quit"; quit.TextFont = textFont; quit.Texture = Content.Load<Texture2D>("Images\\three"); quit.HighlightColor = Color.Red; quit.ActionPerformedEvent += new ActionPerformed(HandleQuit); ////////////////////////////*****Store****////////////////////////////////// G2DButton upgradeSpeed = new G2DButton("Upgrade Speed"); upgradeSpeed.Bounds = new Rectangle(20, 30, 130, 30); upgradeSpeed.Name = "upgradeSpeed"; upgradeSpeed.TextFont = textFont; upgradeSpeed.Texture = Content.Load<Texture2D>("Images\\three"); upgradeSpeed.HighlightColor = Color.Red; upgradeSpeed.ActionPerformedEvent += new ActionPerformed(upgradeSpeed_ActionPerformedEvent); G2DButton upgradeArmour = new G2DButton("Upgrade Armour"); upgradeArmour.Bounds = new Rectangle(20, 70, 130, 30); upgradeArmour.Name = "upgradeArmour"; upgradeArmour.TextFont = textFont; upgradeArmour.Texture = Content.Load<Texture2D>("Images\\three"); upgradeArmour.HighlightColor = Color.Red; upgradeArmour.ActionPerformedEvent += new ActionPerformed(upgradeArmour_ActionPerformedEvent); G2DButton upgradeMissle = new G2DButton("Upgrade Missle"); upgradeMissle.Bounds = new Rectangle(20, 110, 130, 30); upgradeMissle.Name = "upgradeMissle"; upgradeMissle.TextFont = textFont; upgradeMissle.Texture = Content.Load<Texture2D>("Images\\three"); upgradeMissle.HighlightColor = Color.Red; upgradeMissle.ActionPerformedEvent += new ActionPerformed(upgradeMissle_ActionPerformedEvent); howtonext = new G2DButton("Next"); howtonext.Bounds = new Rectangle(225, 350, 130, 30); howtonext.Name = "howtonext"; howtonext.TextFont = textFont; howtonext.Texture = Content.Load<Texture2D>("Images\\three"); howtonext.HighlightColor = Color.Red; //change howtonext.ActionPerformedEvent += new ActionPerformed(howtonext_ActionPerformedEvent); howtomenu = new G2DButton("Main Menu"); howtomenu.Bounds = new Rectangle(450, 350, 130, 30); howtomenu.Name = "howtonext"; howtomenu.TextFont = textFont; howtomenu.Texture = Content.Load<Texture2D>("Images\\three"); howtomenu.HighlightColor = Color.Red; //change howtomenu.ActionPerformedEvent += new ActionPerformed(howtomenu_ActionPerformedEvent); howtoback = new G2DButton("Back"); howtoback.Bounds = new Rectangle(25, 350, 130, 30); howtoback.Name = "howtoback"; howtoback.TextFont = textFont; howtoback.Texture = Content.Load<Texture2D>("Images\\three"); howtoback.HighlightColor = Color.Red; howtoback.ActionPerformedEvent += new ActionPerformed(howtoback_ActionPerformedEvent); missleLevel = new G2DLabel(); missleLevel.Bounds = new Rectangle(170, 115, 130, 30); missleLevel.Name = "missleLevel"; missleLevel.TextFont = textFont; armourLevel = new G2DLabel(); armourLevel.Bounds = new Rectangle(170, 75, 130, 30); armourLevel.Name = "armourLevel"; armourLevel.TextFont = textFont; speedLevel = new G2DLabel(); speedLevel.Bounds = new Rectangle(170, 35, 130, 30); speedLevel.Name = "speedLevel"; speedLevel.TextFont = textFont; missleCost = new G2DLabel(); missleCost.Bounds = new Rectangle(270, 115, 130, 30); missleCost.Name = "missleCost"; missleCost.TextFont = textFont; armourCost = new G2DLabel(); armourCost.Bounds = new Rectangle(270, 75, 130, 30); armourCost.Name = "armourCost"; armourCost.TextFont = textFont; speedCost = new G2DLabel(); speedCost.Bounds = new Rectangle(270, 35, 130, 30); speedCost.Name = "speedCost"; speedCost.TextFont = textFont; moneyLevel = new G2DLabel(); moneyLevel.Bounds = new Rectangle(370, 35, 130, 30); moneyLevel.Name = "moneyLevel"; moneyLevel.TextFont = textFont; moneyLevel.TextColor = Color.ForestGreen; ////////////////////////////////////////////////////////////////////////////// scene.UIRenderer.Add2DComponent(frame); scene.UIRenderer.Add2DComponent(frame2); scene.UIRenderer.Add2DComponent(winners);// added this scene.UIRenderer.Add2DComponent(howto); frame.AddChild(localPlay); frame.AddChild(networkPlay); frame.AddChild(store); frame.AddChild(startGame); frame.AddChild(joinGame); frame.AddChild(hostGame); frame.AddChild(buyUpgrades); frame.AddChild(back); frame.AddChild(howToPlay); frame2.AddChild(upgradeSpeed); frame2.AddChild(upgradeArmour); frame2.AddChild(upgradeMissle); frame2.AddChild(back2); frame2.AddChild(save); frame2.AddChild(speedLevel); frame2.AddChild(armourLevel); frame2.AddChild(missleLevel); frame2.AddChild(moneyLevel); frame2.AddChild(missleCost); frame2.AddChild(speedCost); frame2.AddChild(armourCost); howto.AddChild(howtonext); howto.AddChild(howtoback); howto.AddChild(howtomenu); localPlay.Enabled = true; networkPlay.Enabled = true; store.Enabled = true; startGame.Enabled = false; joinGame.Enabled = false; hostGame.Enabled = false; buyUpgrades.Enabled = false; back.Enabled = false; upgradeSpeed.Enabled = false; upgradeArmour.Enabled = false; upgradeMissle.Enabled = false; howToPlay.Enabled = true; frame2.Enabled = false; frame2.Visible = false; startGame.Visible = false; joinGame.Visible = false; hostGame.Visible = false; buyUpgrades.Visible = false; back.Visible = false; upgradeSpeed.Visible = false; upgradeArmour.Visible = false; upgradeMissle.Visible = false; howToPlay.Visible = true; howto.Visible = false; howto.Enabled = false; howtonext.Visible = false; howtonext.Enabled = false; howtoback.Visible = false; howtoback.Enabled = false; howtomenu.Visible = false; howtomenu.Enabled = false; }
private void CreateControlPanel() { objectFrame = new G2DPanel(); objectFrame.Bounds = new Rectangle(670, State.Height - 200, 120, 190); objectFrame.Border = GoblinEnums.BorderFactory.LineBorder; objectFrame.BorderColor = Color.Gold; // Ranges from 0 (fully transparent) to 1 (fully opaque) objectFrame.Transparency = 0.5f; //Label for rotation G2DLabel label1 = new G2DLabel("Object Rotates along:"); label1.TextFont = textFont; label1.Bounds = new Rectangle(5, 5, 80, 20); // Create radio button for x-axis rotation. G2DRadioButton radioX = new G2DRadioButton("x-axis"); radioX.TextFont = textFont; radioX.Bounds = new Rectangle(5, 15, 80, 20); radioX.ActionPerformedEvent += new ActionPerformed(HandleActionPerformedAxisX); // Create radio button for y-axis rotation. G2DRadioButton radioY = new G2DRadioButton("y-axis"); radioY.TextFont = textFont; radioY.Bounds = new Rectangle(5, 30, 80, 20); radioY.ActionPerformedEvent += new ActionPerformed(HandleActionPerformedAxisY); // Create radio button for z-axis rotation. G2DRadioButton radioZ = new G2DRadioButton("z-axis"); radioZ.TextFont = textFont; radioZ.Bounds = new Rectangle(5, 45, 80, 20); radioZ.ActionPerformedEvent += new ActionPerformed(HandleActionPerformedAxisZ); //Create a ButtonGroup object which controls the radio button selections group1 = new ButtonGroup(); group1.Add(radioX); group1.Add(radioY); group1.Add(radioZ); //Label for rotation direction. G2DLabel label2 = new G2DLabel("Rotation Direction:"); label2.TextFont = textFont; label2.Bounds = new Rectangle(5, 65, 80, 20); // Create radio button for clockwise G2DRadioButton clockwise = new G2DRadioButton("Clockwise"); clockwise.TextFont = textFont; clockwise.Bounds = new Rectangle(5, 80, 80, 20); clockwise.ActionPerformedEvent += new ActionPerformed(HandleActionPerformedDirection); // Create radio button for counterclockwise. G2DRadioButton counterclockwise = new G2DRadioButton("Counterclockwise"); counterclockwise.TextFont = textFont; counterclockwise.Bounds = new Rectangle(5, 95, 80, 20); counterclockwise.ActionPerformedEvent += new ActionPerformed(HandleActionPerformedDirection); //Create a ButtonGroup object which controls the radio button selections. group2 = new ButtonGroup(); group2.Add(clockwise); group2.Add(counterclockwise); //Label for speed G2DLabel label3 = new G2DLabel("Rotation Speed:"); label3.TextFont = textFont; label3.Bounds = new Rectangle(5, 115, 80, 20); //Slider for speed of rotation slider = new G2DSlider(); slider.TextFont = textFont; slider.Bounds = new Rectangle(5, 145, 110, 20); slider.Maximum = 8; slider.Minimum = 0; slider.MajorTickSpacing = 0; slider.MinorTickSpacing = 1; slider.Value = 0; slider.PaintTicks = true; slider.PaintLabels = true; slider.StateChangedEvent += new StateChanged(HandleStateChangedSpeed); G2DButton reset = new G2DButton("Reset"); reset.Bounds = new Rectangle(5, 165, 55, 20); reset.TextFont = textFont; reset.ActionPerformedEvent += new ActionPerformed(HandleActionReset); G2DButton rotate = new G2DButton("Rotate"); rotate.Bounds = new Rectangle(65, 165, 50, 20); rotate.ActionPerformedEvent += new ActionPerformed(HandleActionRotate); rotate.TextFont = textFont; objectFrame.AddChild(label1); objectFrame.AddChild(radioX); objectFrame.AddChild(radioY); objectFrame.AddChild(radioZ); objectFrame.AddChild(label2); objectFrame.AddChild(clockwise); objectFrame.AddChild(counterclockwise); objectFrame.AddChild(label3); objectFrame.AddChild(slider); objectFrame.AddChild(reset); objectFrame.AddChild(rotate); scene.UIRenderer.Add2DComponent(objectFrame); }
private void Create2DGUI() { p1Frame = new G2DPanel(); p1Frame.Bounds = new Rectangle(0, 0, 150, 80); p1Frame.Border = GoblinEnums.BorderFactory.LineBorder; p1Frame.Transparency = 1.0f; p1Frame.BackgroundColor = Color.CornflowerBlue; //Generic Label: P1 G2DLabel p1Label = new G2DLabel("P1: "); p1Label.Bounds = new Rectangle(10, 10, 10, 10); p1Label.TextFont = uiFont; //Life Point Label: P1 p1LifeLab = new G2DLabel(); p1LifeLab.Bounds = new Rectangle(25, 10, 20, 40); p1LifeLab.Text = p1life.ToString() + " LP"; p1LifeLab.TextFont = uiFont; //Generic Label: P1M1 G2DLabel p1m1StatLab = new G2DLabel("M1: "); p1m1StatLab.Bounds = new Rectangle(10, 25, 10, 10); p1m1StatLab.TextFont = uiFont; //Status Label: P1M1 p1m1LifeLab = new G2DLabel(); p1m1LifeLab.Bounds = new Rectangle(25, 25, 20, 40); p1m1LifeLab.TextFont = uiFont; //Generic Label: P1M2 G2DLabel p1m2StatLab = new G2DLabel("M2: "); p1m2StatLab.Bounds = new Rectangle(10, 40, 10, 10); p1m2StatLab.TextFont = uiFont; //Status Label: P1M2 p1m2LifeLab = new G2DLabel(); p1m2LifeLab.Bounds = new Rectangle(25, 40, 20, 40); p1m2LifeLab.TextFont = uiFont; //Generic Label: P1M3 G2DLabel p1m3StatLab = new G2DLabel("M3: "); p1m3StatLab.Bounds = new Rectangle(10, 55, 10, 10); p1m3StatLab.TextFont = uiFont; //Status Label: P1M3 p1m3LifeLab = new G2DLabel(); p1m3LifeLab.Bounds = new Rectangle(25, 55, 20, 40); p1m3LifeLab.TextFont = uiFont; p1Frame.AddChild(p1Label); p1Frame.AddChild(p1LifeLab); p1Frame.AddChild(p1m1StatLab); p1Frame.AddChild(p1m1LifeLab); p1Frame.AddChild(p1m2StatLab); p1Frame.AddChild(p1m2LifeLab); p1Frame.AddChild(p1m3StatLab); p1Frame.AddChild(p1m3LifeLab); scene.UIRenderer.Add2DComponent(p1Frame); p2Frame = new G2DPanel(); p2Frame.Bounds = new Rectangle(650, 0, 150, 80); p2Frame.Border = GoblinEnums.BorderFactory.LineBorder; p2Frame.Transparency = 1.0f; p2Frame.BackgroundColor = Color.CornflowerBlue; //Generic Label: P2 G2DLabel p2Label = new G2DLabel("P2: "); p2Label.Bounds = new Rectangle(15, 10, 10, 10); p2Label.TextFont = uiFont; //Life Point Label: P2 p2LifeLab = new G2DLabel(); p2LifeLab.Bounds = new Rectangle(35, 10, 40, 40); p2LifeLab.Text = p2life.ToString() + " LP"; p2LifeLab.TextFont = uiFont; //Generic Label: P2M1 G2DLabel p2m1StatLab = new G2DLabel("M1: "); p2m1StatLab.Bounds = new Rectangle(15, 25, 10, 10); p2m1StatLab.TextFont = uiFont; //Status Label: P2M1 p2m1LifeLab = new G2DLabel(); p2m1LifeLab.Bounds = new Rectangle(35, 25, 20, 40); p2m1LifeLab.TextFont = uiFont; //Generic Label: P2M2 G2DLabel p2m2StatLab = new G2DLabel("M2: "); p2m2StatLab.Bounds = new Rectangle(15, 40, 10, 10); p2m2StatLab.TextFont = uiFont; //Status Label: P2M2 p2m2LifeLab = new G2DLabel(); p2m2LifeLab.Bounds = new Rectangle(35, 40, 20, 40); p2m2LifeLab.TextFont = uiFont; //Generic Label: P2M3 G2DLabel p2m3StatLab = new G2DLabel("M3: "); p2m3StatLab.Bounds = new Rectangle(15, 55, 10, 10); p2m3StatLab.TextFont = uiFont; //Status Label: P2M3 p2m3LifeLab = new G2DLabel(); p2m3LifeLab.Bounds = new Rectangle(35, 55, 20, 40); p2m3LifeLab.TextFont = uiFont; p2Frame.AddChild(p2Label); p2Frame.AddChild(p2LifeLab); p2Frame.AddChild(p2m1StatLab); p2Frame.AddChild(p2m1LifeLab); p2Frame.AddChild(p2m2StatLab); p2Frame.AddChild(p2m2LifeLab); p2Frame.AddChild(p2m3StatLab); p2Frame.AddChild(p2m3LifeLab); scene.UIRenderer.Add2DComponent(p2Frame); }
public HUD(SpriteFont uiFont,Texture2D health) { Border = GoblinEnums.BorderFactory.LineBorder; Transparency = 0.5f; // Ranges from 0 (fully transparent) to 1 (fully opaque) BackgroundColor = Color.Gray; healthPicture = health; DrawBackground = true; healthImage = new G2DPanel(); healthImage.Texture = healthPicture; healthImage.Bounds = new Rectangle(0, 0, 80, 80); healthImage.Transparency = 1.0f; healthImage.Border = GoblinEnums.BorderFactory.LineBorder; healthImage.DrawBackground = true; healthImage.Visible = true; healthImage.DrawBorder = true; AddChild(healthImage); healthLabel = new G2DLabel(); healthLabel.Bounds = new Rectangle(100, 0, 50, 80); healthLabel.TextTransparency = 0.5f; healthLabel.TextFont = uiFont; healthLabel.VerticalAlignment = GoblinEnums.VerticalAlignment.Center; AddChild(healthLabel); TextFont = uiFont; }
private void CreateSolar2DGUI() { // Create the main panel which holds all other GUI components G2DPanel frame = new G2DPanel(); frame.Bounds = new Rectangle(10, State.Height - 170, 90, 160); frame.Border = GoblinEnums.BorderFactory.LineBorder; frame.BorderColor = Color.Gold; // Ranges from 0 (fully transparent) to 1 (fully opaque) frame.Transparency = 0.2f; //Label for the panel. G2DLabel label1 = new G2DLabel("Camera Control"); label1.TextFont = textFont2; label1.Bounds = new Rectangle(5, 2, 80, 15); //Label for the first slider. G2DLabel label2 = new G2DLabel("-4 x-axis 4"); label2.TextFont = textFont1; label2.Bounds = new Rectangle(5, 15, 80, 15); // Create a slider (moving camera along x axis). G2DSlider slider1 = new G2DSlider(); slider1.TextFont = textFont1; slider1.Bounds = new Rectangle(5, 40, 80, 15); slider1.Maximum = 4; slider1.Minimum = -4; slider1.MajorTickSpacing = 0; slider1.MinorTickSpacing = 1; slider1.Value = 0; slider1.PaintTicks = true; slider1.PaintLabels = true; slider1.StateChangedEvent += new StateChanged(HandleStateChanged1); //Label for the second slider G2DLabel label3 = new G2DLabel("-4 y-axis 4"); label3.TextFont = textFont1; label3.Bounds = new Rectangle(5, 65, 80, 15); // Create a slider (moving camera along y axis). G2DSlider slider2 = new G2DSlider(); slider2.TextFont = textFont1; slider2.Bounds = new Rectangle(5, 90, 80, 15); slider2.Maximum = 4; slider2.Minimum = -4; slider2.MajorTickSpacing = 0; slider2.MinorTickSpacing = 1; slider2.Value = 0; slider2.PaintTicks = true; slider2.PaintLabels = true; slider2.StateChangedEvent += new StateChanged(HandleStateChanged2); //Label for the third slider. G2DLabel label4 = new G2DLabel("-4 z-axis 4"); label4.TextFont = textFont1; label4.Bounds = new Rectangle(5, 115, 80, 15); // Create a slider (moving camera along z axis). G2DSlider slider3 = new G2DSlider(); slider3.TextFont = textFont1; slider3.Bounds = new Rectangle(5, 140, 80, 15); slider3.Maximum = 4; slider3.Minimum = -4; slider3.MajorTickSpacing = 0; slider3.MinorTickSpacing = 1; slider3.Value = 0; slider3.PaintTicks = true; slider3.PaintLabels = true; slider3.StateChangedEvent += new StateChanged(HandleStateChanged3); //Add labels and sliders to the frame frame.AddChild(label1); frame.AddChild(label2); frame.AddChild(label3); frame.AddChild(label4); frame.AddChild(slider1); frame.AddChild(slider2); frame.AddChild(slider3); //Render the frame and add the frame to the scene. scene.UIRenderer.Add2DComponent(frame); }