Ejemplo n.º 1
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            string fullpath = GetContentFileFullPath(FILE);

            //Scale changed on the Physics scene
            Scene.Scale = 23.6f;

            Console.WriteLine("Full path is: %s", fullpath);

            b2dJson json = new b2dJson();
            bool loaded = json.ReadFromFile(fullpath, this);

            if (loaded)
            {
                Console.WriteLine("Loaded JSON ok");
            }

            tListener = new CCEventListenerTouchAllAtOnce();
            tListener.OnTouchesBegan = OnTouchesBegan;
            tListener.OnTouchesEnded = OnTouchesEnded;
            tListener.OnTouchesMoved = OnTouchesMoved;
            Scene.Position = Window.WindowSizeInPixels.Center;

            AddEventListener(tListener, this);

            Schedule();
        }
Ejemplo n.º 2
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            // Scale = .3f;

            string fullpath = GetContentFileFullPath(FILE);

            Console.WriteLine("Full path is: %s", fullpath);

            b2dJson json = new b2dJson();
            bool loaded = json.ReadFromFile(fullpath, this);

            if (loaded)
            {
                Console.WriteLine("Loaded JSON ok");
                Scene.PhysicsWorld.Gravity = new CCPoint(0, 0);
                //b2BodyDef bodyDef = new b2BodyDef();

                //m_touch = new MouseTouch(m_world, this);

                //m_touch.m_mouseJointGroundBody = m_world.CreateBody(bodyDef);

                //AfterLoadProcessing(json);
            }

            Scene.Scale = 10.6f;

            tListener = new CCEventListenerTouchAllAtOnce();
            tListener.OnTouchesBegan = OnTouchesBegan;
            tListener.OnTouchesEnded = OnTouchesEnded;
            tListener.OnTouchesMoved = OnTouchesMoved;
            Scene.Position = Window.WindowSizeInPixels.Center;

            AddEventListener(tListener, this);

            Schedule();
        }