Exemplo n.º 1
0
        private void drawUpperBar()
        {
            if (moreUp)
            {
                drawHorizontalBackground(y + 1, x + 1, x + width - 1, (moreUp ? barColor.Plus(TCODColor.darkestGrey) : barColor));

                string text = "^ ^ ^";
                drawTextCenteredBetween(y + 1, x, x + width, text, color);
            }
        }
Exemplo n.º 2
0
 public override void render(bool insight)
 {
     if (owner != null)
     {
         Map m = map;
         lightmap.clear();
         int ox = owner.x - m.offsetX + mapx;
         int oy = owner.y - m.offsetY + mapy;
         if (ox >= -mapx && ox < width && oy >= -mapy && oy < height)
         {
             if (owner.x >= 0 && owner.x < m.tiles.GetLength(0) && owner.y >= 0 && owner.y < m.tiles.GetLength(1))
             {
                 for (int x = m.renderX; x < m.renderWidth + m.renderX; x++)
                 {
                     for (int y = m.renderY; y < m.renderHeight + m.renderY; y++)
                     {
                         int mx = x + m.offsetX;
                         int my = y + m.offsetY;
                         if (isInFov(mx, my, 0, m) && (m.isExplored(mx, my) || m.showAllTiles))
                         {
                             try
                             {
                                 double distance = Math.Sqrt(Math.Pow(owner.x - (mx), 2) + Math.Pow(owner.y - (my), 2));
                                 if (distance <= fovRadius)
                                 {
                                     byte      c        = (byte)(strenght - (((float)strenght / ((float)fovRadius)) * ((byte)distance)));
                                     TCODColor color    = new TCODColor(c, c, c);
                                     TCODColor newColor = color.Plus(level.lightMapConsole.getCharBackground(x, y));
                                     lightmap.setCharBackground(x, y, newColor, TCODBackgroundFlag.Set);
                                 }
                             }
                             catch (Exception e)
                             {
                                 Console.WriteLine(e.Message);
                                 throw new Exception(e.Message);
                             }
                         }
                         else
                         {
                             //lightmap.setCharBackground(x, y, TCODColor.black, TCODBackgroundFlag.Set);
                         }
                     }
                 }
                 TCODConsole.blit(lightmap, 0, 0,
                                  lightmap.getWidth(), lightmap.getHeight(), level.lightMapConsole, 0, 0, (float)strenght / (255 * 2), (float)strenght / (255 * 2));
             }
         }
     }
 }
Exemplo n.º 3
0
        public TCODColor ColorAt(int x, int y)
        {
            TCODColor col    = TCODColor.black;
            int       intens = 0;
            int       t;

            foreach (Light light in _lights)
            {
                t = light.IntensityAt(x, y);
                if (t > intens)
                {
                    intens = t;
                }
                col = col.Plus(light.Color.Multiply((float)t / 20));
            }
            t = Player.Light.IntensityAt(x, y);
            if (t > intens)
            {
                intens = t;
                col    = col.Plus(Player.Light.Color);
            }
            col.setValue((float)intens / 20 + (Game.ShowWall || _known[x, y] ? 0.05f : 0f));
            return(col);
        }
Exemplo n.º 4
0
        public ContainerGui(Actor owner, string name, int x, int y, int width, int height)
        {
            this.owner  = owner;
            this.name   = name;
            this.x      = x;
            this.y      = y;
            this.width  = width;
            this.height = height;

            maxLineSpace = height - 4;

            container = owner.getContainer();

            selectedColor = color.Plus(TCODColor.darkGrey);
            barColor      = color.Minus(TCODColor.darkGrey);
        }