Example #1
0
        //  String _test;
        public Game1()
        {
            //      _test = "";
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            TargetElapsedTime = TimeSpan.FromTicks(333333);
            graphics.SupportedOrientations = DisplayOrientation.Portrait |
                                     DisplayOrientation.LandscapeLeft |
                                     DisplayOrientation.LandscapeRight;
             //   graphics.SupportedOrientations = DisplayOrientation.Portrait;
            //graphics.PreferredBackBufferWidth = 480;
            //graphics.PreferredBackBufferHeight = 800;
            graphics.ApplyChanges();
            _menu = new Menu(this);
            _menuig = new MenuIg(this);
            _game = new Game(this);
            _help = new Help(this);
            _credit = new Credit(this);

            _statut = Statut.Menu;
            //  this.Window.CurrentOrientation = DisplayOrientation.Portrait;
               //     this.Window.Title = "Tetris";
            //    this.Window.OrientationChanged += new EventHandler<EventArgs>(OnOrientationChanged);
        }
Example #2
0
 static void BuildMenu(Action quit)
 {
     mainMenu = new Menu(new List<Button>() {
     new Button(new Rectangle(180, 330, 140, 50), Color.Transparent, Color.White * 0.3f, "Endless", Assets.Fonts.BasicFont, Color.White, StartSP),
     new Button(new Rectangle(330, 330, 140, 50), Color.Transparent, Color.White * 0.3f, "Battle mode", Assets.Fonts.BasicFont, Color.White, StartMP),
     new Button(new Rectangle(490, 330, 140, 50), Color.Transparent, Color.White * 0.3f, "Exit game", Assets.Fonts.BasicFont, Color.White, quit),
     new Button(new Rectangle(320, 400, 160, 50), Color.Transparent, Color.White * 0.3f, "Achievements", Assets.Fonts.BasicFont, Color.White, ToAchievements)
     });
     pausedMenu = new Menu(new List<Button>() {
     new Button(new Rectangle(60, 80, 195, 50), Color.Black * 0.5f, Color.White * 0.3f, "Continue", Assets.Fonts.BasicFont, Color.White, Continue),
     new Button(new Rectangle(60, 150, 195, 50), Color.Black * 0.5f, Color.White * 0.3f, "Back to main menu", Assets.Fonts.BasicFont, Color.White, ToMenu)
     });
     gameOverMenu = new Menu(new List<Button>() {
     new Button(new Rectangle(60, 150, 195, 50), Color.Black * 0.5f, Color.White * 0.3f, "Back to main menu", Assets.Fonts.BasicFont, Color.White, ToMenu)
     });
     mpGameOverMenu = new Menu(new List<Button>() {
     new Button(new Rectangle(300, 330, 200, 50), Color.Transparent, Color.White * 0.3f, "Back to main menu", Assets.Fonts.BasicFont, Color.White, ToMenu)
     });
     achievementsMenu = new Menu(new List<Button>() {
     new Button(new Rectangle(590, 10, 200, 50), Color.Transparent, Color.White * 0.3f, "Back to main menu", Assets.Fonts.BasicFont, Color.White, ToMenu),
     new Button(new Rectangle(0, 440, 80, 40), Assets.Textures.ArrowLeft, ScrollRight),
     new Button(new Rectangle(720, 440, 80, 40), Assets.Textures.ArrowRight, ScrollLeft)
     });
     //Create the menu emitter
     List<ParticleModifier> p = new List<ParticleModifier>();
     p.Add(new GravityModifier(new Vector2(0, -0.07f)));
     p.Add(new RandomSpeedModifier(new Vector2(0.1f, 0.1f)));
     menuEmitter = new Emitter(2, 0.5f, Color.Orange * 0.6f, Color.Red * 0.7f, 20, 1, new RandomSpawnSpeed(Vector2.Zero, Vector2.Zero), Assets.Textures.Particle, new RectangleSpawnShape(800, 0), p);
     menuEmitter.ForcePosition(new Vector2(400, 500));
 }