Example #1
0
        override public void DrawTooltip(SpriteBatch spriteBatch, World.State state)
        {
            int index = Gui.World.GetIndex(Gui.TileInfoPoint.X, Gui.TileInfoPoint.Y);
            int textY = 300;

            spriteBatch.DrawString(Gui.Font, "Elevation: " + (int)(state.Elevation[index]), new Vector2(5, textY += 15), Color.White);
        }
Example #2
0
        public static void DrawInfoTooltip(SpriteBatch spriteBatch, WorldGUI gui, World.State state)
        {
            int index = gui.World.GetIndex(gui.TileInfoPoint.X, gui.TileInfoPoint.Y);
            int textY = 300;

            spriteBatch.DrawString(gui.Font, "Index: " + index, new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Plate: " + state.Plate[index], new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Elevation: " + (int)(state.Elevation[index]), new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Temperature: " + (int)(state.Temperature[index] - gui.World.Data.FreezingTemperature), new Vector2(5, textY  += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Pressure: " + (state.Pressure[index] / gui.World.Data.StaticPressure).ToString("0.00"), new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Humidity: " + state.Humidity[index].ToString("0.00"), new Vector2(5, textY     += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "CloudCover: " + state.CloudCover[index].ToString("0.00"), new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Rainfall: " + (state.Rainfall[index] * gui.World.Data.TicksPerYear).ToString("0.00"), new Vector2(5, textY       += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Evaporation: " + (state.Evaporation[index] * gui.World.Data.TicksPerYear).ToString("0.00"), new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "WaterTableDepth: " + (int)state.WaterTableDepth[index], new Vector2(5, textY       += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "GroundWater: " + state.GroundWater[index].ToString("0.00"), new Vector2(5, textY   += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "SurfaceWater: " + state.SurfaceWater[index].ToString("0.00"), new Vector2(5, textY += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "SurfaceIce: " + state.SurfaceIce[index].ToString("0.00"), new Vector2(5, textY     += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "SoilFertility: " + (int)(state.SoilFertility[index] * 100), new Vector2(5, textY   += 15), Color.White);
            spriteBatch.DrawString(gui.Font, "Canopy: " + (int)(state.Canopy[index] * 100), new Vector2(5, textY += 15), Color.White);
            //	spriteBatch.DrawString(font, "Wind: " + Wind[index], new Vector2(5, textY += 15), Color.White);
            for (int s = 0; s < World.MaxGroupsPerTile; s++)
            {
                int groupIndex = state.AnimalsPerTile[index * World.MaxGroupsPerTile + s];
                if (groupIndex >= 0 && state.Animals[groupIndex].Population > 0)
                {
                    int speciesIndex = state.Animals[groupIndex].Species;
                    spriteBatch.Draw(gui.whiteTex, new Rectangle(5, textY += 15, 10, 10), null, state.Species[speciesIndex].Color);
                    float population = state.Animals[groupIndex].Population;
                    spriteBatch.DrawString(gui.Font,
                                           state.Species[speciesIndex].Name + ": " + ((int)population),
                                           new Vector2(25, textY), Color.White);
                }
            }
        }
Example #3
0
        override public void DrawWorld(SpriteBatch spriteBatch, World.State state)
        {
            var p = Gui.TileInfoPoint;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            for (int i = (int)-Math.Ceiling(BrushSize); i <= Math.Ceiling(BrushSize); i++)
            {
                for (int j = (int)-Math.Ceiling(BrushSize); j <= Math.Ceiling(BrushSize); j++)
                {
                    float dist = (float)Math.Sqrt(i * i + j * j);
                    if (dist <= BrushSize)
                    {
                        float distT = (BrushSize == 0) ? 1.0f : (1.0f - (float)Math.Pow(dist / BrushSize, 2));
                        int   x     = Gui.World.WrapX(p.X + i);
                        int   y     = p.Y + j;
                        if (y < 0 || y >= Gui.World.Size)
                        {
                            continue;
                        }
                        Rectangle rect = new Rectangle(x * Gui.World.tileRenderSize, y * Gui.World.tileRenderSize, Gui.World.tileRenderSize, Gui.World.tileRenderSize);
                        spriteBatch.Draw(Gui.whiteTex, rect, Color.White * 0.2f);
                    }
                }
            }
            spriteBatch.End();
        }
Example #4
0
        public void Update(World world, World.State state)
        {
            int index = world.GetIndex(Position.X, Position.Y);

            Temperature[CurSampleIndex]  = state.Temperature[index];
            Pressure[CurSampleIndex]     = state.Pressure[index];
            Humidity[CurSampleIndex]     = state.Humidity[index];
            CloudCover[CurSampleIndex]   = state.CloudCover[index];
            Rainfall[CurSampleIndex]     = state.Rainfall[index];
            Evaporation[CurSampleIndex]  = state.Evaporation[index];
            GroundWater[CurSampleIndex]  = state.GroundWater[index];
            SurfaceWater[CurSampleIndex] = state.SurfaceWater[index];
            Canopy[CurSampleIndex]       = state.Canopy[index];
            CurSampleIndex = (CurSampleIndex + 1) % SampleCount;
            TotalSamples   = Math.Min(SampleCount, TotalSamples + 1);
        }
Example #5
0
        override public void DrawWorld(SpriteBatch spriteBatch, World.State state)
        {
            var probe = Gui.World.Probes[ProbeIndex];

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(
                Gui.whiteTex,
                new Vector2(probe.Position.X * Gui.World.tileRenderSize + Gui.World.tileRenderSize / 2, probe.Position.Y * Gui.World.tileRenderSize + Gui.World.tileRenderSize / 2),
                null,
                Color.LightPink * 0.5f,
                0,
                new Vector2(0.5f, 0.5f),
                8,
                SpriteEffects.None,
                0);
            spriteBatch.End();
        }
Example #6
0
 public static void DrawSelection(SpriteBatch spriteBatch, WorldGUI gui, World.State state)
 {
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
     for (int i = 0; i < gui.AnimalsSelected.Count; i++)
     {
         int animalIndex = gui.AnimalsSelected[i];
         spriteBatch.Draw(
             gui.whiteTex,
             new Vector2(state.Animals[animalIndex].Position.X * gui.World.tileRenderSize, state.Animals[animalIndex].Position.Y * gui.World.tileRenderSize),
             null,
             Color.LightPink * 0.5f,
             0,
             new Vector2(0.5f, 0.5f),
             8,
             SpriteEffects.None,
             0);
     }
     spriteBatch.End();
 }
Example #7
0
        override public void DrawTooltip(SpriteBatch spriteBatch, World.State state)
        {
            Tool.DrawInfoTooltip(spriteBatch, Gui, state);
            var probe = Gui.World.Probes[ProbeIndex];

            int y = 1000;

            for (int i = 0; i < probe.TotalSamples; i++)
            {
                int index = (i + probe.CurSampleIndex - probe.TotalSamples + Probe.SampleCount) % Probe.SampleCount;
                DrawDataPoint(spriteBatch, i, probe.Temperature[index], Gui.World.Data.FreezingTemperature - 60, Gui.World.Data.FreezingTemperature + 60, Color.Red);
                DrawDataPoint(spriteBatch, i, probe.Pressure[index], Gui.World.Data.StaticPressure - 5000, Gui.World.Data.StaticPressure + 1000, Color.Orange);
                DrawDataPoint(spriteBatch, i, probe.Humidity[index], 0, 6, Color.LightBlue);
                DrawDataPoint(spriteBatch, i, probe.CloudCover[index], 0, 6, Color.Gray);
                DrawDataPoint(spriteBatch, i, probe.Rainfall[index], 0, 10.0f / Gui.World.Data.TicksPerYear, Color.DarkBlue);
                DrawDataPoint(spriteBatch, i, probe.GroundWater[index], 0, 5, Color.Brown);
                DrawDataPoint(spriteBatch, i, probe.SurfaceWater[index], 0, 5, Color.Teal);
                DrawDataPoint(spriteBatch, i, probe.Canopy[index], 0, 5, Color.Green);
            }
        }
Example #8
0
 override public void DrawWorld(SpriteBatch spriteBatch, World.State state)
 {
     if (!Active)
     {
         var p = Gui.TileInfoPoint;
         StartPlate = Gui.World.States[Gui.World.CurStateIndex].Plate[Gui.World.GetIndex(p.X, p.Y)];
     }
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
     for (int i = 0; i < Gui.World.Size; i++)
     {
         for (int j = 0; j < Gui.World.Size; j++)
         {
             if (Gui.World.States[Gui.World.CurStateIndex].Plate[Gui.World.GetIndex(i, j)] == StartPlate)
             {
                 Rectangle rect = new Rectangle(i * Gui.World.tileRenderSize, j * Gui.World.tileRenderSize, Gui.World.tileRenderSize, Gui.World.tileRenderSize);
                 spriteBatch.Draw(Gui.whiteTex, rect, Color.White * 0.2f);
             }
         }
     }
     spriteBatch.End();
 }
Example #9
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDevice graphics)
        {
            graphics.SetRenderTarget(_worldRenderTarget);
            World.Draw(gameTime, spriteBatch, ShowLayers, whiteTex);


            World.State state = World.States[World.CurRenderStateIndex];

            _tickTimer += gameTime.ElapsedGameTime.Ticks;
            if (_tickTimer >= TimeSpan.TicksPerSecond)
            {
                _tickTimer      -= TimeSpan.TicksPerSecond;
                _ticksToDisplay  = state.Ticks - _ticksLastSecond;
                _ticksLastSecond = state.Ticks;
            }

            var curTool = GetTool(ActiveTool);

            if (curTool != null)
            {
                curTool.DrawWorld(spriteBatch, state);
            }
            graphics.SetRenderTarget(null);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            Vector2 cameraPos = new Vector2(CameraPos.X * World.tileRenderSize, CameraPos.Y * World.tileRenderSize);

            spriteBatch.Draw(_worldRenderTarget, new Rectangle((int)(viewport.X / 2 - cameraPos.X * Zoom), (int)(viewport.Y / 2 - cameraPos.Y * Zoom), (int)(Zoom * _worldRenderTarget.Width), (int)(Zoom * _worldRenderTarget.Height)), null, Color.White);

            spriteBatch.Draw(whiteTex, new Rectangle(0, 0, 150, 15 * LayerDisplayKeys.Count + 20), null, Color.Black * 0.5f);

            int textY = 5;

            for (int i = 0; i < Tools.Count; i++)
            {
                spriteBatch.DrawString(Font, Tools[i].HotKey + " - [" + ((i == ActiveTool) ? "X" : " ") + "] " + Tools[i].Name, new Vector2(5, textY), Color.White);
                textY += 15;
            }
            textY += 20;

            spriteBatch.DrawString(Font, "[ x" + ((int)World.TimeScale) + " ] (actual = " + _ticksToDisplay + ")", new Vector2(5, textY), Color.White);
            textY += 20;

            foreach (var k in LayerDisplayKeys)
            {
                spriteBatch.DrawString(Font, "[" + (ShowLayers.HasFlag(k.Item1) ? "X" : " ") + "] - " + k.Item2 + " - " + k.Item1.ToString(), new Vector2(5, textY), Color.White);
                textY += 15;
            }

            spriteBatch.DrawString(Font, (int)(World.GetTimeOfYear(state.Ticks) * 12 + 1) + "/" + World.GetYear(state.Ticks), new Vector2(5, textY), Color.White);
            textY += 20;


            textY += 15;
            for (int s = 0; s < World.MaxSpecies; s++)
            {
                if (state.SpeciesStats[s].Population > 0)
                {
                    var species = state.Species[s];
                    spriteBatch.Draw(whiteTex, new Rectangle(5, textY, 10, 10), null, species.Color);
                    spriteBatch.DrawString(Font, species.Name + " [" + species.Food.ToString().Substring(0, 1) + "] " + ((float)state.SpeciesStats[s].Population / 1000000).ToString("0.00"), new Vector2(20, textY), Color.White);
                    textY += 15;
                }
            }
            textY += 15;

            if (curTool != null)
            {
                curTool.DrawTooltip(spriteBatch, state);
            }

            spriteBatch.End();
        }
Example #10
0
 override public void DrawTooltip(SpriteBatch spriteBatch, World.State state)
 {
     Tool.DrawInfoTooltip(spriteBatch, Gui, state);
 }
Example #11
0
 override public void DrawWorld(SpriteBatch spriteBatch, World.State state)
 {
     DrawSelection(spriteBatch, Gui, state);
 }
Example #12
0
 public abstract void DrawTooltip(SpriteBatch spriteBatch, World.State state);
Example #13
0
 public abstract void DrawWorld(SpriteBatch spriteBatch, World.State state);
Example #14
0
 override public void DrawTooltip(SpriteBatch spriteBatch, World.State state)
 {
 }