Example #1
0
        internal override void UpdateVBOTiles(VBO vbo)
        {
            base.UpdateVBOTiles(vbo);

            if (ReadInputs_)
            {
                vbo.UpdateTileData(Position.X + Text.Length, Position.Y, FontTile + 63, Color, Tilemap, TileVFX.BlinkFast);
            }
        }
Example #2
0
        /// <summary>
        /// (Private) Clears all tiles in the VBO.
        /// </summary>
        private void ClearTiles()
        {
            int x, y;

            for (x = 0; x < Game.Renderer.TileCount.Width; x++)
            {
                for (y = 0; y < Game.Renderer.TileCount.Height; y++)
                {
                    UIVBO.UpdateTileData(x, y, 0, RGBColor.Black);
                }
            }
        }
Example #3
0
        /// <summary>
        /// (Internal) Draws the control on the provided VBO.
        /// </summary>
        /// <param name="vbo">UI VBO on which to draw the control.</param>
        internal override void UpdateVBOTiles(VBO vbo)
        {
            int x, y;

            for (x = 0; x < Tiles.GetLength(0); x++)
            {
                for (y = 0; y < Tiles.GetLength(1); y++)
                {
                    vbo.UpdateTileData(x + Position.X, y + Position.Y, Tiles[x, y].TileIndex, Tiles[x, y].Color, Tiles[x, y].Tilemap, Tiles[x, y].VFX);
                }
            }
        }
Example #4
0
        /// <summary>
        /// (Private) Updates the VBO. Called each time the sprites moved or enter a new animation frame.
        /// </summary>
        private void SetupNewFrame()
        {
            CurrentFrameTime = 0f;

            if (Sprites.Count == 0)
            {
                return;
            }

            switch (Sprites[0].SpriteType)
            {
            case SpriteType.Moving:
                Position position = Sprites[0].Positions[CurrentFrame];
                if (Viewport_.Contains(position))
                {
                    SpriteVBO.UpdateTileData(0, 0, position.X, position.Y, Sprites[0].Tile, Sprites[0].Color);
                }
                else
                {
                    SpriteVBO.UpdateTileData(0, 0, -100, -100, 0, RGBColor.Black);
                }
                return;

            case SpriteType.Static:
                for (int i = 0; i < Sprites[0].Positions.Length; i++)
                {
                    if (Viewport_.Contains(Sprites[0].Positions[i]))
                    {
                        SpriteVBO.UpdateTileData(i, 0, Sprites[0].Positions[i].X, Sprites[0].Positions[i].Y, Sprites[0].Tile + CurrentFrame, Sprites[0].Color);
                    }
                    else
                    {
                        SpriteVBO.UpdateTileData(i, 0, -100, -100, 0, RGBColor.Black);
                    }
                }
                return;
            }
        }
Example #5
0
        /// <summary>
        /// (Internal) Draws the control on the provided VBO.
        /// </summary>
        /// <param name="vbo">UI VBO on which to draw the control.</param>
        internal override void UpdateVBOTiles(VBO vbo)
        {
            int x, y, tileIndex;

            for (x = 0; x < Width; x++)
            {
                for (y = 0; y < Height; y++)
                {
                    tileIndex = Tile_;

                    if (Composite_)
                    {
                        tileIndex += x + (y * Page.UI.Game.Renderer.TilemapCount.Width);
                    }

                    vbo.UpdateTileData(Position.X + x, Position.Y + y, tileIndex, Color, Tilemap, TileEffect);
                }
            }
        }
Example #6
0
        /// <summary>
        /// Draws font tiles on the provided VBO.
        /// </summary>
        /// <param name="vbo">VBO on which to draw</param>
        /// <param name="text">Text to draw</param>
        /// <param name="x">X coordinate</param>
        /// <param name="y">Y coordinate</param>
        /// <param name="tile">Font tile to use</param>
        /// <param name="color">Text color</param>
        /// <param name="effect">Tile shader special effect to use</param>
        internal void DrawTextOnVBO(VBO vbo, string text, int x, int y, int tile, RGBColor color, TileVFX effect)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            byte[] textBytes = Encoding.ASCII.GetBytes(text);

            for (int i = 0; i < textBytes.Length; i++)
            {
                if ((textBytes[i] < 32) || (textBytes[i] > 126))
                {
                    textBytes[i] = 32;
                }

                vbo.UpdateTileData(x + i, y, tile + textBytes[i] - 32, color, Tilemap, effect);
            }
        }
Example #7
0
        /// <summary>
        /// (Internal) Draws the tiles of all controls on this page.
        /// </summary>
        /// <param name="vbo">The UI VBO on which the tiles must be drawn</param>
        internal void DrawTiles(VBO vbo)
        {
            int x, y;

            for (x = 0; x < vbo.Columns; x++)
            {
                for (y = 0; y < vbo.Rows; y++)
                {
                    vbo.UpdateTileData(x, y, BackgroundTile_, BackgroundColor_, BackgroundTilemap_);
                }
            }

            Controls = Controls.OrderBy(c => c.ZOrder).ToList(); // Order controls by Z-Order

            foreach (UIControl control in Controls)
            {
                if (!control.Visible)
                {
                    continue;
                }
                control.UpdateVBOTiles(vbo);
            }
        }
Example #8
0
 /// <summary>
 /// (Private) Updates the cursor VBO with new data.
 /// </summary>
 private void UpdateCursor()
 {
     Position_ = Position_.Bound(BoundingBox_);
     CursorVBO.UpdateTileData(0, 0, Position_.X, Position_.Y, Tile_, Color_, Tilemap_, VFX_);
 }
Example #9
0
        /// <summary>
        /// (Internal) Draws the control on the provided VBO.
        /// </summary>
        /// <param name="vbo">UI VBO on which to draw the control.</param>
        internal override void UpdateVBOTiles(VBO vbo)
        {
            int x, y;
            int frameTileIndex;

            Area rect = new Area(Position, Size);

            for (x = rect.Left; x < rect.Right; x++)
            {
                for (y = rect.Top; y < rect.Bottom; y++)
                {
                    frameTileIndex = FrameTile;

                    if (x == rect.Left)
                    {
                        if (y == rect.Top)
                        {
                            frameTileIndex += 0;
                        }
                        else if (y == rect.Bottom - 1)
                        {
                            frameTileIndex += 2;
                        }
                        else
                        {
                            frameTileIndex += 5;
                        }
                    }
                    else if (x == rect.Right - 1)
                    {
                        if (y == rect.Top)
                        {
                            frameTileIndex += 1;
                        }
                        else if (y == rect.Bottom - 1)
                        {
                            frameTileIndex += 3;
                        }
                        else
                        {
                            frameTileIndex += 7;
                        }
                    }
                    else if (y == rect.Top)
                    {
                        frameTileIndex += 4;
                    }
                    else if (y == rect.Bottom - 1)
                    {
                        frameTileIndex += 6;
                    }
                    else if (FillTile.HasValue)
                    {
                        frameTileIndex = FillTile.Value;
                    }
                    else
                    {
                        continue;
                    }

                    vbo.UpdateTileData(x, y, frameTileIndex, Color, Tilemap, TileEffect);
                }
            }
        }