Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        void Awake()
        {
            // PHYSICS INIT!
            mWorld = new JelloPhysics.World();

            // static ground object.
            GameObject ground = new GameObject ();
            JelloPhysics.ClosedShape groundShape = new JelloPhysics.ClosedShape ();
            groundShape.begin();
            groundShape.addVertex(new Vector2(-10f, -2f));
            groundShape.addVertex(new Vector2(-10f, 2f));
            groundShape.addVertex(new Vector2(10f, 2f));
            groundShape.addVertex(new Vector2(10f, -2f));
            groundShape.finish();

            // make the body.
            JelloPhysics.Body groundBody = new JelloPhysics.Body();
            groundBody.Setup(mWorld, groundShape, float.PositiveInfinity, new Vector2(0f, -5f), 0f, Vector2.one, false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        void Awake()
        {
            // PHYSICS INIT!
            mWorld = new JelloPhysics.World();

            // static ground object.
            GameObject ground = new GameObject();

            JelloPhysics.ClosedShape groundShape = new JelloPhysics.ClosedShape();
            groundShape.begin();
            groundShape.addVertex(new Vector2(-10f, -2f));
            groundShape.addVertex(new Vector2(-10f, 2f));
            groundShape.addVertex(new Vector2(10f, 2f));
            groundShape.addVertex(new Vector2(10f, -2f));
            groundShape.finish();

            // make the body.
            JelloPhysics.Body groundBody = new JelloPhysics.Body();
            groundBody.Setup(mWorld, groundShape, float.PositiveInfinity, new Vector2(0f, -5f), 0f, Vector2.one, false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // create physics world.
            #if XBOX360
            graphics.PreferredBackBufferWidth = this.Window.ClientBounds.Width;
            graphics.PreferredBackBufferHeight = this.Window.ClientBounds.Height;
            graphics.PreferMultiSampling = true;
            #else
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            #endif
            graphics.ApplyChanges();

            // PHYSICS INIT!
            mWorld = new JelloPhysics.World();

            // static ground object.
            JelloPhysics.ClosedShape groundShape = new JelloPhysics.ClosedShape();
            groundShape.begin();
            groundShape.addVertex(new Vector2(-10f, -2f));
            groundShape.addVertex(new Vector2(-10f, 2f));
            groundShape.addVertex(new Vector2(10f, 2f));
            groundShape.addVertex(new Vector2(10f, -2f));
            groundShape.finish();

            // make the body.
            JelloPhysics.Body groundBody = new JelloPhysics.Body(mWorld, groundShape, float.PositiveInfinity, new Vector2(0f, -5f), 0f, Vector2.One, false);

            // visual effect
            mEffect = new BasicEffect(graphics.GraphicsDevice, null);
            mEffect.VertexColorEnabled = true;
            mEffect.LightingEnabled = false;

            base.Initialize();
        }