Example #1
0
 private void load()
 {
     // Set up the simulation once before any tests are ran
     Child = sim = new RigidBodySimulation {
         RelativeSizeAxes = Axes.Both
     };
 }
Example #2
0
        private void loadTest(int testType)
        {
            testContainer.Clear();

            switch (testType)
            {
            case 0:
                Random random = new Random(1337);

                // Boxes
                generateN(10, () => new InfofulBox
                {
                    Position = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 1000,
                    Size     = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 200,
                    Rotation = (float)random.NextDouble() * 360,
                    Colour   = new Color4(253, 253, 253, 255),
                    Origin   = Anchor.Centre,
                    Anchor   = Anchor.TopLeft,
                });

                // Circles
                generateN(10, delegate
                {
                    Vector2 size = new Vector2((float)random.NextDouble()) * 200;
                    return(new InfofulBox
                    {
                        Position = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 1000,
                        Size = size,
                        Rotation = (float)random.NextDouble() * 360,
                        CornerRadius = size.X / 2,
                        Colour = new Color4(253, 253, 253, 255),
                        Origin = Anchor.Centre,
                        Anchor = Anchor.TopLeft,
                        Masking = true,
                    });
                });

                // Totally random stuff
                generateN(10, delegate
                {
                    Vector2 size = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 200;
                    return(new InfofulBox
                    {
                        Position = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 1000,
                        Size = size,
                        Rotation = (float)random.NextDouble() * 360,
                        Shear = new Vector2((float)random.NextDouble(), (float)random.NextDouble()) * 2 - new Vector2(1),
                        CornerRadius = (float)random.NextDouble() * Math.Min(size.X, size.Y) / 2,
                        Colour = new Color4(253, 253, 253, 255),
                        Origin = Anchor.Centre,
                        Anchor = Anchor.TopLeft,
                        Masking = true,
                    });
                });

                break;
            }

            sim = new RigidBodySimulation(testContainer);
        }
Example #3
0
        private void load()
        {
            sim = new RigidBodySimulation {
                RelativeSizeAxes = Axes.Both
            };

            Resources.AddStore(new DllResourceStore(@"Gale.dll"));
            dependencies.Cache(Fonts = new FontStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")));
            Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic"));

            sim.Add(new Player());

            base.Content.Add(new GaleKeyBindingContainer
            {
                sim
            });
        }
Example #4
0
        private void load()
        {
            Child = sim = new RigidBodySimulation {
                RelativeSizeAxes = Axes.Both
            };

            RigidBodyContainer <Drawable> rbc = new RigidBodyContainer <Drawable>
            {
                Child = new Box
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(150, 150),
                    Colour = Color4.Tomato,
                },
                Position = new Vector2(500, 500),
                Size     = new Vector2(200, 200),
                Rotation = 45,
                Colour   = Color4.Tomato,
                Masking  = true,
            };

            sim.Add(rbc);
        }
Example #5
0
        private void DropCube()
        {
            Child = sim = new RigidBodySimulation {
                RelativeSizeAxes = Axes.Both
            };

            RigidBodyContainer <Drawable> rbc = new RigidBodyContainer <Drawable>
            {
                Child = new Box
                {
                    Anchor  = Anchor.Centre,
                    Origin  = Anchor.Centre,
                    Size    = new Vector2(150, 150),
                    Texture = texture,
                },
                Position = new Vector2(500, 500),
                Size     = new Vector2(200, 200),
                Rotation = 45,
                Masking  = true,
            };

            sim.Add(rbc);

            FillFlowContainer flow;

            AddRange(new Drawable[]
            {
                new ScrollContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        flow = new FillFlowContainer
                        {
                            Anchor           = Anchor.TopLeft,
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Direction        = FillDirection.Vertical,
                        }
                    }
                }
            });

            SpriteText test = new SpriteText
            {
                Text             = @"You are now entering completely darkness...",
                Font             = "Exo2.0-Regular",
                AllowMultiline   = true,
                RelativeSizeAxes = Axes.X,
                TextSize         = 25
            };

            flow.Add(test);

            flow.Add(new SpriteText
            {
                Text             = @"That just used the font " + test.Font + "!",
                Font             = "Exo2.0-RegularItalic",
                AllowMultiline   = true,
                RelativeSizeAxes = Axes.X,
                TextSize         = 25
            });
        }
Example #6
0
 public DrawableBody(Drawable d, RigidBodySimulation sim) : base(sim)
 {
     drawable = d;
 }
Example #7
0
 public ContainerBody(Drawable d, RigidBodySimulation sim) : base(d, sim)
 {
     Mass = float.MaxValue;
 }