Пример #1
0
        protected override void Initialize()
        {
            // MENU ITEMS INIT
            MenuItemsComponent menuItems = new MenuItemsComponent(this, new Vector2(this.getViewportWidth() * 0.45f, this.getViewportHeight() * 0.75f), Color.Blue, Color.Yellow, 75);

            menuItems.AddItem("Hrát", "new-game");
            //menuItems.AddItem("Výsledky", "high-score");
            //menuItems.AddItem("Nastavení", "settings");
            menuItems.AddItem("Odejít", "exit");

            // COMPONENTS INIT
            ScrollingBackgroundComponent scrolling = new ScrollingBackgroundComponent(this);

            this.Components.Add(scrolling);
            MenuComponent menu = new MenuComponent(this, menuItems);

            this.Components.Add(menu);
            LevelComponent level = new LevelComponent(this);

            this.Components.Add(level);

            // GAMEWINDOWS INIT
            this.menuWindow   = new GameWindow(this, menu, menuItems, scrolling);
            this.ingameWindow = new GameWindow(this, level, scrolling);

            // TURN OFF ALL COMPONENTS
            foreach (GameComponent component in this.Components)
            {
                this.SwitchComponent(component, false);
            }

            // BASE GRAPHICS STUFF
            this.IsMouseVisible = true;
            //this.graphics.IsFullScreen = true;
            this.graphics.PreferredBackBufferHeight = 1080;
            this.graphics.PreferredBackBufferWidth  = 1920;
            this.graphics.ApplyChanges();

            // INIT MENU WINDOW
            this.SwitchWindows(menuWindow);

            base.Initialize();
        }
Пример #2
0
 public MenuComponent(Game game, MenuItemsComponent menuItems)
     : base(game)
 {
     this.game      = game;
     this.menuItems = menuItems;
 }