示例#1
0
        /// <summary>
        /// Event handler for when the Molecules & Atoms menu entry is selected.
        /// </summary>
        void MoleculesGameMenuEntrySelected(object sender, EventArgs e)
        {
            Viewport viewport     = ScreenManager.GraphicsDevice.Viewport;
            Vector2  viewportSize = new Vector2(viewport.Width, viewport.Height);

            Vector2 legendPosition = new Vector2(
                (viewportSize.X - legendTexture.Width) / 2f,
                viewportSize.Y * 0.18f);

            legendPosition.Y -= (float)Math.Pow(TransitionPosition, 2) * legendPosition.Y;
            Color legendColor = Color.White;

            ScreenManager.SpriteBatch.Begin();
            ScreenManager.SpriteBatch.Draw(legendTexture, legendPosition,
                                           new Color(legendColor.R, legendColor.G, legendColor.B, TransitionAlpha));
            ScreenManager.SpriteBatch.End();


            // Quit the game, after a confirmation message box.
            const string message = "Are you sure?";

            MessageBoxScreen messageBox = new MessageBoxScreen(message);

            messageBox.Accepted += QuitMessageBoxAccepted;
            ScreenManager.AddScreen(messageBox);
        }
示例#2
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel()
        {
            const string message = "Exit Free Radicals?";

            MessageBoxScreen messageBox = new MessageBoxScreen(message);

            messageBox.Accepted += ExitMessageBoxAccepted;
            ScreenManager.AddScreen(messageBox);
        }
示例#3
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameEntrySelected(object sender, EventArgs e)
        {
            // Quit the game, after a confirmation message box.
            const string message = "Are you sure?";

            MessageBoxScreen messageBox = new MessageBoxScreen(message);

            messageBox.Accepted += QuitMessageBoxAccepted;
            ScreenManager.AddScreen(messageBox);
        }