protected virtual IEnumerator Start()
        {
            _term.Resize(_size.x, _size.y);
            SetDirty();

            yield return(null);
            //Debug.Log($"Resizing terminal to {_size}");
        }
        void Print()
        {
            string vsync = QualitySettings.vSyncCount switch
            {
                1 => "60",
                2 => "30",
                _ => "OFF"
            };

            _term.Resize(_term.Width, _strings.Count + 3);
            Align();
            int y = _term.Size.y - 1;

            for (int i = 0; i < _strings.Count; ++i)
            {
                _term.Print(2, y--, _strings[i]);
            }

            _term.Print(2, y--, $"VSync {vsync} FPS {1F / avg}     ");
            --y;
            if (!string.IsNullOrEmpty(_displayText))
            {
                _term.Print(1, y--, _displayText + "       ");
            }

            //_term.Print(1, y--, "CONTROLS");
            //_term.Print(1, y--, "F1 - Toggle help");
            //_term.Print(1, y--, "LMB + Drag - Place/Remove walls");
            //_term.Print(1, y--, "N - Add noise to the map");
            //_term.Print(1, y--, "C - Clear");
            //_term.Print(1, y--, "Arrow Keys - Resize");
            //_term.Print(1, y--, "RMB - place start/end points");
            //_term.Print(1, y--, "Space - Find Path");
            //_term.Print(1, y--, $"VSync {vsync} FPS {1F / avg}     ");
            //--y;
            //if (!string.IsNullOrEmpty(_displayText))
            //    _term.Print(1, y--, _displayText + "       ");
        }

        void Align()
        {
            float3 p = transform.position;
            float2 viewportPosition = new float2(0, 1);
            float2 align            = new float2(1, -1);
            float2 size             = _term.GetWorldSize().xy;

            p.xy = Camera.main.GetAlignedViewportPosition(viewportPosition, align, size).xy;
            transform.position = p;
        }

        void ToggleVisibility(InputAction.CallbackContext ctx)
        {
            float3 p = transform.position;

            if (p.z == -1)
            {
                p.z = 1;
            }
            else
            {
                p.z = -1;
            }

            transform.position = p;
        }
    }
Exemple #3
0
 private void Start()
 {
     _term.Resize(_size.x, _size.y);
 }