Ejemplo n.º 1
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destoryFcn,
                                   ShapeType type1, ShapeType type2)
        {
            if (s_registers[(int)type1] == null)
            {
                s_registers[(int)type1] = new ContactRegister[(int)ShapeType.ShapeTypeCount];
            }

            s_registers[(int)type1][(int)type2].CreateFcn  = createFcn;
            s_registers[(int)type1][(int)type2].DestroyFcn = destoryFcn;
            s_registers[(int)type1][(int)type2].Primary    = true;

            if (type1 != type2)
            {
                s_registers[(int)type2][(int)type1].CreateFcn  = createFcn;
                s_registers[(int)type2][(int)type1].DestroyFcn = destoryFcn;
                s_registers[(int)type2][(int)type1].Primary    = false;
            }
        }
Ejemplo n.º 2
0
        public static void AddType(ContactCreateFcn createFcn, ContactDestroyFcn destoryFcn,
                                   ShapeType type1, ShapeType type2)
        {
            Box2DNetDebug.Assert(ShapeType.UnknownShape < type1 && type1 < ShapeType.ShapeTypeCount);
            Box2DNetDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount);

            if (s_registers[(int)type1] == null)
            {
                s_registers[(int)type1] = new ContactRegister[(int)ShapeType.ShapeTypeCount];
            }

            s_registers[(int)type1][(int)type2].CreateFcn  = createFcn;
            s_registers[(int)type1][(int)type2].DestroyFcn = destoryFcn;
            s_registers[(int)type1][(int)type2].Primary    = true;

            if (type1 != type2)
            {
                s_registers[(int)type2][(int)type1].CreateFcn  = createFcn;
                s_registers[(int)type2][(int)type1].DestroyFcn = destoryFcn;
                s_registers[(int)type2][(int)type1].Primary    = false;
            }
        }