コード例 #1
0
 /// <summary>
 /// Constructs a new menu entry with the specified text.
 /// </summary>
 public MenuEntry(MenuScreen menu, string text, EntryType type, GameScreen screen)
 {
     _text = text;
     _screen = screen;
     _type = type;
     _menu = menu;
     _scale = 0.9f;
     _alpha = 1.0f;
 }
コード例 #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //load textures
            //Content.RootDirectory = "Content";
            //_textures.Add("Cannon", Content.Load<Texture2D>("Sprite\\cannon"));
            //_textures.Add("CannonBall", Content.Load<Texture2D>("Sprite\\ball"));

            IfritDemo ifritDemo = new IfritDemo();
            WizardDemo wizardDemo = new WizardDemo();

            MenuScreen menuScreen = new MenuScreen("");

            //menuScreen.AddMenuItem("Levels", EntryType.Separator, null);
            menuScreen.AddMenuItem(ifritDemo.GetTitle(), EntryType.Screen, ifritDemo);
            menuScreen.AddMenuItem(wizardDemo.GetTitle(), EntryType.Screen, wizardDemo);

            ScreenManager.AddScreen(new BackgroundScreen("Common/title_screen"));
            ScreenManager.AddScreen(menuScreen);
            ScreenManager.AddScreen(new LogoScreen(TimeSpan.FromSeconds(3.0)));
            base.Initialize();
        }