Exemplo n.º 1
0
 public SequenceTestWindow()
 {
     mWindow       = new WindowDevice();
     mMapPerimeter = new GlimPixelMap.Factory {
         { mWindow, 0, 94 }
     }.Compile();
     mEdgeLeft = new GlimPixelMap.Factory {
         { mWindow, 55, -48 }
     }.Compile();
     mEdgeRight = new GlimPixelMap.Factory {
         { mWindow, 54, 40 }, { mWindow, 0, 8 }
     }.Compile();
     mFxCometLeft = new FxComet {
         PixelCount           = mEdgeLeft.PixelCount + 10,
         BaseColor            = Color.White,
         TailPixelLength      = 10,
         SpeedPixelsPerSecond = 40
     };
     mFxCometRight = new FxComet {
         PixelCount           = mEdgeRight.PixelCount + 10,
         BaseColor            = Color.White,
         TailPixelLength      = 10,
         SpeedPixelsPerSecond = 40
     };
     AddLuminanceControl(v => mFxPerimeter.Luminance   = v);
     AddSaturationControl(v => mFxPerimeter.Saturation = v);
 }
Exemplo n.º 2
0
 public GlimDescriptor(string displayName, string hostName, int pixelCount, Color partyColor)
     : base(displayName, hostName, pixelCount)
 {
     PartyColor = partyColor;
     mFxComet   = null;
     mPixelMap  = new GlimPixelMap.Factory {
         { this, 0, 100 }
     }.Compile();
 }
Exemplo n.º 3
0
        public SequenceParty()
        {
            Luminance  = AddLuminanceControl(x => { });
            Saturation = AddSaturationControl(x => { });

            // comets!
            mGlimRedGun  = new GlimDescriptor("Red", "GlimSwarm-103", 150, Color.Red);
            mGlimBlueGun = new GlimDescriptor("Blue", "GlimSwarm-104", 100, Color.Blue);
            mGlimStars   = new SequenceDeviceBasic("Stars", "GlimSwarm-102", 150);
            mFxBarrel    = new FxComet {
                BaseColor = Color.FromArgb(0xff, 0, 0xff), PixelCount = 50
            };
            mFxCannonTwinkle = new FxStarlightTwinkle {
                BaseColor       = Color.FromArgb(0xff, 0, 0xff),
                SpeedFactor     = 15.0,
                LuminanceMinima = 0.2,
                LuminanceMaxima = 0.8
            };

            mPixelMapStars = new GlimPixelMap.Factory {
                mGlimStars
            }.Compile();
            mPixelMapBarrel = new GlimPixelMap.Factory {
                { mGlimRedGun, 100, 50 }
            }.Compile();
            mPixelMapPerimeter = new GlimPixelMap.Factory {
                { mGlimRedGun, 0, 100 }, { mGlimBlueGun, 100, -100 }
            }.Compile();

            mFxPerimeterRainbow = new FxScale(new FxRainbow());
            mFxStarlight        = new FxScale(new FxStarlightTwinkle {
                BaseColor = Color.Yellow
            })
            {
                Saturation = 0.3
            };
        }
Exemplo n.º 4
0
 public void StartComet(int pixelCount)
 {
     mFxComet = new FxComet {
         BaseColor = PartyColor, PixelCount = pixelCount
     };
 }
Exemplo n.º 5
0
        public override void FrameExecute()
        {
            var ctx = MakeCurrentContext();

            mFxPerimeterRainbow.Luminance  = PerimeterLuminanceMultiplier;
            mFxPerimeterRainbow.Saturation = Saturation.Value;
            mPixelMapPerimeter.Write(mFxPerimeterRainbow.Execute(ctx));
            mFxStarlight.Luminance = LuminanceStarlightMultiplier;
            mPixelMapStars.Write(mFxStarlight.Execute(ctx));

            mGlimRedGun.WriteExecute(ctx);
            mGlimBlueGun.WriteExecute(ctx);
            if (null != mFxBarrel && mFxBarrel.IsRunning)
            {
                mPixelMapBarrel.Write(mFxBarrel.Execute(ctx));
            }
            switch (mGameState)
            {
            case GameState.Null:
            case GameState.SynchronizedShotsFired:
                return;
            }
            double lumscale = 0.0;

            if (GameState.CoolDown == mGameState)
            {
                mPixelMapBarrel.Write(BarrelColour());
                mPixelMapStars.Write(mFxCannonTwinkle.Execute(ctx));
                // take 2 seconds to return to full glow
                lumscale = ((CurrentTime - mGameCoolDownStart).TotalSeconds - 1) / 2;
            }
            if (lumscale < 1)
            {
                // barrel shot or cooling down
            }
            else
            {
                mGameState = GameState.Null;
                RecalculateButtonGlimmer(mGlimBlueGun);
                RecalculateButtonGlimmer(mGlimRedGun);
            }
            switch (mGameState)
            {
            case GameState.BarrelShotFired:
                if (!mFxBarrel.IsRunning)
                {
                    mGameState         = GameState.CoolDown;
                    mGameCoolDownStart = CurrentTime;
                    mFxBarrel          = null;
                }
                break;

            case GameState.SynchronizedShotsFired:
                if (!mGlimBlueGun.CometIsRunning || !mGlimRedGun.CometIsRunning)
                {
                    mGameState = GameState.BarrelShotFired;
                    mFxBarrel  = new FxComet {
                        BaseColor = Color.FromArgb(0xff, 0, 0xff), PixelCount = 50
                    };
                }
                break;
            }
        }