Exemple #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Exemple #2
0
        public SkyBox(Game1 newGame, Vector3 newCenter, string newName)
        {
            Game = newGame;
            center = newCenter;

            skyBoxModel=LoadModel(newName, out skyBoxTextures);
        }
 public TextureTerrain(Game1 newGame, string newMapName, string newTexture)
 {
     Game = newGame;
     texture = Game.Content.Load<Texture2D>(newTexture);
     LoadHeightData(Game.Content.Load<Texture2D>(newMapName));
     SetUpVertices();
     SetUpIndices();
     CalculateNormals();
     CopytoBuffers();
 }
        //or call this for textured models
        public ModelLoader(Game1 newGame, string newModelName, Vector3 newPosition, float newSize, short newTextureCount)
        {
            Game = newGame;
            position = newPosition;
            rotation = Quaternion.Identity;
            size = newSize;

            textured = true;
            texturecount = newTextureCount;
            model = LoadTexturedModel(newModelName, out textures);
        }
        //call for vertex-colored load
        public ModelLoader(Game1 newGame, string newModelName, Vector3 newPosition, float newSize)
        {
            Game = newGame;
            position = newPosition;
            rotation = Quaternion.Identity;
            size = newSize;

            textured = false;

            model=LoadModel(newModelName);
        }
Exemple #6
0
        public BBGrass(Game1 newGame, TextureTerrain newTerrain, string newTexture)
        {
            Game = newGame;
            terrain = newTerrain;
            bbtex = Game.Content.Load<Texture2D>(newTexture);
            SetUpBillboards();
            CopytoBuffers();

            Game.billboardGrassEffect.Parameters["xTexture"].SetValue(bbtex);
            Game.billboardGrassEffect.CurrentTechnique = Game.billboardGrassEffect.Techniques["GrassBB"];
        }
        public PointSprites_Multi(Game1 newGame, Vector3 newPosition, Texture2D newTexture, int newAmount, float newSize, Random newRand)
        {
            position = newPosition;
            texture = newTexture;
            Game = newGame;
            amount = newAmount;
            size = newSize;
            rand = newRand;

            vertices = new VertexPositionTexture[amount * 6];

            SetUpVertices();
        }
Exemple #8
0
        public Water(Game1 newGame,int newWidth,int newLength, float newSize, Texture2D newTexture, Texture2D newBumpMap)
        {
            Game=newGame;
            width = newWidth;
            length = newLength;
            size = newSize;
            bumpMap = newBumpMap;

            SetUpVertices();
            SetUpIndices();
            SetUpBuffers();

            refractionRenderTarget = new RenderTarget2D(Game.device, (int)(Game.device.PresentationParameters.BackBufferWidth * Game.enviro.reflectionQuality), (int)(Game.device.PresentationParameters.BackBufferHeight * Game.enviro.reflectionQuality), true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
            reflectionRenderTarget = new RenderTarget2D(Game.device, (int)(Game.device.PresentationParameters.BackBufferWidth * Game.enviro.reflectionQuality), (int)(Game.device.PresentationParameters.BackBufferHeight * Game.enviro.reflectionQuality), true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);

            Game.waterEffect.CurrentTechnique = Game.waterEffect.Techniques["Water"];
        }
        public PointSprites_Single(Game1 newGame, Vector3 newPosition, Texture2D newTexture, float newSize)
        {
            position = newPosition;
            texture = newTexture;
            Game=newGame;
            size = newSize;

            vertices[0] = new VertexPositionTexture(position, new Vector2(0, 0));
            vertices[1] = new VertexPositionTexture(position, new Vector2(0, 1));
            vertices[2] = new VertexPositionTexture(position, new Vector2(1, 1));

            //vertices[3] = new VertexPositionTexture(new Vector3(), new Vector2(1, 1));
            vertices[3] = new VertexPositionTexture(position, new Vector2(1, 0));
            //vertices[5] = new VertexPositionTexture(new Vector3(), new Vector2(0, 0));

            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            indices[3] = 0;
            indices[4] = 2;
            indices[5] = 3;

            SetUpBuffers();
        }
Exemple #10
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);
        }
Exemple #11
0
 public Compass(Game1 newGame, Vector2 position, Texture2D[] newTexture)
 {
     texture = newTexture;
     rectangle_main = new Rectangle((int)position.X, (int)position.Y, texture[0].Width, texture[0].Height);
     //rectangle_sub = new Rectangle(rectangle_main.Center.X + (int)newGame.enviro.WindDirection.X - texture[1].Width/2, rectangle_main.Center.Y + (int)newGame.enviro.WindDirection.Z - texture[1].Height/2, texture[1].Width, texture[1].Height);
     rectangle_sub = new Rectangle(rectangle_main.Center.X - texture[1].Width / 2, rectangle_main.Center.Y - texture[1].Height / 2 - 10, texture[1].Width, texture[1].Height);
     pos_main = new Vector2(rectangle_main.Center.X, rectangle_main.Center.Y);
     pos_sub = new Vector2(rectangle_sub.Center.X, rectangle_sub.Center.Y);
 }