public override void Init() { Content.ContentPath = "Data"; InterfaceScene = new Graphics.Interface.InterfaceScene(this); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "TopRight", Anchor = Orientation.TopRight }); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "BottomLeft", Anchor = Orientation.BottomLeft }); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "BottomRight", Anchor = Orientation.BottomRight }); InterfaceScene.Add(new Graphics.Interface.Button { Size = new Vector2(100, 20), Text = "Button", Anchor = Orientation.Center }); InterfaceScene.Add(cb = new Graphics.Interface.Checkbox { Size = new Vector2(100, 20), Text = "Checkbox", Anchor = Orientation.Center, Position = new Vector2(0, 40) }); InterfaceScene.Add(pb = new Graphics.Interface.ProgressBar { Size = new Vector2(100, 100), Text = "Button", Anchor = Orientation.Bottom, MaxValue = 100, Value = 50, ProgressGraphic = new ImageGraphic { Texture = new TextureFromFile("cornellbox3.png"), //new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(Color.Red) }, TextureAnchor = Orientation.BottomLeft }, ProgressOrientation = Graphics.Interface.ProgressOrientation.BottomToTop }); InterfaceScene.Add(dpb = new Graphics.Interface.DeltaProgressBar { Size = new Vector2(140, 10), Anchor = Orientation.Center, MaxValue = 100, Value = 70, Position = new Vector2(0, -30), ProgressOrientation = Graphics.Interface.ProgressOrientation.LeftToRight }); Button bb; InterfaceScene.Add(bb = new Button { Size = new Vector2(50, 20), Text = "-", Anchor = Orientation.Center, Position = new Vector2(-30, -60) }); bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value - 20, 0, 100); }; InterfaceScene.Add(bb = new Button { Size = new Vector2(50, 20), Text = "+", Anchor = Orientation.Center, Position = new Vector2(30, -60) }); bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value + 20, 0, 100); }; InterfaceScene.Add(new Graphics.Interface.Console { Anchor = Orientation.Bottom, Position = new Vector2(0, 100), Size = new Vector2(400, 100) }); var f = new Graphics.Interface.Form { Size = new Vector2(300, 300) }; InterfaceScene.Add(f); b = new Graphics.Interface.Button { Size = new Vector2(100, 20), Text = "TopLeft", Anchor = Orientation.TopLeft }; f.AddChild(b); Control checker; InterfaceScene.Add(checker = new Control { Background = new ImageGraphic { Size = new Vector2(100, 100), Texture = new TextureFromFile("checker.png") }, Size = new Vector2(100, 100), Position = new Vector2(10, 30), Anchor = Orientation.TopRight, Clickable = true, PickingLocalBounding = new Common.Bounding.Chain { Boundings = new object[] { new BoundingBox(Vector3.Zero, new Vector3(1, 1, 0)), new MetaBoundingImageGraphic { Graphic = new ImageGraphic { Size = new Vector2(100, 100), Texture = new TextureFromFile("checker.png") }, } }, Shallow = true } }); InterfaceScene.Add(popupContainer); InterfaceScene.Add(new Form { Anchor = Orientation.Right, Size = new Vector2(100, 100), ControlBox = true }); tt = new Graphics.Interface.ToolTip(); tt.SetToolTip(pb, "This is a progress bar"); tt.SetToolTip(checker, "Checker"); InterfaceScene.Add(tt); if (Direct3DVersion == Direct3DVersion.Direct3D10) InterfaceRenderer = new Graphics.Interface.InterfaceRenderer10(Device10) { Scene = InterfaceScene }; else InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9) { Scene = InterfaceScene, StateManager = new Device9StateManager(Device9) }; InterfaceRenderer.Initialize(this); InputHandler = Manager = new Graphics.Interface.InterfaceManager { Scene = InterfaceScene }; //bvr = new BoundingVolumesRenderer //{ // View = this, // StateManager = sm //}; }
public override void Init() { Content.ContentPath = "Data"; InterfaceScene = new Graphics.Interface.InterfaceScene(this); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "TopRight", Anchor = Orientation.TopRight }); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "BottomLeft", Anchor = Orientation.BottomLeft }); InterfaceScene.Add(new Graphics.Interface.TextBox { Size = new Vector2(100, 20), Text = "BottomRight", Anchor = Orientation.BottomRight }); InterfaceScene.Add(new Graphics.Interface.Button { Size = new Vector2(100, 20), Text = "Button", Anchor = Orientation.Center }); InterfaceScene.Add(cb = new Graphics.Interface.Checkbox { Size = new Vector2(100, 20), Text = "Checkbox", Anchor = Orientation.Center, Position = new Vector2(0, 40) }); InterfaceScene.Add(pb = new Graphics.Interface.ProgressBar { Size = new Vector2(100, 100), Text = "Button", Anchor = Orientation.Bottom, MaxValue = 100, Value = 50, ProgressGraphic = new ImageGraphic { Texture = new TextureFromFile("cornellbox3.png"), //new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(Color.Red) }, TextureAnchor = Orientation.BottomLeft }, ProgressOrientation = Graphics.Interface.ProgressOrientation.BottomToTop }); InterfaceScene.Add(dpb = new Graphics.Interface.DeltaProgressBar { Size = new Vector2(140, 10), Anchor = Orientation.Center, MaxValue = 100, Value = 70, Position = new Vector2(0, -30), ProgressOrientation = Graphics.Interface.ProgressOrientation.LeftToRight }); Button bb; InterfaceScene.Add(bb = new Button { Size = new Vector2(50, 20), Text = "-", Anchor = Orientation.Center, Position = new Vector2(-30, -60) }); bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value - 20, 0, 100); }; InterfaceScene.Add(bb = new Button { Size = new Vector2(50, 20), Text = "+", Anchor = Orientation.Center, Position = new Vector2(30, -60) }); bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value + 20, 0, 100); }; InterfaceScene.Add(new Graphics.Interface.Console { Anchor = Orientation.Bottom, Position = new Vector2(0, 100), Size = new Vector2(400, 100) }); var f = new Graphics.Interface.Form { Size = new Vector2(300, 300) }; InterfaceScene.Add(f); b = new Graphics.Interface.Button { Size = new Vector2(100, 20), Text = "TopLeft", Anchor = Orientation.TopLeft }; f.AddChild(b); Control checker; InterfaceScene.Add(checker = new Control { Background = new ImageGraphic { Size = new Vector2(100, 100), Texture = new TextureFromFile("checker.png") }, Size = new Vector2(100, 100), Position = new Vector2(10, 30), Anchor = Orientation.TopRight, Clickable = true, PickingLocalBounding = new Common.Bounding.Chain { Boundings = new object[] { new BoundingBox(Vector3.Zero, new Vector3(1, 1, 0)), new MetaBoundingImageGraphic { Graphic = new ImageGraphic { Size = new Vector2(100, 100), Texture = new TextureFromFile("checker.png") }, } }, Shallow = true } }); InterfaceScene.Add(popupContainer); InterfaceScene.Add(new Form { Anchor = Orientation.Right, Size = new Vector2(100, 100), ControlBox = true }); tt = new Graphics.Interface.ToolTip(); tt.SetToolTip(pb, "This is a progress bar"); tt.SetToolTip(checker, "Checker"); InterfaceScene.Add(tt); if (Direct3DVersion == Direct3DVersion.Direct3D10) { InterfaceRenderer = new Graphics.Interface.InterfaceRenderer10(Device10) { Scene = InterfaceScene } } ; else { InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9) { Scene = InterfaceScene, StateManager = new Device9StateManager(Device9) } }; InterfaceRenderer.Initialize(this); InputHandler = Manager = new Graphics.Interface.InterfaceManager { Scene = InterfaceScene }; //bvr = new BoundingVolumesRenderer //{ // View = this, // StateManager = sm //}; } Graphics.Interface.ToolTip tt; Graphics.Interface.Button b;