Exemplo n.º 1
0
 void Style(MeshWindow w, bool active)
 {
     if (active)
     {
         w.Color = new Color4f(1.0f, 1.0f, 1.0f, 0.5f);
         w.Scale = new Vector2(1.5f, 1.5f);
         w.Transparent = false;
     }
     else
     {
         w.Color = new Color4f(0.5f, 1.0f, 0.5f, 0.0f);
         w.Scale = new Vector2(1.0f, 1.0f);
         w.Transparent = true;
     }
 }
Exemplo n.º 2
0
        public WeaponBar(SpaceShip s, WeaponDisplay d)
        {
            ship = s;
            display = d;

            icons = new MeshWindow[SpaceShip.WeaponList.Length-1];
            for (int i = 0; i < SpaceShip.WeaponList.Length-1; ++i)
            {
                icons[i] = new MeshWindow(GetIcon(SpaceShip.WeaponList[i]));
                if(ship.CurrentWeapon==i)
                {
                    Style(icons[i], true);
                    currentweapon = i;
                }
                else
                {
                    Style(icons[i], false);
                }
            }

            float pixelsize = 48;

            Layout = new Layout(1, icons.Length);
            Size = new Vector2(pixelsize, icons.Length * pixelsize);
            Position = new Vector2(
                8,
                Root.Instance.UserInterface!=null?(Root.Instance.UserInterface.Renderer.Size.Y / 2 - Size.Y / 2):1000
                );
            Transparent = true;

            for(int i=0;i<icons.Length;++i)
                Add(icons[i],0,i);

            Layout.Update(Size);

            UpdateDisplayPosition();
        }