Пример #1
0
    public WindowsPhoneSample(Microsoft.Xna.Framework.Game game)
      : base(game)
    {
      // Add a DelegateGraphicsScreen as the first graphics screen to the graphics
      // service. This lets us do the rendering in the Render method of this class.
      var graphicsScreen = new DelegateGraphicsScreen(GraphicsService)
      {
        RenderCallback = Render,
      };
      GraphicsService.Screens.Insert(0, graphicsScreen);

      // Load a UI theme, which defines the appearance and default values of UI controls.
      Theme theme = ContentManager.Load<Theme>("UI Themes/WindowsPhone7/ThemeDark");

      // Create a UI renderer, which uses the theme info to renderer UI controls.
      UIRenderer renderer = new UIRenderer(Game, theme);

      // Create a UIScreen and add it to the UI service. The screen is the root of the 
      // tree of UI controls. Each screen can have its own renderer.
      _uiScreen = new UIScreen("SampleUIScreen", renderer)
      {
        // Make the screen transparent.
        Background = new Color(0, 0, 0, 0),
      };
      UIService.Screens.Add(_uiScreen);

      // Open a window.
      var window = new WpWindow();
      window.Show(_uiScreen);
    }
Пример #2
0
        public WindowsPhoneSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            // Add a DelegateGraphicsScreen as the first graphics screen to the graphics
            // service. This lets us do the rendering in the Render method of this class.
            var graphicsScreen = new DelegateGraphicsScreen(GraphicsService)
            {
                RenderCallback = Render,
            };

            GraphicsService.Screens.Insert(0, graphicsScreen);

            // Load a UI theme, which defines the appearance and default values of UI controls.
            Theme theme = ContentManager.Load <Theme>("UI Themes/WindowsPhone7/ThemeDark");

            // Create a UI renderer, which uses the theme info to renderer UI controls.
            UIRenderer renderer = new UIRenderer(Game, theme);

            // Create a UIScreen and add it to the UI service. The screen is the root of the
            // tree of UI controls. Each screen can have its own renderer.
            _uiScreen = new UIScreen("SampleUIScreen", renderer)
            {
                // Make the screen transparent.
                Background = new Color(0, 0, 0, 0),
            };
            UIService.Screens.Add(_uiScreen);

            // Open a window.
            var window = new WpWindow();

            window.Show(_uiScreen);
        }