Beispiel #1
0
        public void enterStartMenu()
        {
            menuItems.Clear();
            actors.Clear();
            props.Clear();
            credits.Clear();
            drawSpace.X = 0;
            drawSpace.Y = 0;

            Panel bg = new Panel(guiTextures["menuPanel"], Color.White);
            bg.dimensions.X = drawSpace.X;
            bg.dimensions.Y = drawSpace.Y;
            bg.dimensions.Width = drawSpace.Width;
            bg.dimensions.Height = drawSpace.Height;

            Panel logo = new Panel(guiTextures["logo"], new Color(255, 255, 255));
            logo.dimensions.Width = drawSpace.Width * 4 / 5;
            logo.dimensions.Height = drawSpace.Height * 2 / 10;
            logo.dimensions.X = drawSpace.Width / 2 - logo.dimensions.Width / 2;
            logo.dimensions.Y = 50;
            
            bg.addChild(logo);

            Button newGameButton = new Button(guiTextures["newGameButton"]);
            newGameButton.dimensions.Width = drawSpace.Width * 2 / 5;
            newGameButton.dimensions.Height = drawSpace.Height / 6;
            newGameButton.dimensions.X = drawSpace.Width / 2 - newGameButton.dimensions.Width / 2;
            newGameButton.dimensions.Y = drawSpace.Height * 3 / 10;
            newGameButton.onClick = newGameClicked;
            bg.addChild(newGameButton);

            Button tutorialButton = new Button(guiTextures["tutorialButton"]);
            tutorialButton.dimensions.Width = drawSpace.Width * 2 / 5;
            tutorialButton.dimensions.Height = drawSpace.Height / 6;
            tutorialButton.dimensions.X = drawSpace.Width / 2 - tutorialButton.dimensions.Width / 2;
            tutorialButton.dimensions.Y = drawSpace.Height * 5 / 10;
            tutorialButton.onClick = tutorialClicked;
            bg.addChild(tutorialButton);

            Button creditsButton = new Button(guiTextures["creditsButton"]);
            creditsButton.dimensions.Width = drawSpace.Width * 2 / 5;
            creditsButton.dimensions.Height = drawSpace.Height / 6;
            creditsButton.dimensions.X = drawSpace.Width / 2 - creditsButton.dimensions.Width / 2;
            creditsButton.dimensions.Y = drawSpace.Height * 7 / 10;
            creditsButton.onClick = creditsClicked;
            bg.addChild(creditsButton);


            menuItems.Add(bg);
            rootGUIElement = bg;
            menuEnabled = true;
            //EnableMenu(this, EventArgs.Empty);
        }
Beispiel #2
0
        public void enterPauseMenu()
        {
            menuItems.Clear();

            Panel pauseMenu = new Panel(guiTextures["whiteSquare"], Color.Black);
            pauseMenu.dimensions.Width = drawSpace.Width / 4;
            pauseMenu.dimensions.Height = drawSpace.Height / 4;
            pauseMenu.dimensions.X = drawSpace.Width / 2 - pauseMenu.dimensions.Width/2;
            pauseMenu.dimensions.Y = drawSpace.Height / 2 - pauseMenu.dimensions.Height / 2;

            pauseLabel = new Label(spriteFont, "Paused");
            pauseLabel.dimensions.X = drawSpace.Width / 2 - (int)spriteFont.MeasureString("Paused").X /2;
            pauseLabel.dimensions.Y = drawSpace.Height / 2 - (int)spriteFont.MeasureString("Paused").Y / 2 - 60;

            pauseButton = new Button(guiTextures["exitButton"]);
            pauseButton.dimensions.Width = drawSpace.Width / 6;
            pauseButton.dimensions.Height = drawSpace.Height / 8;
            pauseButton.dimensions.X = drawSpace.Width / 2 - pauseButton.dimensions.Width / 2;
            pauseButton.dimensions.Y = drawSpace.Height / 2 - pauseButton.dimensions.Height / 2 + 30;
            pauseButton.onClick = exitClicked;

            pausePanel = pauseMenu;
            menuItems.Add(pauseMenu);
            menuItems.Add(pauseLabel);
            menuItems.Add(pauseButton);
            pauseMenu.children.Add(pauseLabel);
            pauseMenu.children.Add(pauseButton);
            rootGUIElement = pauseMenu;
            menuEnabled = true;
            //EnableMenu(this, EventArgs.Empty);
        }
 public void enterStartMenu()
 {
     menuItems.Clear();
     drawSpace.X = 0;
     drawSpace.Y = 0;
     Panel bg = new Panel(guiTextures["menuPanel"], new Color(255, 255, 255));
     bg.dimensions.X = drawSpace.X;
     bg.dimensions.Y = drawSpace.Y;
     bg.dimensions.Width = drawSpace.Width;
     bg.dimensions.Height = drawSpace.Height;
     Panel logo = new Panel(guiTextures["logo"], new Color(255, 255, 255));
     logo.dimensions.X = drawSpace.Width / 2 - guiTextures["logo"].Width /2;
     logo.dimensions.Y = 50;
     logo.dimensions.Width = guiTextures["logo"].Width;
     logo.dimensions.Height = guiTextures["logo"].Height * 4 / 5;
     Button newGameButton = new Button(guiTextures["newGameButton"]);
     newGameButton.dimensions.X = drawSpace.Width / 2 - guiTextures["newGameButton"].Width / 2;
     newGameButton.dimensions.Y = 400;
     newGameButton.dimensions.Width = guiTextures["newGameButton"].Width;
     newGameButton.dimensions.Height = guiTextures["newGameButton"].Height * 4 / 5;
     newGameButton.onClick = newGameClicked;
     bg.addChild(newGameButton);
     bg.addChild(logo);
     menuItems.Add(bg);
     rootGUIElement = bg;
     menuEnabled = true;
     //EnableMenu(this, EventArgs.Empty);
 }