Esempio n. 1
0
        private void KeyUp(KeyUpMessage m, GameEngine engine)
        {
            if(m.Key == Keys.P)
            {
                PerlinNoise perlinNoise = new PerlinNoise(99);
                Bitmap bitmap = new Bitmap(200, 200);
                double widthDivisor = 1 / (double)200;
                double heightDivisor = 1 / (double)200;
                bitmap.SetEachPixelColour(
                    (point, color) =>
                    {
                        double v =
                            // First octave
                            (perlinNoise.Noise(2 * point.X * widthDivisor, 2 * point.Y * heightDivisor, -0.5) + 1) / 2 * 0.7 +
                            // Second octave
                            (perlinNoise.Noise(4 * point.X * widthDivisor, 4 * point.Y * heightDivisor, 0) + 1) / 2 * 0.2 +
                            // Third octave
                            (perlinNoise.Noise(8 * point.X * widthDivisor, 8 * point.Y * heightDivisor, +0.5) + 1) / 2 * 0.1;

                        v = Math.Min(1, Math.Max(0, v));
                        byte b = (byte)(v * 255);
                        return Color.FromArgb(b, b, b);
                    });
                bitmap.Save("test.png", ImageFormat.Png);
            }
            if(m.Key == Keys.G)
            {

            }
        }
Esempio n. 2
0
 public void KeyUp(KeyUpMessage m)
 {
     if (m.Key == Keys.F)
     {
         _engine.Bus.Add(new PlanetCreationRequest(_engine.Timer.LastTickTime, PlanetType.Ice, 9));
     }
 }
Esempio n. 3
0
 private void KeyUp(KeyUpMessage m, GameEngine engine)
 {
     engine.Bus.Add(new SystemMessage(engine.Timer.LastTickTime, "{0} KeyUp - {1}".fmt(m.TimeSent, m.Key)));
     if (m.Key == Keys.Escape)
     {
         engine.Stop();
     }
 }
Esempio n. 4
0
 public void KeyUp(KeyUpMessage m)
 {
     if (m.Key == Keys.Space)
     {
         _engine.Bus.Add(new ObjectsDestroyAll(_engine.Timer.LastTickTime));
         _engine.CurrentState = new MainState(_engine);
     }
 }
Esempio n. 5
0
 public void KeyUp(KeyUpMessage m)
 {
     if (m.Key == Keys.C)
     {
         _engine.Bus.Add(new ObjectCreationRequest(_engine.Timer.LastTickTime, typeof(Planet)));
     }
     if (m.Key == Keys.Escape)
     {
         _engine.Stop();
     }
 }
Esempio n. 6
0
 public void KeyUp(KeyUpMessage m)
 {
 }