private void InitializeGui() { // Add the GuiGraphicsScreen to the graphics service. _guiGraphicsScreen = new GuiGraphicsScreen(_services); _graphicsService.Screens.Add(_guiGraphicsScreen); // ----- Title (top left) _titleTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "No sample selected", X = 10, Y = 10, }; _guiGraphicsScreen.UIScreen.Children.Add(_titleTextBlock); // ----- Info (bottom left) _infoPanel = new StackPanel { Margin = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, }; _guiGraphicsScreen.UIScreen.Children.Add(_infoPanel); _controllerTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Controller disconnected. Press <Start> to use controller.", }; _infoPanel.Children.Add(_controllerTextBlock); #if XBOX _buttonsPanel = new StackPanel(); // Not used. var infoTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Press <Left Stick> to show/hide help.", }; _infoPanel.Children.Add(infoTextBlock); infoTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Press <Back> to show/hide menu.", }; _infoPanel.Children.Add(infoTextBlock); #else // ----- Buttons (bottom right) _buttonsPanel = new StackPanel { Background = new Color(0, 0, 0, 64), Padding = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, }; _guiGraphicsScreen.UIScreen.Children.Add(_buttonsPanel); AddButton(_buttonsPanel, "Previous (PgUp)", LoadPreviousSample); AddButton(_buttonsPanel, "Next (PgDn)", LoadNextSample); AddButton(_buttonsPanel, "Menu (Esc)", ShowMenuWindow); AddButton(_buttonsPanel, "Help (F1)", ShowHelpWindow); AddButton(_buttonsPanel, "Profile (F3)", ShowProfilerWindow); AddButton(_buttonsPanel, "Options (F4)", ShowOptionsWindow); #if !NETFX_CORE && !IOS AddButton(_buttonsPanel, "Exit (Alt-F4)", _game.Exit); #endif #endif // ----- FPS Counter (top right) _fpsPanel = new StackPanel { Margin = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, }; _guiGraphicsScreen.UIScreen.Children.Add(_fpsPanel); _updateFpsTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.Yellow, HorizontalAlignment = HorizontalAlignment.Right, Text = "Update", }; _fpsPanel.Children.Add(_updateFpsTextBlock); _drawFpsTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.Yellow, HorizontalAlignment = HorizontalAlignment.Right, Text = "Draw", }; _fpsPanel.Children.Add(_drawFpsTextBlock); // Create windows. (Hidden at start.) CreateMenuWindow(); CreateProfilerWindow(); CreateOptionsWindow(); CreateHelpWindow(); }
private void InitializeGui() { // Add the GuiGraphicsScreen to the graphics service. _guiGraphicsScreen = new GuiGraphicsScreen(_services); _graphicsService.Screens.Add(_guiGraphicsScreen); // ----- Title (top left) _titleTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "No sample selected", X = 10, Y = 10, }; _guiGraphicsScreen.UIScreen.Children.Add(_titleTextBlock); // ----- Info (bottom left) _infoPanel = new StackPanel { Margin = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, }; _guiGraphicsScreen.UIScreen.Children.Add(_infoPanel); _controllerTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Controller disconnected. Press <Start> to use controller.", }; _infoPanel.Children.Add(_controllerTextBlock); #if XBOX _buttonsPanel = new StackPanel(); // Not used. var infoTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Press <Left Stick> to show/hide help.", }; _infoPanel.Children.Add(infoTextBlock); infoTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.White, Text = "Press <Back> to show/hide menu.", }; _infoPanel.Children.Add(infoTextBlock); #else // ----- Buttons (bottom right) _buttonsPanel = new StackPanel { Background = new Color(0, 0, 0, 64), Padding = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, }; _guiGraphicsScreen.UIScreen.Children.Add(_buttonsPanel); AddButton(_buttonsPanel, "Previous (PgUp)", LoadPreviousSample); AddButton(_buttonsPanel, "Next (PgDn)", LoadNextSample); AddButton(_buttonsPanel, "Menu (Esc)", ShowMenuWindow); AddButton(_buttonsPanel, "Help (F1)", ShowHelpWindow); AddButton(_buttonsPanel, "Profile (F3)", ShowProfilerWindow); AddButton(_buttonsPanel, "Options (F4)", ShowOptionsWindow); #if !NETFX_CORE && !IOS AddButton(_buttonsPanel, "Exit (Alt-F4)", _game.Exit); #endif #endif // ----- FPS Counter (top right) _fpsPanel = new StackPanel { Margin = new Vector4F(10), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, }; _guiGraphicsScreen.UIScreen.Children.Add(_fpsPanel); _updateFpsTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.Yellow, HorizontalAlignment = HorizontalAlignment.Right, Text = "Update", }; _fpsPanel.Children.Add(_updateFpsTextBlock); _drawFpsTextBlock = new TextBlock { Font = "DejaVuSans", Foreground = Color.Yellow, HorizontalAlignment = HorizontalAlignment.Right, Text = "Draw", }; _fpsPanel.Children.Add(_drawFpsTextBlock); // Create windows. (Hidden at start.) CreateMenuWindow(); CreateProfilerWindow(); CreateOptionsWindow(); CreateHelpWindow(); }