Ejemplo n.º 1
0
        public InfoBody AddVert(float x, float y, Vec2[] vert, float angle, float density,
                                float friction, float restetution, float mass, GImage image, bool IsBullet = true,
                                bool IsSensor = false, bool AllowSleep = false, short group_index = 1, Object userDate = null)
        {
            for (int i = 0; i < vert.Length; i++)
            {
                vert[i].X /= 2;
                vert[i].Y /= 2;

                vert[i].X /= metric;
                vert[i].Y /= metric;
            }

            BodyDef bDef = new BodyDef();

            bDef.Position.Set(x / metric, y / metric);
            bDef.Angle      = angle;
            bDef.AllowSleep = AllowSleep;
            bDef.IsBullet   = IsBullet;

            PolygonDef pDef = new PolygonDef();

            pDef.Restitution = restetution;
            pDef.Friction    = friction;
            pDef.Density     = density;
            pDef.SetAsBox(image.GetWidth() / metric / 2, image.GetHeight() / metric / 2);
            pDef.Vertices          = vert;
            pDef.Filter.GroupIndex = group_index;
            pDef.IsSensor          = IsSensor;

            Body body = world.CreateBody(bDef);

            body.CreateShape(pDef);
            body.SetMassFromShapes();

            float    Inertia = body.GetInertia();
            MassData md      = new MassData();

            md.I    = Inertia;
            md.Mass = mass;
            body.SetMass(md);

            InfoBody info = new InfoBody();

            info.image    = image;
            info.body     = body;
            info.userDate = userDate;

            body.SetUserData(info);

            return(info);
        }
Ejemplo n.º 2
0
        public override void Resume()
        {
            imgLMD = new GImage(Game);
            imgLMD.SetImage(GameResource.text_lmd);
            imgLMD.SetWidth(50);
            imgLMD.SetHeight(1);
            imgLMD.SetX(Game.GetWindowWidth() / 2 + 90);
            imgLMD.SetY(200);
            ScaleImg_x = imgLMD.GetWidth();
            ScaleImg_y = imgLMD.GetHeight();
            AddElement(imgLMD);

            intent_to_menu = new Intent(Game);
            intent_to_menu.SetScreenLoading(null);
        }