Ejemplo n.º 1
0
        public Controls(Game1 newGame)
        {
            Game = newGame;

            controlBG_tex    = Game.Content.Load <Texture2D>("controls/controlbg");
            controlBG_rec[0] = new Rectangle(0, Game.device.Viewport.Height - controlBG_tex.Height, controlBG_tex.Width, controlBG_tex.Height);
            controlBG_rec[1] = new Rectangle(Game.device.Viewport.Width - controlBG_tex.Width, Game.device.Viewport.Bounds.Bottom - controlBG_tex.Height, controlBG_tex.Width, controlBG_tex.Height);

            slider[0] = Game.Content.Load <Texture2D>("controls/slider_base");
            slider[1] = Game.Content.Load <Texture2D>("controls/slider_slide");

            acceptbg = Game.Content.Load <Texture2D>("controls/acceptbg");

            checkbox = Game.Content.Load <Texture2D>("controls/checkbox");

            compass[0] = Game.Content.Load <Texture2D>("controls/compass");
            compass[1] = Game.Content.Load <Texture2D>("controls/indicator");

            writer = new TextWriter(Game, "controls/controlfont");

            checkitem[0] = new CheckboxOption("Enable Default Light:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 16 * 30), Game.enviro.enableDefaultLighting);
            checkitem[1] = new CheckboxOption("Enable Point Light:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 15 * 30), Game.enviro.enablePointLight);
            checkitem[2] = new CheckboxOption("Enable Fog:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 10 * 30), Game.enviro.fogEnabled);
            checkitem[3] = new CheckboxOption("FlyMode:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 7 * 30), Game.enviro.FlyMode);
            checkitem[4] = new CheckboxOption("Gray Scale:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 3 * 30), Game.enviro.grayScale);
            checkitem[5] = new CheckboxOption("First Person Mode:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 6 * 30), Game.cam.fpsState);
            checkitem[6] = new CheckboxOption("Smooth Camera:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 5 * 30), Game.enviro.smoothCamera);
            checkitem[7] = new CheckboxOption("Enable Snow:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 9 * 30), Game.enviro.enableSnow);
            checkitem[8] = new CheckboxOption("Enable Rain:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 8 * 30), Game.enviro.enableRain);
            checkitem[9] = new CheckboxOption("Inverted Colors:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 4 * 30), Game.enviro.invertColors);

            floatitem[0] = new SliderOptionFloat("Ambient Light", writer, slider, new Vector2(10, Game.device.Viewport.Height - 14 * 30), Game.enviro.ambient, 0, 1);
            floatitem[1] = new SliderOptionFloat("Light Power", writer, slider, new Vector2(10, Game.device.Viewport.Height - 13 * 30), Game.enviro.lightpower, 0, 10);
            floatitem[2] = new SliderOptionFloat("Light Scatter", writer, slider, new Vector2(10, Game.device.Viewport.Height - 12 * 30), Game.enviro.lightscatter, 0, 100);
            floatitem[3] = new SliderOptionFloat("Grass Fade", writer, slider, new Vector2(10, Game.device.Viewport.Height - 11 * 30), Game.enviro.grassFade, 0, 100);
            floatitem[4] = new SliderOptionFloat("Fog Start", writer, slider, new Vector2(10, Game.device.Viewport.Height - 9 * 30), Game.enviro.fogStart, 0, 200);
            floatitem[5] = new SliderOptionFloat("Fog End", writer, slider, new Vector2(10, Game.device.Viewport.Height - 8 * 30), Game.enviro.fogEnd, 0, 500);
            floatitem[6] = new SliderOptionFloat("Fog Color   R:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 7 * 30), Game.enviro.fogColor.X, 0, 1);
            floatitem[7] = new SliderOptionFloat("            G:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 6 * 30), Game.enviro.fogColor.Y, 0, 1);
            floatitem[8] = new SliderOptionFloat("            B:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 5 * 30), Game.enviro.fogColor.Z, 0, 1);

            floatitem[9]  = new SliderOptionFloat("Wind Wave Size", writer, slider, new Vector2(10, Game.device.Viewport.Height - 4 * 30), Game.enviro.WindWaveSize, 0, 50);
            floatitem[10] = new SliderOptionFloat("Wind Randomness", writer, slider, new Vector2(10, Game.device.Viewport.Height - 3 * 30), Game.enviro.WindRandomness, 0, 5);
            //floatitem[11] = new SliderOptionFloat("Wind Speed", writer, slider, new Vector2(10, Game.device.Viewport.Height - 2 * 30), Game.enviro.WindSpeed, 0, 100);
            floatitem[11] = new SliderOptionFloat("Wind Amount", writer, slider, new Vector2(10, Game.device.Viewport.Height - 2 * 30), Game.enviro.WindAmount, 0, 1);
            floatitem[12] = new SliderOptionFloat("View Distance", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 15 * 30), Game.enviro.viewDistance, 0, 1000);
            floatitem[13] = new SliderOptionFloat("Field Of View", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 14 * 30), Game.enviro.fieldOfView, 40, 150);
            floatitem[14] = new SliderOptionFloat("Grass Size", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 12 * 30), Game.enviro.grassWidth, 0.5f, 3);
            floatitem[15] = new SliderOptionFloat("Weather Intensity", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 11 * 30), Game.enviro.weatherParticles, 0, 10000);
            floatitem[16] = new SliderOptionFloat("Water Level", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 10 * 30), Game.enviro.waterLevel, 0, 30);
            floatitem[17] = new SliderOptionFloat("Water Wave Height:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 1 * 30), Game.enviro.waveHeight, 0, 3);

            intitem[0] = new SliderOptionInt("Grass Intensity", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 13 * 30), Game.enviro.grassIntensity, 0, 10);

            accept = new AcceptItem("Accept", writer, acceptbg, new Vector2(Game.device.Viewport.Width - 100, Game.device.Viewport.Height - 50));

            compassitem = new Compass(Game, new Vector2(Game.device.Viewport.Width / 2 - compass[0].Width / 2, Game.device.Viewport.Height - compass[0].Height), compass);
        }
Ejemplo n.º 2
0
        public void Update()
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !buttonpressed)
            {
                if (show)
                {
                    show = false;
                }
                else
                    show = true;

                buttonpressed = true;
            }
            else if (Keyboard.GetState().IsKeyUp(Keys.Enter) && buttonpressed)
            {
                buttonpressed = false;
            }

            if (show)
            {
                Game.enviro.enableDefaultLighting = checkitem[0].Value();
                Game.enviro.enablePointLight = checkitem[1].Value();
                Game.enviro.fogEnabled = checkitem[2].Value();
                Game.enviro.FlyMode = checkitem[3].Value();
                Game.enviro.grayScale = checkitem[4].Value();
                Game.cam.fpsState = checkitem[5].Value();
                Game.enviro.smoothCamera = checkitem[6].Value();
                Game.enviro.enableSnow = checkitem[7].Value();
                Game.enviro.enableRain = checkitem[8].Value();
                Game.enviro.invertColors = checkitem[9].Value();

                Game.enviro.ambient = floatitem[0].Value();
                Game.enviro.lightpower = floatitem[1].Value();
                Game.enviro.lightscatter = floatitem[2].Value();
                Game.enviro.grassFade = floatitem[3].Value();
                Game.enviro.fogStart = floatitem[4].Value();
                Game.enviro.fogEnd = floatitem[5].Value();
                Game.enviro.fogColor.X = floatitem[6].Value();
                Game.enviro.fogColor.Y = floatitem[7].Value();
                Game.enviro.fogColor.Z = floatitem[8].Value();

                Game.enviro.WindWaveSize = floatitem[9].Value();
                Game.enviro.WindRandomness = floatitem[10].Value();
                //Game.enviro.WindSpeed = floatitem[11].Value();
                Game.enviro.WindAmount = floatitem[11].Value();
                Game.enviro.viewDistance = floatitem[12].Value();
                    if (Game.enviro.grassFade>Game.enviro.viewDistance)
                    {
                        Game.enviro.grassFade = Game.enviro.viewDistance;
                        floatitem[3] = new SliderOptionFloat("Grass Fade", writer, slider, new Vector2(10, Game.device.Viewport.Height - 11 * 30), Game.enviro.grassFade, 0, 500);
                    }
                Game.enviro.fieldOfView = floatitem[13].Value();
                Game.enviro.grassWidth = Game.enviro.grassHeight = floatitem[14].Value();
                Game.enviro.weatherParticles = (int)floatitem[15].Value();
                Game.enviro.waterLevel = floatitem[16].Value();
                Game.enviro.waveHeight = floatitem[17].Value();

                Game.enviro.grassIntensity = intitem[0].Value();

                if (accept.Value())
                {
                    Game.terrain = new TextureTerrain(Game, Game.enviro.map, Game.enviro.texture);
                    if (Game.enviro.billboardedGrass)
                        Game.bbgrass = new BBGrass(Game, Game.terrain, Game.enviro.grassTexture);
                    else
                        Game.grass = new Grass(Game, Game.terrain, Game.enviro.grassTexture);
                    Game.snow = new PointSprites_Multi(Game, Game.cam.cameraPosition, Game.Content.Load<Texture2D>("snow"), Game.enviro.weatherParticles, 0.2f, Game.rand);
                }

                Game.enviro.WindDirection = compassitem.Value();
            }
        }
Ejemplo n.º 3
0
        public Controls(Game1 newGame)
        {
            Game = newGame;

            controlBG_tex = Game.Content.Load<Texture2D>("controls/controlbg");
            controlBG_rec[0] = new Rectangle(0, Game.device.Viewport.Height - controlBG_tex.Height, controlBG_tex.Width, controlBG_tex.Height);
            controlBG_rec[1] = new Rectangle(Game.device.Viewport.Width - controlBG_tex.Width, Game.device.Viewport.Bounds.Bottom - controlBG_tex.Height, controlBG_tex.Width, controlBG_tex.Height);

            slider[0] = Game.Content.Load<Texture2D>("controls/slider_base");
            slider[1] = Game.Content.Load<Texture2D>("controls/slider_slide");

            acceptbg = Game.Content.Load<Texture2D>("controls/acceptbg");

            checkbox = Game.Content.Load<Texture2D>("controls/checkbox");

            compass[0] = Game.Content.Load<Texture2D>("controls/compass");
            compass[1] = Game.Content.Load<Texture2D>("controls/indicator");

            writer=new TextWriter(Game,"controls/controlfont");

            checkitem[0] = new CheckboxOption("Enable Default Light:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 16 * 30), Game.enviro.enableDefaultLighting);
            checkitem[1] = new CheckboxOption("Enable Point Light:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 15 * 30), Game.enviro.enablePointLight);
            checkitem[2] = new CheckboxOption("Enable Fog:", writer, checkbox, new Vector2(10, Game.device.Viewport.Height - 10 * 30), Game.enviro.fogEnabled);
            checkitem[3] = new CheckboxOption("FlyMode:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 7 * 30), Game.enviro.FlyMode);
            checkitem[4] = new CheckboxOption("Gray Scale:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 3 * 30), Game.enviro.grayScale);
            checkitem[5] = new CheckboxOption("First Person Mode:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 6 * 30), Game.cam.fpsState);
            checkitem[6] = new CheckboxOption("Smooth Camera:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 5 * 30), Game.enviro.smoothCamera);
            checkitem[7] = new CheckboxOption("Enable Snow:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 9 * 30), Game.enviro.enableSnow);
            checkitem[8] = new CheckboxOption("Enable Rain:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 8 * 30), Game.enviro.enableRain);
            checkitem[9] = new CheckboxOption("Inverted Colors:", writer, checkbox, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 4 * 30), Game.enviro.invertColors);

            floatitem[0] = new SliderOptionFloat("Ambient Light", writer, slider, new Vector2(10, Game.device.Viewport.Height - 14 * 30), Game.enviro.ambient, 0, 1);
            floatitem[1] = new SliderOptionFloat("Light Power", writer, slider, new Vector2(10, Game.device.Viewport.Height - 13 * 30), Game.enviro.lightpower, 0, 10);
            floatitem[2] = new SliderOptionFloat("Light Scatter", writer, slider, new Vector2(10, Game.device.Viewport.Height - 12 * 30), Game.enviro.lightscatter, 0, 100);
            floatitem[3] = new SliderOptionFloat("Grass Fade", writer, slider, new Vector2(10, Game.device.Viewport.Height - 11 * 30), Game.enviro.grassFade, 0, 100);
            floatitem[4] = new SliderOptionFloat("Fog Start", writer, slider, new Vector2(10, Game.device.Viewport.Height - 9 * 30), Game.enviro.fogStart, 0, 200);
            floatitem[5] = new SliderOptionFloat("Fog End", writer, slider, new Vector2(10, Game.device.Viewport.Height - 8 * 30), Game.enviro.fogEnd, 0, 500);
            floatitem[6] = new SliderOptionFloat("Fog Color   R:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 7 * 30), Game.enviro.fogColor.X, 0, 1);
            floatitem[7] = new SliderOptionFloat("            G:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 6 * 30), Game.enviro.fogColor.Y, 0, 1);
            floatitem[8] = new SliderOptionFloat("            B:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 5 * 30), Game.enviro.fogColor.Z, 0, 1);

            floatitem[9] = new SliderOptionFloat("Wind Wave Size", writer, slider, new Vector2(10, Game.device.Viewport.Height - 4 * 30), Game.enviro.WindWaveSize, 0, 50);
            floatitem[10] = new SliderOptionFloat("Wind Randomness", writer, slider, new Vector2(10, Game.device.Viewport.Height - 3 * 30), Game.enviro.WindRandomness, 0, 5);
            //floatitem[11] = new SliderOptionFloat("Wind Speed", writer, slider, new Vector2(10, Game.device.Viewport.Height - 2 * 30), Game.enviro.WindSpeed, 0, 100);
            floatitem[11] = new SliderOptionFloat("Wind Amount", writer, slider, new Vector2(10, Game.device.Viewport.Height - 2 * 30), Game.enviro.WindAmount, 0, 1);
            floatitem[12] = new SliderOptionFloat("View Distance", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 15 * 30), Game.enviro.viewDistance, 0, 1000);
            floatitem[13] = new SliderOptionFloat("Field Of View", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 14 * 30), Game.enviro.fieldOfView, 40, 150);
            floatitem[14] = new SliderOptionFloat("Grass Size", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 12 * 30), Game.enviro.grassWidth, 0.5f, 3);
            floatitem[15] = new SliderOptionFloat("Weather Intensity", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 11 * 30), Game.enviro.weatherParticles, 0, 10000);
            floatitem[16] = new SliderOptionFloat("Water Level", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 10 * 30), Game.enviro.waterLevel, 0, 30);
            floatitem[17] = new SliderOptionFloat("Water Wave Height:", writer, slider, new Vector2(10, Game.device.Viewport.Height - 1 * 30), Game.enviro.waveHeight, 0, 3);

            intitem[0] = new SliderOptionInt("Grass Intensity", writer, slider, new Vector2(Game.device.Viewport.Width - 300, Game.device.Viewport.Height - 13 * 30), Game.enviro.grassIntensity, 0, 10);

            accept = new AcceptItem("Accept", writer, acceptbg, new Vector2(Game.device.Viewport.Width-100, Game.device.Viewport.Height - 50));

            compassitem = new Compass(Game, new Vector2(Game.device.Viewport.Width/2-compass[0].Width/2,Game.device.Viewport.Height-compass[0].Height), compass);
        }
Ejemplo n.º 4
0
        public void Update()
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !buttonpressed)
            {
                if (show)
                {
                    show = false;
                }
                else
                {
                    show = true;
                }

                buttonpressed = true;
            }
            else if (Keyboard.GetState().IsKeyUp(Keys.Enter) && buttonpressed)
            {
                buttonpressed = false;
            }

            if (show)
            {
                Game.enviro.enableDefaultLighting = checkitem[0].Value();
                Game.enviro.enablePointLight      = checkitem[1].Value();
                Game.enviro.fogEnabled            = checkitem[2].Value();
                Game.enviro.FlyMode      = checkitem[3].Value();
                Game.enviro.grayScale    = checkitem[4].Value();
                Game.cam.fpsState        = checkitem[5].Value();
                Game.enviro.smoothCamera = checkitem[6].Value();
                Game.enviro.enableSnow   = checkitem[7].Value();
                Game.enviro.enableRain   = checkitem[8].Value();
                Game.enviro.invertColors = checkitem[9].Value();

                Game.enviro.ambient      = floatitem[0].Value();
                Game.enviro.lightpower   = floatitem[1].Value();
                Game.enviro.lightscatter = floatitem[2].Value();
                Game.enviro.grassFade    = floatitem[3].Value();
                Game.enviro.fogStart     = floatitem[4].Value();
                Game.enviro.fogEnd       = floatitem[5].Value();
                Game.enviro.fogColor.X   = floatitem[6].Value();
                Game.enviro.fogColor.Y   = floatitem[7].Value();
                Game.enviro.fogColor.Z   = floatitem[8].Value();

                Game.enviro.WindWaveSize   = floatitem[9].Value();
                Game.enviro.WindRandomness = floatitem[10].Value();
                //Game.enviro.WindSpeed = floatitem[11].Value();
                Game.enviro.WindAmount   = floatitem[11].Value();
                Game.enviro.viewDistance = floatitem[12].Value();
                if (Game.enviro.grassFade > Game.enviro.viewDistance)
                {
                    Game.enviro.grassFade = Game.enviro.viewDistance;
                    floatitem[3]          = new SliderOptionFloat("Grass Fade", writer, slider, new Vector2(10, Game.device.Viewport.Height - 11 * 30), Game.enviro.grassFade, 0, 500);
                }
                Game.enviro.fieldOfView      = floatitem[13].Value();
                Game.enviro.grassWidth       = Game.enviro.grassHeight = floatitem[14].Value();
                Game.enviro.weatherParticles = (int)floatitem[15].Value();
                Game.enviro.waterLevel       = floatitem[16].Value();
                Game.enviro.waveHeight       = floatitem[17].Value();

                Game.enviro.grassIntensity = intitem[0].Value();

                if (accept.Value())
                {
                    Game.terrain = new TextureTerrain(Game, Game.enviro.map, Game.enviro.texture);
                    if (Game.enviro.billboardedGrass)
                    {
                        Game.bbgrass = new BBGrass(Game, Game.terrain, Game.enviro.grassTexture);
                    }
                    else
                    {
                        Game.grass = new Grass(Game, Game.terrain, Game.enviro.grassTexture);
                    }
                    Game.snow = new PointSprites_Multi(Game, Game.cam.cameraPosition, Game.Content.Load <Texture2D>("snow"), Game.enviro.weatherParticles, 0.2f, Game.rand);
                }

                Game.enviro.WindDirection = compassitem.Value();
            }
        }