public MainMenuScreen(Vector2u gameResolution, Vector2u windowResolution)
        {
            this.GameResolution = gameResolution;
            this.WindowResolution = windowResolution;
            this.IsDrawn = true;
            this.IsUpdated = true;
            this.ParentScreen = null;

            //mPlayer = new MusicPlayer();
            //mPlayer.add("bg", new Music(@"Content/music/never_short.ogg"));
            //mPlayer.currentMusic.Volume = 50;
            //mPlayer.currentMusic.Loop = true;
            //mPlayer.play();

            contentManager = new ContentManager(Game1.defaultWorldParameters);
            IO.loadLevel(contentManager, @"Content/levels/menuLevel.xml");

            backGround = new Sprite(contentManager.Media.loadTexture("Content/images/bg.jpg", true));
            backGround.Scale = new Vector2f(gameResolution.X / (float)backGround.Texture.Size.X, gameResolution.Y / (float)backGround.Texture.Size.Y);

            lightLayer = new LightLayer(this.GameResolution, this.WindowResolution);
            lightLayer.add(new Light(new Vector2f(700, 350), new Color(255, 255, 200), .55f));
            lightLayer.add(new Light(new Vector2f(1920 - 700, 350), new Color(255, 255, 200), .55f));

            contentManager.foreceBlocks();
            lightLayer.setPolygons(contentManager.getLightPolygons());

            mainMenu = new MenuScreen(this, this.contentManager, null, new Vector2i(0, 0), true, true, false);
            mainMenu.Title.Color = Color.Black;
            mainMenu.ButtonColor = Color.Black;
            mainMenu.addButtons(new string[] { "Play",  "Level Editor", "Options",  "Help", "Credits", "Quit"});
            mainMenu.MouseClick += mainMenu_ButtonClick;
            mainMenu.MouseEnter += mainMenu_MouseEnter;
            mainMenu.MouseLeave += mainMenu_MouseLeave;
        }
        public override void Dispose()
        {
            this.contentManager.Dispose();
            this.contentManager = null;

            this.lightLayer.Dispose();
            this.lightLayer = null;

            this.mainMenu.Dispose();
            this.mainMenu = null;

            this.mPlayer = null;
            this.ParentScreen = null;
        }
        public void loadMenus()
        {
            this.pauseMenu = new MenuScreen(this, this.contentManager, "Settings", new Vector2i(0, 0), true, true, false, true, Color.White);
            pauseMenu.Title.Color = Color.Black;
            pauseMenu.addButtons(new string[] { "Continue", "New Level", "Load Level", "Save Level", "Exit" });
            pauseMenu.IsDrawn = false;
            pauseMenu.IsUpdated = false;
            pauseMenu.MouseClick += menu_MouseClick;
            pauseMenu.MouseEnter += menu_MouseEnter;
            pauseMenu.MouseLeave += menu_MouseLeave;
            ChildScreens.Add(pauseMenu);

            this.pannel = new SelectorPannel(this, this.contentManager, this.guide);
            pannel.StateChanged += pannel_StateChanged;
            ChildScreens.Add(pannel);
        }
        public override void Dispose()
        {
            this.ChildScreens.Clear();
            this.ChildScreens = null;

            this.contentManager.Dispose();
            this.contentManager = null;

            this.guide = null;

            this.lightLayer.Dispose();
            this.lightLayer = null;

            this.ofd.Dispose();
            this.ofd = null;

            this.pannel.Dispose();
            this.pannel = null;

            this.ParentScreen = null;

            this.pauseMenu.Dispose();
            this.pauseMenu = null;

            this.sfd.Dispose();
            this.sfd = null;

            this.view.Dispose();
            this.view = null;
        }
Esempio n. 5
0
        public void loadMenuScreens()
        {
            this.ChildScreens = new List<Screen>();

            this.winScreen = new MenuScreen(this, this.contentManager, "Level Won", new Vector2i(0, 0), true, true, false, true, Color.White);
            winScreen.Title.Color = Color.Black;
            winScreen.addButtons(new string[] { "Next Level",  "Restart",  "Quit"});
            winScreen.IsDrawn = false;
            winScreen.IsUpdated = false;
            winScreen.MouseEnter += menuScreen_MouseEnter;
            winScreen.MouseLeave += menuScreen_MouseLeave;
            winScreen.MouseClick += menuScreen_MouseClick;
            ChildScreens.Add(winScreen);

            this.pauseScreen = new MenuScreen(this, this.contentManager, "Game Paused", new Vector2i(0, 0), true, true, false, true, Color.White);
            pauseScreen.Title.Color = Color.Black;
            pauseScreen.addButtons(new string[] {  "Continue",  "Restart",  "Quit" });
            pauseScreen.IsDrawn = false;
            pauseScreen.IsUpdated = false;
            pauseScreen.MouseEnter += menuScreen_MouseEnter;
            pauseScreen.MouseLeave += menuScreen_MouseLeave;
            pauseScreen.MouseClick += menuScreen_MouseClick;
            ChildScreens.Add(pauseScreen);
        }