示例#1
0
        protected void ScrollMessage(string message, int delayMS = 50, ScrollMessageStop stopFunction = null) {
            if (stopFunction == null) {
                stopFunction = DefaultScrollMessageStop;
            }

            var charSet = new CharSet();
            var splashScreen = charSet.StringToBitmap(message);
            var exit = false;

            ResetButtonClicks();

            while (!(exit)) {
                var x = 0;
                for (; x < splashScreen.Width; x++) {
                    Hardware.Matrix.Display(splashScreen.GetFrame(x, 0));
                    if (exit = stopFunction()) {
                        break;
                    }
                    Thread.Sleep(delayMS);
                }
                for (; x != 0; x--) {
                    if (exit = stopFunction()) {
                        break;
                    }
                    Hardware.Matrix.Display(splashScreen.GetFrame(x, 0));
                    Thread.Sleep(delayMS);
                }
            }
        }
        public void DisplaySplashScreen() {
            var charSet = new CharSet(); 
            var splashScreen = charSet.StringToBitmap("  2 paddles and a ball");

            _leftButtonClicked = false;
            _rightButtonClicked = false;

            while (!(_leftButtonClicked || _rightButtonClicked)) {
                var x = 0;
                for (; x < splashScreen.Width; x++) {
                    Hardware.Matrix.Display(splashScreen.GetFrame(x, 0));
                    if (_leftButtonClicked || _rightButtonClicked) {
                        break;
                    }
                    Thread.Sleep(50);
                }
                for (; x != 0; x--) {
                    if (_leftButtonClicked || _rightButtonClicked) {
                        break;
                    }
                    Hardware.Matrix.Display(splashScreen.GetFrame(x, 0));
                    Thread.Sleep(50);
                }
            }
        }
示例#3
0
        public static void DisplayMarquee(string text, byte redBackground, byte greenBackground, byte blueBackground, byte redText, byte greenText, byte blueText) {
            if (_marqueeTextChanged) {
                _marqueeTextChanged = false;
                var charSet = new CharSet();
                var marqueePixelWidth = text.Length * 8;
                var marquee = strip.BuildMarquee(text, charSet, redBackground, greenBackground, blueBackground, redText, greenText, blueText);

                var x = 0;
                for (; x < marqueePixelWidth - strip.Width; x++) {
                    strip.Copy(marquee, x, 0, strip.Width, strip.Height, marqueePixelWidth, strip.Height);
                    strip.Refresh();
                }
                for (; x >= 0; x--) {
                    strip.Copy(marquee, x, 0, strip.Width, strip.Height, marqueePixelWidth, strip.Height);
                    strip.Refresh();
                }
            }
        }
 public byte[] BuildMarquee(string text, CharSet charSet, byte redBackground, byte greenBackground, byte blueBackground, byte redText, byte greenText, byte blueText) {
     var tempChar = new byte[8];
     var textColor = new byte[3];
     var backgroundColor = new byte[3];
     var marquee = new byte[text.Length * 8 * AdaFruitLPD8806.BytesPerPixel * Height];
     var lineLengthInBytes = text.Length * 8 * AdaFruitLPD8806.BytesPerPixel;
     textColor[0] = (byte)(greenText | 0x80);
     textColor[1] = (byte)(redText | 0x80);
     textColor[2] = (byte)(blueText | 0x80);
     backgroundColor[0] = (byte)(greenBackground | 0x80);
     backgroundColor[1] = (byte)(redBackground | 0x80);
     backgroundColor[2] = (byte)(blueBackground | 0x80);
     var index = 0;
     foreach (char c in text) {
         charSet.CopyBitmapChar(c, tempChar, 0, 1);
         BuildMarqueeCharacter(index++, lineLengthInBytes, marquee, tempChar, textColor, backgroundColor);
     }
     return marquee;
 }