예제 #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;
        }
예제 #2
0
 public void update(ContentManager content)
 {
     this.Polygons = content.getLightPolygons();
 }