Esempio n. 1
0
        public override void UpdateInput(GameTime gameTime)
        {
            base.UpdateInput(gameTime);

            if (Clip.Contains(GuiHelper.Mouse) && Default.MouseInteraction.Pressed())
            {
                _mousePressed = true;
                _dragDelta    = XY - GuiHelper.Mouse;
                GrabFocus(this);
            }

            if (IsFocused)
            {
                if (_mousePressed)
                {
                    if (Default.MouseInteraction.Released())
                    {
                        _mousePressed = false;
                    }
                    else
                    {
                        Default.MouseInteraction.Consume();
                        _moveNext = true;
                        _nextXY   = GuiHelper.Mouse + _dragDelta;
                    }
                }
            }
        }
Esempio n. 2
0
 public override void AddRune(Rune rune)
 {
     rune = MakePrintable(rune);
     if (Clip.Contains(ccol, crow))
     {
         if (needMove)
         {
             if (cols == Console.WindowWidth && rows == Console.WindowHeight)
             {
                 Console.SetCursorPosition(ccol, crow);
             }
             needMove = false;
         }
         contents [crow, ccol, 0] = (int)(uint)rune;
         contents [crow, ccol, 1] = currentAttribute;
         contents [crow, ccol, 2] = 1;
         dirtyLine [crow]         = true;
     }
     else
     {
         needMove = true;
     }
     ccol++;
     //if (ccol == Cols) {
     //	ccol = 0;
     //	if (crow + 1 < Rows)
     //		crow++;
     //}
     if (sync)
     {
         UpdateScreen();
     }
 }
Esempio n. 3
0
        public override void AddRune(Rune rune)
        {
            var position = crow * Cols + ccol;

            if (Clip.Contains(ccol, crow))
            {
                OutputBuffer [position].Attributes       = (ushort)currentAttribute;
                OutputBuffer [position].Char.UnicodeChar = (char)rune;
                WindowsConsole.SmallRect.Update(ref damageRegion, (short)ccol, (short)crow);
            }

            ccol++;
            var runeWidth = Rune.ColumnWidth(rune);

            if (runeWidth > 1)
            {
                for (int i = 1; i < runeWidth; i++)
                {
                    AddStr(" ");
                }
            }
            if (ccol == Cols)
            {
                ccol = 0;
                if (crow + 1 < Rows)
                {
                    crow++;
                }
            }
            if (sync)
            {
                UpdateScreen();
            }
        }
Esempio n. 4
0
        public override void AddRune(Rune rune)
        {
            if (Clip.Contains(ccol, crow))
            {
                if (needMove)
                {
                    needMove = false;
                }
                contents[crow, ccol, 0] = (int)(uint)rune;
                contents[crow, ccol, 1] = currentAttribute;
                contents[crow, ccol, 2] = 1;
                dirtyLine[crow]         = true;
            }
            else
            {
                needMove = true;
            }

            ccol++;
            if (ccol == Cols)
            {
                ccol = 0;
                if (crow + 1 < Rows)
                {
                    crow++;
                }
            }

            if (sync)
            {
                UpdateScreen();
            }
        }
Esempio n. 5
0
        public override void AddRune(Rune rune)
        {
            if (Clip.Contains(ccol, crow))
            {
                if (needMove)
                {
                    Curses.move(crow, ccol);
                    needMove = false;
                }
                Curses.addch((int)(uint)rune);
            }
            else
            {
                needMove = true;
            }
            if (sync)
            {
                Application.Driver.Refresh();
            }
            ccol++;
            var runeWidth = Rune.ColumnWidth(rune);

            if (runeWidth > 1)
            {
                for (int i = 1; i < runeWidth; i++)
                {
                    ccol++;
                }
            }
        }
Esempio n. 6
0
 public override void AddRune(Rune rune)
 {
     if (Clip.Contains(ccol, crow))
     {
         if (needMove)
         {
             //Console.CursorLeft = ccol;
             //Console.CursorTop = crow;
             needMove = false;
         }
         contents [crow, ccol, 0] = (int)(uint)rune;
         contents [crow, ccol, 1] = currentAttribute;
         contents [crow, ccol, 2] = 1;
         dirtyLine [crow]         = true;
     }
     else
     {
         needMove = true;
     }
     ccol++;
     //if (ccol == Cols) {
     //	ccol = 0;
     //	if (crow + 1 < Rows)
     //		crow++;
     //}
     if (sync)
     {
         UpdateScreen();
     }
 }
Esempio n. 7
0
        public override void Move(int col, int row)
        {
            ccol = col;
            crow = row;

            if (Clip.Contains(col, row))
            {
                if (cols == Console.WindowWidth && rows == Console.WindowHeight)
                {
                    Console.SetCursorPosition(col, row);
                    needMove = false;
                }
            }
            else
            {
                if (cols == Console.WindowWidth && rows == Console.WindowHeight)
                {
                    if (Console.WindowHeight > 0)
                    {
                        Console.SetCursorPosition(Clip.X, Clip.Y);
                    }
                    needMove = true;
                }
            }
        }
Esempio n. 8
0
        /// <inheritdoc />
        Color IFastBitmapWithClip.GetColorAt(int x, int y)
        {
            var contains = Clip.Contains(x, y);

            if (InvertClip && contains)
            {
                // TODO: Implement nearest
                return(HasAlphaChannel ? Color.Transparent : Color.Black);
            }
            if (!InvertClip && !contains)
            {
                if (y < Clip.Top)
                {
                    y = Clip.Top;
                }
                if (y >= Clip.Bottom)
                {
                    y = Clip.Bottom - 1;
                }
                if (x < Clip.Left)
                {
                    x = Clip.Left;
                }
                if (x >= Clip.Right)
                {
                    x = Clip.Right - 1;
                }
            }
            return(GetColorAt(x, y));
        }
Esempio n. 9
0
        /// <inheritdoc />
        void IFastBitmapWithClip.GetColorAt(int x, int y, byte *color, int colorIndex)
        {
            var contains = Clip.Contains(x, y);

            if (InvertClip && contains)
            {
                // TODO: Implement nearest
                return;
            }
            if (!InvertClip && !contains)
            {
                if (y < Clip.Top)
                {
                    y = Clip.Top;
                }
                if (y >= Clip.Bottom)
                {
                    y = Clip.Bottom - 1;
                }
                if (x < Clip.Left)
                {
                    x = Clip.Left;
                }
                if (x >= Clip.Right)
                {
                    x = Clip.Right - 1;
                }
            }
            GetColorAt(x, y, color, colorIndex);
        }
Esempio n. 10
0
        /// <inheritdoc />
        void IFastBitmapWithClip.SetColorAt(int x, int y, ref Color color)
        {
            var contains = Clip.Contains(x, y);

            if (InvertClip && contains || !InvertClip && !contains)
            {
                return;
            }
            SetColorAt(x, y, ref color);
        }
Esempio n. 11
0
        void IFastBitmapWithClip.SetColorAt(int x, int y, Color color)
        {
            bool contains = Clip.Contains(x, y);

            if ((InvertClip && contains) || (!InvertClip && !contains))
            {
                return;
            }
            SetColorAt(x, y, color);
        }
Esempio n. 12
0
        /// <inheritdoc />
        void IFastBitmapWithClip.SetColorAt(int x, int y, byte *color, int colorIndex)
        {
            var contains = Clip.Contains(x, y);

            if (InvertClip && contains || !InvertClip && !contains)
            {
                return;
            }
            SetColorAt(x, y, color, colorIndex);
        }
Esempio n. 13
0
        /// <summary>
        ///     Test if the bitmap containt the specified coordinates
        /// </summary>
        /// <param name="x">int x</param>
        /// <param name="y">int y</param>
        /// <returns>true if the specified coordinates are within</returns>
        bool IFastBitmapWithClip.Contains(int x, int y)
        {
            var contains = Clip.Contains(x, y);

            if (InvertClip)
            {
                return(!contains);
            }
            return(contains);
        }
Esempio n. 14
0
        public override void AddRune(Rune rune)
        {
            if (contents.Length != Rows * Cols * 3)
            {
                return;
            }
            rune = MakePrintable(rune);
            var runeWidth = Rune.ColumnWidth(rune);

            if (Clip.Contains(ccol, crow) && ccol + Math.Max(runeWidth, 1) <= Cols)
            {
                contents [crow, ccol, 0] = (int)(uint)rune;
                contents [crow, ccol, 1] = currentAttribute;
                contents [crow, ccol, 2] = 1;
                dirtyLine [crow]         = true;

                ccol++;
                if (runeWidth > 1)
                {
                    for (int i = 1; i < runeWidth; i++)
                    {
                        if (ccol < cols)
                        {
                            contents [crow, ccol, 2] = 0;
                        }
                        else
                        {
                            break;
                        }
                        ccol++;
                    }
                }
            }
            else if (ccol < cols && crow < rows)
            {
                contents [crow, ccol, 2] = 1;
                dirtyLine [crow]         = true;
            }

            //if (ccol == Cols) {
            //	ccol = 0;
            //	if (crow + 1 < Rows)
            //		crow++;
            //}
            if (sync)
            {
                UpdateScreen();
            }
        }
Esempio n. 15
0
        public override void Move(int col, int row)
        {
            ccol = col;
            crow = row;

            if (Clip.Contains(col, row))
            {
                Curses.move(row, col);
                needMove = false;
            }
            else
            {
                Curses.move(Clip.Y, Clip.X);
                needMove = true;
            }
        }
Esempio n. 16
0
        public override void Move(int col, int row)
        {
            ccol = col;
            crow = row;

            if (Clip.Contains(col, row))
            {
                Console.CursorTop  = row;
                Console.CursorLeft = col;
                needMove           = false;
            }
            else
            {
                Console.CursorTop  = Clip.Y;
                Console.CursorLeft = Clip.X;
                needMove           = true;
            }
        }
Esempio n. 17
0
 public override void AddRune(Rune rune)
 {
     if (Clip.Contains(ccol, crow))
     {
         if (needMove)
         {
             Curses.move(crow, ccol);
             needMove = false;
         }
         Curses.addch((int)(uint)rune);
     }
     else
     {
         needMove = true;
     }
     if (sync)
     {
         Application.Driver.Refresh();
     }
     ccol++;
 }
Esempio n. 18
0
        public override void UpdateInput(GameTime gameTime)
        {
            base.UpdateInput(gameTime);

            if (Clip.Contains(GuiHelper.Mouse) && Default.MouseInteraction.Pressed())
            {
                _pressed = true;
                GrabFocus(this);
            }
            if (IsFocused)
            {
                if (_pressed)
                {
                    if (Default.MouseInteraction.Released())
                    {
                        _pressed = false;
                    }
                    else
                    {
                        Default.MouseInteraction.Consume();
                    }
                }
            }
        }
Esempio n. 19
0
        public override void AddRune(Rune rune)
        {
            var position = crow * Cols + ccol;

            if (Clip.Contains(ccol, crow))
            {
                OutputBuffer[position].Attributes       = (ushort)currentAttribute;
                OutputBuffer[position].Char.UnicodeChar = (char)rune;
            }

            ccol++;
            if (ccol == Cols)
            {
                ccol = 0;
                if (crow + 1 < Rows)
                {
                    crow++;
                }
            }
            if (sync)
            {
                UpdateScreen();
            }
        }