コード例 #1
0
ファイル: RubeBasicLayer.cs プロジェクト: netonjm/RubeLoader
        /// <summary>
        /// Attempts to load the world from the .json file given by getFilename.
        /// If successful, the method afterLoadProcessing will also be called,
        /// to allow subclasses to do something extra while the b2dJson information
        /// is still available.
        /// </summary>
        private void LoadWorld()
        {
            Clear();

            m_debugDraw = new CCBox2dDraw(DEFAULT_FONT);

            m_debugDraw.AppendFlags(b2DrawFlags.e_shapeBit | b2DrawFlags.e_aabbBit | b2DrawFlags.e_centerOfMassBit | b2DrawFlags.e_jointBit | b2DrawFlags.e_pairBit);

            string fullpath = GetFilename();

            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_touch = new MouseTouch(m_world, this);

                m_touch.m_mouseJointGroundBody = m_world.CreateBody(bodyDef);

                AfterLoadProcessing(json);
            }
            else
                Console.WriteLine(tmp); //if this warning bothers you, turn off "Typecheck calls to printf/scanf" in the project build settings
        }
コード例 #2
0
		void EnableDebugMode()
		{
			CCBox2dDraw debugDraw = new CCBox2dDraw("fonts/arial-12");
			world.SetDebugDraw(debugDraw);
			debugDraw.AppendFlags(b2DrawFlags.e_shapeBit);

		}
コード例 #3
0
		void EnableDebugMode()
		{
			debugDraw = new CCBox2dDraw("fonts/MarkerFelt-16", Constants.PTM_RATIO);
			world.SetDebugDraw(debugDraw);
			debugDraw.AppendFlags(b2DrawFlags.e_shapeBit);

		}