예제 #1
0
        public static Test CreateRubeTestFile()
        {
            Console.WriteLine(GuiDemo.CurrentRubeFile);
            StringBuilder errorMsg = new StringBuilder();
            Nb2dJson      json     = new Nb2dJson();
            World         world    = json.ReadFromFile(GuiDemo.CurrentRubeFile, errorMsg);

            var theName = "ball";
            var res     = json.GetBodiesByName(theName);

            Console.WriteLine(res);

            return(new RubeTestFile(world));
        }
예제 #2
0
        public void SetJson(string fullpath)
        {
            Console.WriteLine("Full path is: %s", fullpath);

            Nb2dJson      json = new Nb2dJson();
            StringBuilder tmp  = new StringBuilder();

            m_world = json.ReadFromFile(fullpath, tmp);

            if (m_world != null)
            {
                Console.WriteLine("Loaded JSON ok");
                m_world.SetDebugDraw(m_debugDraw);

                b2BodyDef bodyDef = new b2BodyDef();
                m_groundBody = m_world.CreateBody(bodyDef);
            }
            else
            {
                Console.WriteLine(tmp); //if this warning bothers you, turn off "Typecheck calls to printf/scanf" in the project build settings
            }
        }