protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); Scene.Engine.AddLogic(new LineFluidLogic(new Line(0, -1, -400), 1.95f, .02f, new Vector2D(0, 0), new Lifespan())); Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); Rectangle rect1 = Viewport.Rectangle; BoundingRectangle rect = new BoundingRectangle(rect1.Left, rect1.Top, rect1.Right, rect1.Bottom); rect.Min.X -= 75; rect.Min.Y -= 75; rect.Max.X += 75; rect.Max.Y += 75; DemoHelper.AddShell(DemoInfo, rect, 100, Scalar.PositiveInfinity).ForEach(delegate(Body b) { b.IgnoresGravity = true; }); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(340, 300)); DemoHelper.AddRagDoll(DemoInfo, new Vector2D(640, 300)); IShape shape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("fighter.png"), 3, 16, 4); DemoHelper.AddShape(DemoInfo, shape, 200, new ALVector2D(0, new Vector2D(200, 300))); DemoHelper.AddShape(DemoInfo, shape, 100, new ALVector2D(0, new Vector2D(500, 300))); DemoHelper.AddRectangle(DemoInfo, 20, 200, 25 / 5, new ALVector2D(0, 600, 600)); DemoHelper.AddRectangle(DemoInfo, 20, 200, 25 / 5, new ALVector2D(0, 600, 620)); DemoHelper.AddRectangle(DemoInfo, 50, 100, 50, new ALVector2D(0, 200, 400)); DemoHelper.AddRectangle(DemoInfo, 50, 100, 50, new ALVector2D(0, 400, 200)); Vector2D[] waterVertexes = new Vector2D[4] { new Vector2D(-10, 400), new Vector2D(10000, 400), new Vector2D(10000, 1000), new Vector2D(-10, 1000) }; ScalarColor3[] waterColor = new ScalarColor3[4] { new ScalarColor3(0, 0, 1), new ScalarColor3(0, 0, 1), new ScalarColor3(0, 0, 1), new ScalarColor3(0, 0, 1) }; Colored3VertexesDrawable drawable = new Colored3VertexesDrawable(Gl.GL_QUADS, waterVertexes, waterColor); Graphic graphic = new Graphic(drawable, Matrix2x3.Identity, new Lifespan()); graphic.ZOrder = -1; Scene.AddGraphic(graphic); }
protected override void Open() { Scene.IsPaused = true; List <Body> bodies = new List <Body>(); Body b = DemoHelper.AddLine(DemoInfo, new Vector2D(300, 200), new Vector2D(400, 200), 40, Scalar.PositiveInfinity); b.IgnoresPhysicsLogics = true; bodies.Add(b); Body b2 = DemoHelper.AddCircle(DemoInfo, 20, 40, Scalar.PositiveInfinity, new ALVector2D(0, 300, 100)); b2.IgnoresPhysicsLogics = true; bodies.Add(b2); Body b3 = DemoHelper.AddCircle(DemoInfo, 20, 40, 50, new ALVector2D(0, 100, 100)); bodies.Add(b3); Body b4 = DemoHelper.AddRectangle(DemoInfo, 20, 20, 20, new ALVector2D(0, 150, 150)); bodies.Add(b4); dispose += RegisterDup(DemoInfo, bodies); DemoHelper.AddShell(DemoInfo, new BoundingRectangle(0, 0, 200, 200), 10, Scalar.PositiveInfinity).ForEach(delegate(Body sb) { sb.IgnoresPhysicsLogics = true; }); Body bStart = DemoHelper.AddShape(DemoInfo, ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("start.png"), 2, 16, 3), Scalar.PositiveInfinity, new ALVector2D(0, 100, 650)); // Body bStart = DemoHelper.AddLine(DemoInfo, new Vector2D(10, 600), new Vector2D(100, 600), 40, Scalar.PositiveInfinity); bStart.IgnoresPhysicsLogics = true; Body bStop = DemoHelper.AddShape(DemoInfo, ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("stop.png"), 2, 16, 3), Scalar.PositiveInfinity, new ALVector2D(0, 100, 700)); //Body bEnd = DemoHelper.AddLine(DemoInfo, new Vector2D(10, 700), new Vector2D(100, 700), 40, Scalar.PositiveInfinity); bStop.IgnoresPhysicsLogics = true; Scene.Engine.AddLogic(new GravityField(new Vector2D(0, 1000), new Lifespan())); dispose += DemoHelper.RegisterClick(DemoInfo, bStart, MouseButton.PrimaryButton, delegate(object sender, EventArgs e) { Scene.IsPaused = false; }); dispose += DemoHelper.RegisterClick(DemoInfo, bStop, MouseButton.PrimaryButton, delegate(object sender, EventArgs e) { Scene.IsPaused = true; }); }
protected override void Open() { IShape shape = ShapeFactory.CreateColoredCircle(8, 15); DemoHelper.AddGrid(DemoInfo, shape, 40, new BoundingRectangle(-500, 200, 800, 800), 50, 50); Viewport viewport2 = new Viewport(new Rectangle(Window.Size.Width / 2, 0, Window.Size.Width / 2, Window.Size.Height), Matrix2x3.Identity, Scene, new Lifespan()); Window.AddViewport(viewport2); Viewport.Rectangle = new Rectangle(0, 0, Window.Size.Width / 2, Window.Size.Height); IShape furyShape = ShapeFactory.CreateSprite(Cache <SurfacePolygons> .GetItem("starfury.png"), 2, 16, 3); Body b1 = DemoHelper.AddShape(DemoInfo, furyShape, 400, new ALVector2D(0, 0, 0)); Body b2 = DemoHelper.AddShape(DemoInfo, furyShape, 400, new ALVector2D(0, 0, 0)); dispose += DemoHelper.RegisterBodyTracking(DemoInfo, b1, Matrix2x3.FromRotationZ(-MathHelper.PiOver2) * Matrix2x3.FromScale(new Vector2D(.5f, .5f))); dispose += DemoHelper.RegisterBodyMovement(DemoInfo, b1, new ALVector2D(1000000, 100000, 0), Key.W, Key.S, Key.A, Key.D); DoGuns(b1, b2, Key.Q); dispose += DemoHelper.RegisterBodyTracking( new DemoOpenInfo(Window, viewport2, Scene) , b2, Matrix2x3.FromRotationZ(-MathHelper.PiOver2) * Matrix2x3.FromScale(new Vector2D(.5f, .5f))); dispose += DemoHelper.RegisterBodyMovement( DemoInfo, b2, new ALVector2D(1000000, 100000, 0)); DoGuns(b2, b1, Key.Return); b1.State.Position.Linear = new Vector2D(200, 0); b2.State.Position = new ALVector2D(MathHelper.Pi, 1, 0); b1.ApplyPosition(); b2.ApplyPosition(); DemoHelper.AddShell(DemoInfo, new BoundingRectangle(-700, -700, 1000, 1000), 90, Scalar.PositiveInfinity); dispose += delegate() { viewport2.Lifetime.IsExpired = true; Viewport.Rectangle = new Rectangle(0, 0, Window.Size.Width, Window.Size.Height); }; DemoHelper.AddStarField(DemoInfo, 1000, new BoundingRectangle(-1000, -1000, 1300, 1300)); }
protected override void Open() { dispose += DemoHelper.BasicDemoSetup(DemoInfo); Rectangle rect1 = Viewport.Rectangle; BoundingRectangle rect = new BoundingRectangle(rect1.Left, rect1.Top, rect1.Right, rect1.Bottom); rect.Min.X -= 75; rect.Min.Y -= 75; rect.Max.X += 75; rect.Max.Y += 75; DemoHelper.AddShell(DemoInfo, rect, 100, Scalar.PositiveInfinity).ForEach(delegate(Body b) { b.IgnoresGravity = true; }); rect.Min.X += 110; rect.Min.Y += 110; rect.Max.X -= 110; rect.Max.Y -= 110; IShape shape = ShapeFactory.CreateColoredCircle(3, 7); DemoHelper.AddGrid(DemoInfo, shape, 40, rect, 1, 1).ForEach(delegate(Body b) { b.State.Velocity.Linear = new Vector2D(DemoHelper.Rand.Next(-100, 100), DemoHelper.Rand.Next(-100, 100)); }); }