Пример #1
0
        public JiggleGame()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            graphics.SynchronizeWithVerticalRetrace = true;
            this.IsFixedTimeStep = true;

            physicSystem = new PhysicsSystem();

            graphics.SynchronizeWithVerticalRetrace = false;
            this.IsFixedTimeStep = false;
            //physicSystem.CollisionSystem = new CollisionSystemGrid(32, 32, 32, 30, 30, 30);
            //physicSystem.CollisionSystem = new CollisionSystemBrute();
            physicSystem.CollisionSystem = new CollisionSystemSAP();

            physicSystem.EnableFreezing = true;
            physicSystem.SolverType = PhysicsSystem.Solver.Normal;
            physicSystem.CollisionSystem.UseSweepTests = true;

            physicSystem.NumCollisionIterations = 8;
            physicSystem.NumContactIterations = 8;
            physicSystem.NumPenetrationRelaxtionTimesteps = 15;

            camera = new Camera(this);

            FrameRateCounter physStats = new FrameRateCounter(this, this.physicSystem);

            debugDrawer = new DebugDrawer(this);
            debugDrawer.Enabled = false;

            Components.Add(physStats);
            Components.Add(camera);
            Components.Add(debugDrawer);

            physStats.DrawOrder = 2;
            debugDrawer.DrawOrder = 3;

            this.IsMouseVisible = true;
            this.Window.Title = "JigLibX Physic Library " + System.Reflection.Assembly.GetAssembly(typeof(PhysicsSystem)).GetName().Version.ToString();
        }
Пример #2
0
        /// <summary>
        /// Initializes class and components
        /// </summary>
        protected override void Initialize()
        {
            this.Components.Add(this.colorStream);

            // Create the avatar animator
            this.animator = new AvatarAnimator(this);
            //this.Components.Add(this.animator);

            // Add XUI Component
            _G.Game = this;

            // add core components
            Components.Add(new GamerServicesComponent(this));

            // add layers
            UiLayer = new UiLayer(this);
            _G.UI = UiLayer;

            // add other components
            _G.GameInput = new GameInput((int)E_GameButton.Count, (int)E_GameAxis.Count);
            GameControls.Setup(); // initialise mappings

            camera = new Camera(this);
            camera.Position = Vector3.Forward * 12;

            this.Services.AddService(typeof(Camera), this.camera);

            List<Camera> kinectCamera = new List<Camera>();
            kinectCamera.Add(new Camera(this));
            kinectCamera[0].Position = Vector3.Zero;
            kinectCamera[0].View = Matrix.CreateLookAt(
                   new Vector3(0.0f, 0.0f, 0.0f),
                   new Vector3(0.0f, 0.0f, 1.0f),
                   Vector3.Down);
            this.Services.AddService(typeof(List<Camera>), kinectCamera);

            this.Components.Add(camera);

            base.Initialize();
        }