コード例 #1
0
        protected BasicSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            // Create a graphics screen for rendering basic stuff.
            GraphicsScreen = new SampleGraphicsScreen(Services)
            {
                ClearBackground = true,
            };

            // The order of the graphics screens is back-to-front. Add the screen at index 0,
            // i.e. behind all other screens. The screen should be rendered first and all other
            // screens (menu, GUI, help, ...) should be on top.
            GraphicsService.Screens.Insert(0, GraphicsScreen);

            // GameObjects that need to render stuff will retrieve the DebugRenderers or
            // Scene through the service provider.
            Services.Register(typeof(DebugRenderer), null, GraphicsScreen.DebugRenderer);
            Services.Register(typeof(DebugRenderer), "DebugRenderer2D", GraphicsScreen.DebugRenderer2D);
            Services.Register(typeof(IScene), null, GraphicsScreen.Scene);

            // Add a default light setup (ambient light + 3 directional lights).
            var defaultLightsObject = new DefaultLightsObject(Services);

            GameObjectService.Objects.Add(defaultLightsObject);
        }
コード例 #2
0
    protected BasicSample(Microsoft.Xna.Framework.Game game) 
      : base(game)
    {
      // Create a graphics screen for rendering basic stuff.
      GraphicsScreen = new SampleGraphicsScreen(Services) { ClearBackground = true, };

      // The order of the graphics screens is back-to-front. Add the screen at index 0,
      // i.e. behind all other screens. The screen should be rendered first and all other
      // screens (menu, GUI, help, ...) should be on top.
      GraphicsService.Screens.Insert(0, GraphicsScreen);

      // GameObjects that need to render stuff will retrieve the DebugRenderers or
      // Scene through the service provider.
      Services.Register(typeof(DebugRenderer), null, GraphicsScreen.DebugRenderer);
      Services.Register(typeof(DebugRenderer), "DebugRenderer2D", GraphicsScreen.DebugRenderer2D);
      Services.Register(typeof(IScene), null, GraphicsScreen.Scene);

      // Add a default light setup (ambient light + 3 directional lights).
      var defaultLightsObject = new DefaultLightsObject(Services);
      GameObjectService.Objects.Add(defaultLightsObject);
    }