コード例 #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);
        }
コード例 #2
0
ファイル: Controls.cs プロジェクト: BibleUs/Terrain-Engine
        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);
        }