Exemplo n.º 1
0
        private void RenderTileFOV(TileFOVInfo tileFOVInfo)
        {
            if (!tileFOVInfo.Visible)
            {
                return;
            }

            byte alpha;

            if (tileFOVInfo.RevealedByMap)
            {
                alpha = BLACK_OPACITY_FOR_REVEALED_BY_MAP;
            }
            else if (tileFOVInfo.CoveredByFOV)
            {
                alpha = BLACK_OPACITY_FOR_COVERED_BY_FOV;
            }
            else
            {
                alpha = (byte)(MAX_BLACK_OPACITY_FOR_VISIBLE * tileFOVInfo.DistanceFactor);
            }

            var screenPosition = GetScreenPosition(tileFOVInfo.Position);
            var tRect          = new SDL_Rect()
            {
                x = screenPosition.X,
                y = screenPosition.Y,
                w = BoardComp.TILE_SIZE / 2,
                h = BoardComp.TILE_SIZE / 2
            };

            SDL_SetRenderDrawColor(UxContext.WRenderer, 0, 0, 0, alpha);
            SDL_RenderFillRect(UxContext.WRenderer, ref tRect);
        }
Exemplo n.º 2
0
        private void Render(TileFOVInfo tileFOVInfo)
        {
            var textureRect = new SDL_Rect()
            {
                x = (int)tileFOVInfo.Position.X,
                y = (int)tileFOVInfo.Position.Y,
                w = BoardComp.TILE_SIZE / 2,
                h = BoardComp.TILE_SIZE / 2
            };

            var screenPos  = tileFOVInfo.Position.Add(UxContext.Center).ToPoint();
            var outputRect = new SDL_Rect()
            {
                x = screenPos.X,
                y = screenPos.Y,
                w = textureRect.w,
                h = textureRect.h
            };

            SDL_RenderCopy(UxContext.WRenderer, BoardBufferTexture, ref textureRect, ref outputRect);
        }