Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public override void Dispose()
        {
            ParentScreen = null;

            foreach (Screen s in ChildScreens)
                s.Dispose();
            ChildScreens.Clear();
            ChildScreens = null;

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

            this.lightLayer.Dispose();
            this.lightLayer = null;
        }
Ejemplo n.º 4
0
        public LevelEditorScreen(Screen screen)
        {
            this.ParentScreen = screen;
            this.GameResolution = ParentScreen.GameResolution;
            this.WindowResolution = ParentScreen.WindowResolution;

            this.ChildScreens = new List<Screen>();

            this.IsDrawn = true;
            this.IsUpdated = true;

            //this.level = null;
            this.showGrid = true;
            //this.blocksPaused = true;

            this.lightLayer = new LightLayer(this.GameResolution, this.WindowResolution);
            this.contentManager = new ContentManager(Game1.defaultWorldParameters);

            this.guide = new GuideBlock(this.contentManager);
            this.view = new View(new FloatRect(0, 0, this.GameResolution.X, this.GameResolution.Y));

            loadMenus();
        }
Ejemplo n.º 5
0
        public GameScreen(Screen parentScreen)
        {
            this.GameResolution = parentScreen.GameResolution;
            this.WindowResolution = parentScreen.WindowResolution;
            this.ParentScreen = parentScreen;

            this.IsDrawn = true;
            this.IsUpdated = true;

            this.contentManager = new ContentManager(Game1.defaultWorldParameters);
            contentManager.LevelWon += contentManager_LevelWon;

            IO.loadLevel(this.contentManager, "Content/levels/level1.xml");
            this.currentLevel = 1;

            this.lightLayer = new LightLayer(this.GameResolution, this.WindowResolution);
            lightLayer.Lights.Add(new Light(new Vector2f(100, 100), Color.White, .4f));

            this.sp = new Sprite(contentManager.Media.loadTexture("Content/images/bg.jpg", true));
            sp.Scale = new Vector2f(this.GameResolution.X / (float)sp.TextureRect.Width, this.GameResolution.Y / (float)sp.TextureRect.Height);

            loadMenuScreens();
        }
Ejemplo n.º 6
0
        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;
        }