public TableAppImage()
        {
            //Image image = Image.FromFile(@"D:\Projekte\Visual Studio\MatrixLedTableController\MatrixLedTableController\bin\Debug\eye.jpg");
            //image = ResizeImage(image, Program.TableWidth, Program.TableHeight);

            /*
             * map = new PixelColor[image.Width, image.Height];
             * using (Bitmap bmp = new Bitmap(image))
             * {
             *  for(int x = 0; x < image.Width; x++)
             *  {
             *      for(int y = 0; y < image.Height; y++)
             *      {
             *          Color clr = bmp.GetPixel(x, y);
             *          int red = clr.R;
             *          int green = clr.G;
             *          int blue = clr.B;
             *
             *          map[x, y] = new PixelColor(red, green, blue);
             *      }
             *  }
             * }
             */

            map = PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.RED);
        }
示例#2
0
            public GameGrid(int width, int height)
            {
                this.width  = width;
                this.height = height;

                grid = PixelColor.GetSingleColorMap(width, height, PixelColor.BLACK);
            }
        public override void Draw()
        {
            if (raising)
            {
                amount += speed;
            }
            else
            {
                amount -= speed;
            }


            SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.LerpRGB(PixelColor.BLACK, color, Mathf.Clamp01(amount))));

            if (raising)
            {
                if (amount >= 1.5f)
                {
                    raising = false;
                }
            }
            else if (amount <= -0.5f)
            {
                ClearPixels();
                Reset();
            }
        }
        public void CleanUp()
        {
            currentApp = null;

            //Clear the screen
            PixelColor[,] clear = PixelColor
                                  .GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.BLACK);
            Program.tableRenderer.Render(clear);
        }
        public override void Draw()
        {
            if (isOn)
            {
                SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.Random(Program.random)));
            }
            else
            {
                ClearPixels();
            }

            isOn = !isOn;
        }
        public override void Draw()
        {
            ClearPixels();

            if (gameEnded)
            {
                SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, players[winnerId].GetColor(0.5f)));

                char[] curChar = Convert.ToString((long)CharacterLookup.GetCharUlong((winnerId + 1).ToString()[0]), 2).ToCharArray();
                Array.Reverse(curChar);
                for (int y = 0; y < CharacterLookup.characterHeight; y++)
                {
                    for (int x = 0; x < CharacterLookup.characterWidth; x++)
                    {
                        int index = x + (y * CharacterLookup.characterWidth);
                        if (curChar.Length > index && curChar[index] == '1')
                        {
                            SetPixel(x + 2, y + 1, PixelColor.WHITE);
                        }
                    }
                }

                gameOverScreenTime += updateSpeed;
                if (gameOverScreenTime > 5000)
                {
                    Close();
                }

                return;
            }

            for (int i = 0; i < players.Length; i++)
            {
                players[i].Update();
                SetPixel(players[i].GetPosition(), players[i].color);
            }

            foreach (Projectile p in projectiles)
            {
                p.Update();
                SetPixel(p.position, PixelColor.RED);

                for (int i = 0; i < players.Length; i++)
                {
                    if (p.position.IsTheSame(players[i].GetPosition()))
                    {
                        players[i].Kill(this);
                    }
                }
            }
        }
        public override void Draw()
        {
            ClearPixels();

            if (auto)
            {
                hue += 0.0005f;
                if (hue > 1f)
                {
                    hue -= 1f;
                }
            }

            float      delta = 0.01f;
            PixelColor color = PixelColor.LerpRGB(lastColor, PixelColor.FromHSL(hue, 1f, 0.5f), delta);

            SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, color));
            lastColor = color;
        }
        public override void Draw()
        {
            ClearPixels();

            for (int x = 0; x < 3; x++)
            {
                SetPixel(padPos + x, 0, PixelColor.FromHSL(curPadHue, 1f, 0.5f));
            }

            MoveBall();
            SetPixel(ballPos, PixelColor.FromHSL(hueBall, 1f, 0.5f));

            if (hueSpeed > 0.0001f)
            {
                hueSpeed -= 0.00001f;
            }
            else if (hueSpeed < 0.0001f)
            {
                hueSpeed = 0.0001f;
            }

            if (lostTime > 0f)
            {
                SetPixels(PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.Random(new Random())));
                lostTime += 0.001f;

                if (lostTime > 1f)
                {
                    GameOver("Du hast wohl nicht genügend Zielwasser getrunken...", score, "pong");
                    Program.tableAppManager.LaunchApp(TableAppManager.GetAppById(new TableAppIdle().GetName()));
                }
            }


            hueBall += hueSpeed;
            if (hueBall > 1f)
            {
                hueBall -= 1f;
            }
        }
示例#9
0
 public TableAppDraw()
 {
     updateSpeed = 10;
     drawMap     = PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.BLACK);
 }
 protected void ClearPixels()
 {
     colorMap = PixelColor.GetSingleColorMap(Program.TableWidth, Program.TableHeight, PixelColor.BLACK);
 }