Пример #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>
        protected override void Initialize()
        {
            ViewportDimensions = new Vector2(GraphicsDevice.Viewport.Width,
                                             GraphicsDevice.Viewport.Height);

            DebugInfo = new StringBuilder();

            InputHandler = new InputHandler();

            Events = new EventSystem();
            Events["endLevel"].addListener(onEndLevel);
            Events["exit"].addListener(onExit);
            Events["ui.show"].addListener(OnUIShow);
            Events["ui.close"].addListener(OnUIClose);

            PhysicsDebugDrawer = new PhysicsDebugDraw();
            PhysicsDebugDrawer.Level = level;

            PhysicsDebugDrawer.AppendFlags(DebugDrawFlags.AABB);
            PhysicsDebugDrawer.AppendFlags(DebugDrawFlags.CenterOfMass);
            PhysicsDebugDrawer.AppendFlags(DebugDrawFlags.Joint);
            PhysicsDebugDrawer.AppendFlags(DebugDrawFlags.Pair);
            PhysicsDebugDrawer.AppendFlags(DebugDrawFlags.Shape);

            level.Initialize(gameConfig["Levels"][level.Name]);

            base.Initialize();

            GameState.SetInMenu();
        }
Пример #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>
        protected override void Initialize()
        {
            ViewportDimensions = new Vector2(GraphicsDevice.Viewport.Width,
                                             GraphicsDevice.Viewport.Height);

            DebugInfo = new StringBuilder();

            InputHandler = new InputHandler();

            Events = new EventSystem();
            Events["endLevel"].addListener(onEndLevel);
            Events["exit"].addListener(onExit);
            Events["ui.show"].addListener(OnUIShow);
            Events["ui.close"].addListener(OnUIClose);

            level.Initialize(gameConfig["Levels"][level.Name]);

            base.Initialize();

            GameState.SetInMenu();
        }