Ejemplo n.º 1
0
        private void NewOptions()
        {
            this.mode = Mode.Options;
            double ww = (double)this.windowWidth / (double)1024;
            double hh = (double)this.windowHeight / (double)768;

            gui = new List <GUIElement>();
            GUIButton StartButton = new GUIButton((int)(224 * ww), (int)(600 * hh), (int)(256 * ww), (int)(32 * hh), "Save");

            StartButton.AddAction(this.ApplySettings);
            GUIButton ExitButton = new GUIButton((int)(544 * ww), (int)(600 * hh), (int)(256 * ww), (int)(32 * hh), "Cancel");

            ExitButton.AddAction(this.NewMenu);
            GUINumeric WidthNumeric        = new GUINumeric((int)(512 * ww), (int)(64 * hh), (int)(256 * ww), (int)(32 * hh), 512, 1440, 128);
            GUINumeric HeightNumeric       = new GUINumeric((int)(512 * ww), (int)(112 * hh), (int)(256 * ww), (int)(32 * hh), 384, 1024, 128);
            GUIStrip   RStrip              = new GUIStrip((int)(512 * ww), (int)(160 * hh), (int)(256 * ww), (int)(32 * hh));
            GUIStrip   GStrip              = new GUIStrip((int)(512 * ww), (int)(208 * hh), (int)(256 * ww), (int)(32 * hh));
            GUIStrip   BStrip              = new GUIStrip((int)(512 * ww), (int)(256 * hh), (int)(256 * ww), (int)(32 * hh));
            GUINumeric SpeedNumeric        = new GUINumeric((int)(512 * ww), (int)(304 * hh), (int)(256 * ww), (int)(32 * hh), 0, 1, 0.025);
            GUINumeric SpawnNumeric        = new GUINumeric((int)(512 * ww), (int)(352 * hh), (int)(256 * ww), (int)(32 * hh), 0, 1, 0.025);
            GUINumeric AccelerationNumeric = new GUINumeric((int)(512 * ww), (int)(400 * hh), (int)(256 * ww), (int)(32 * hh), 0, 10, 0.5);

            this.gui.Add(StartButton);
            this.gui.Add(ExitButton);
            this.gui.Add(WidthNumeric);
            this.gui.Add(HeightNumeric);
            this.gui.Add(RStrip);
            this.gui.Add(GStrip);
            this.gui.Add(BStrip);
            this.gui.Add(SpeedNumeric);
            this.gui.Add(SpawnNumeric);
            this.gui.Add(AccelerationNumeric);
            WidthNumeric.Value        = this.windowWidth;
            HeightNumeric.Value       = this.windowHeight;
            RStrip.Value              = (double)this.backgroundColor.R / 256;
            GStrip.Value              = (double)this.backgroundColor.G / 256;
            BStrip.Value              = (double)this.backgroundColor.B / 256;
            SpeedNumeric.Value        = this.speedIncrease;
            SpawnNumeric.Value        = this.spawnIncrease;
            AccelerationNumeric.Value = this.acceleration;
            GUITitle WidthTitle  = new GUITitle((int)(64 * ww), (int)(64 * hh), (int)(32 * ww), "Window width");
            GUITitle HeightTitle = new GUITitle((int)(64 * ww), (int)(112 * hh), (int)(32 * ww), "Window height");
            GUITitle RTitle      = new GUITitle((int)(64 * ww), (int)(160 * hh), (int)(32 * ww), "Background: red");
            GUITitle GTitle      = new GUITitle((int)(64 * ww), (int)(208 * hh), (int)(32 * ww), "Background: green");
            GUITitle BTitle      = new GUITitle((int)(64 * ww), (int)(256 * hh), (int)(32 * ww), "Background: blue");
            GUITitle SpeedTitle  = new GUITitle((int)(64 * ww), (int)(304 * hh), (int)(32 * ww), "Apple acceleration");
            GUITitle SpawnTitle  = new GUITitle((int)(64 * ww), (int)(352 * hh), (int)(32 * ww), "Difficulty increase");
            GUITitle AccelTitle  = new GUITitle((int)(64 * ww), (int)(400 * hh), (int)(32 * ww), "Click boost");

            this.gui.Add(WidthTitle);
            this.gui.Add(HeightTitle);
            this.gui.Add(RTitle);
            this.gui.Add(GTitle);
            this.gui.Add(BTitle);
            this.gui.Add(SpeedTitle);
            this.gui.Add(SpawnTitle);
            this.gui.Add(AccelTitle);
        }
Ejemplo n.º 2
0
        private void GameOver()
        {
            this.mode = Mode.GameOver;
            double ww = (double)this.windowWidth / (double)1024;
            double hh = (double)this.windowHeight / (double)768;

            this.gui = new List <GUIElement>();
            GUITitle  GameOverTitle = new GUITitle((int)(224 * ww), (int)(192 * hh), (int)(96 * ww), "GAME OVER");
            GUITitle  ScoreTitle    = new GUITitle((int)(362 * ww), (int)(320 * hh), (int)(32 * ww), "Your score is " + this.score);
            GUIButton MenuButton    = new GUIButton((int)(384 * ww), (int)(400 * hh), (int)(256 * ww), (int)(32 * hh), "Back");

            this.gui.Add(GameOverTitle);
            this.gui.Add(ScoreTitle);
            this.gui.Add(MenuButton);
            MenuButton.AddAction(NewMenu);
        }
Ejemplo n.º 3
0
 public GUINumeric(int x, int y, int width, int height, double minValue, double maxValue, double step)
 {
     this.x           = x;
     this.y           = y;
     this.width       = width;
     this.height      = height;
     this.minValue    = minValue;
     this.maxValue    = maxValue;
     this.step        = step;
     this.value       = this.minValue;
     this.leftButton  = new GUIButton((int)this.x, (int)this.y, this.height, this.height, "-");
     this.rightButton = new GUIButton((int)(this.x + this.width - this.height), (int)this.y, this.height, this.height, "+");
     this.title       = new GUITitle((int)(this.x + this.height), (int)this.y, this.height, this.value.ToString());
     this.leftButton.AddAction(this.decreaseValue);
     this.rightButton.AddAction(this.increaseValue);
 }