Exemplo n.º 1
0
    public void Update()
    {
        if (_texture == null)
        {
            _texture            = new Texture2D(1, 1, TextureFormat.Alpha8, false);
            _texture.hideFlags  = HideFlags.HideInInspector | HideFlags.DontSave;
            _texture.filterMode = FilterMode.Point;
            _texture.wrapMode   = TextureWrapMode.Clamp;
            //Debug.Log("Texture2D creation: " + _texture.GetNativeTextureID());
        }

        int textureID = _texture.GetNativeTextureID();

        SysFont.QueueTexture(_text, FontName, _fontSize, _isBold,
                             _isItalic, _alignment, _isMultiLine, _maxWidthPixels,
                             _maxHeightPixels, textureID);

        _textWidthPixels  = SysFont.GetTextWidth(textureID);
        _textHeightPixels = SysFont.GetTextHeight(textureID);
        _widthPixels      = SysFont.GetTextureWidth(textureID);
        _heightPixels     = SysFont.GetTextureHeight(textureID);

        SysFont.UpdateQueuedTexture(textureID);

        _lastText            = _text;
        _lastFontName        = FontName;
        _lastFontSize        = _fontSize;
        _lastIsBold          = _isBold;
        _lastIsItalic        = _isItalic;
        _lastAlignment       = _alignment;
        _lastIsMultiLine     = _isMultiLine;
        _lastMaxWidthPixels  = _maxWidthPixels;
        _lastMaxHeightPixels = _maxHeightPixels;
    }
    public bool Update()
    {
        if (_texture == null)
        {
            _texture            = new Texture2D(1, 1, TextureFormat.Alpha8, false);
            _texture.hideFlags  = HideFlags.HideInInspector | HideFlags.DontSave;
            _texture.filterMode = FilterMode.Point;
            _texture.wrapMode   = TextureWrapMode.Clamp;
            _texture.Apply(false, true);
            _textureId = 0;
        }

        if (_textureId == 0)
        {
            _textureId = _texture.GetNativeTextureID();

            if (_textureId == 0)
            {
                // texture not ready, it may happen on multi-threaded rendering
                return(false);
            }

            //Debug.Log("Texture2D creation: " + _textureId);
        }

        SysFont.QueueTexture(_text, FontName, _fontSize, _isBold,
                             _isItalic, _alignment, _isMultiLine, _maxWidthPixels,
                             _maxHeightPixels, _textureId);

        _textWidthPixels  = SysFont.GetTextWidth(_textureId);
        _textHeightPixels = SysFont.GetTextHeight(_textureId);
        _widthPixels      = SysFont.GetTextureWidth(_textureId);
        _heightPixels     = SysFont.GetTextureHeight(_textureId);

        SysFont.UpdateQueuedTexture(_textureId);

        _lastText            = _text;
        _lastFontName        = FontName;
        _lastFontSize        = _fontSize;
        _lastIsBold          = _isBold;
        _lastIsItalic        = _isItalic;
        _lastAlignment       = _alignment;
        _lastIsMultiLine     = _isMultiLine;
        _lastMaxWidthPixels  = _maxWidthPixels;
        _lastMaxHeightPixels = _maxHeightPixels;
        _lastScaleSize       = _scaleSize;
        return(true);
    }
Exemplo n.º 3
0
  public bool Update()
  {
    if (_texture == null)
    {
      _texture = new Texture2D(1, 1, TextureFormat.Alpha8, false);
      _texture.hideFlags = HideFlags.HideInInspector | HideFlags.DontSave;
      _texture.filterMode = FilterMode.Point;
      _texture.wrapMode = TextureWrapMode.Clamp;
      _texture.Apply(false, true);
      _textureId = 0;
    }

    if (_textureId == 0)
    {
      _textureId = _texture.GetNativeTextureID();

      if (_textureId == 0)
      {
        // texture not ready, it may happen on multi-threaded rendering
        return false;
      }

      //Debug.Log("Texture2D creation: " + _textureId);
    }

    SysFont.QueueTexture(_text, FontName, _fontSize, _isBold,
        _isItalic, _alignment, _isMultiLine, _maxWidthPixels,
        _maxHeightPixels, _textureId);

    _textWidthPixels = SysFont.GetTextWidth(_textureId);
    _textHeightPixels = SysFont.GetTextHeight(_textureId);
    _widthPixels = SysFont.GetTextureWidth(_textureId);
    _heightPixels = SysFont.GetTextureHeight(_textureId);

    SysFont.UpdateQueuedTexture(_textureId);

    _lastText = _text;
    _lastFontName = FontName;
    _lastFontSize = _fontSize;
    _lastIsBold = _isBold;
    _lastIsItalic = _isItalic;
    _lastAlignment = _alignment;
    _lastIsMultiLine = _isMultiLine;
    _lastMaxWidthPixels = _maxWidthPixels;
    _lastMaxHeightPixels = _maxHeightPixels;
    _lastScaleSize = _scaleSize;
    return true;
  }
Exemplo n.º 4
0
    public void Update()
    {
        if (_texture == null)
        {
          _texture = new Texture2D(1, 1, TextureFormat.Alpha8, false);
          _texture.hideFlags = HideFlags.HideInInspector | HideFlags.DontSave;
          _texture.filterMode = FilterMode.Point;
          _texture.wrapMode = TextureWrapMode.Clamp;
          //Debug.Log("Texture2D creation: " + _texture.GetNativeTextureID());
        }

        int textureID = _texture.GetNativeTextureID();

        SysFont.QueueTexture(_text, FontName, _fontSize, _isBold,
        _isItalic, _alignment, _isMultiLine, _maxWidthPixels,
        _maxHeightPixels, textureID);

        _textWidthPixels = SysFont.GetTextWidth(textureID);
        _textHeightPixels = SysFont.GetTextHeight(textureID);
        _widthPixels = SysFont.GetTextureWidth(textureID);
        _heightPixels = SysFont.GetTextureHeight(textureID);

        SysFont.UpdateQueuedTexture(textureID);

        _lastText = _text;
        _lastFontName = FontName;
        _lastFontSize = _fontSize;
        _lastIsBold = _isBold;
        _lastIsItalic = _isItalic;
        _lastAlignment = _alignment;
        _lastIsMultiLine = _isMultiLine;
        _lastMaxWidthPixels = _maxWidthPixels;
        _lastMaxHeightPixels = _maxHeightPixels;
    }
Exemplo n.º 5
0
    public void Update()
    {
        if (_texture == null)
        {
          _texture = new Texture2D(1, 1, TextureFormat.Alpha8, false);
          _texture.hideFlags = HideFlags.HideInInspector | HideFlags.DontSave;
          _texture.filterMode = FilterMode.Point;
          _texture.wrapMode = TextureWrapMode.Clamp;
          //Debug.Log("Texture2D creation: " + _texture.GetNativeTextureID());
        }

        int textureID = _texture.GetNativeTextureID();

        SysFont.QueueTextureWithOptions(_text, FontName, _fontSize, _isBold,
        _isItalic, _alignment, _isMultiLine, _maxWidthPixels,
        _maxHeightPixels, (int)_lineBreakMode,
        _fillColor.r, _fillColor.g, _fillColor.b, _fillColor.a,
        _isStrokeEnabled, _strokeWidth, _strokeColor.r, _strokeColor.g, _strokeColor.b, _strokeColor.a,
        _isShadowEnabled, _shadowOffset.x, _shadowOffset.y, _shadowColor.r, _shadowColor.g, _shadowColor.b, _shadowColor.a,
        _lineSpacing, _offset, textureID);

        _textWidthPixels = SysFont.GetTextWidth(textureID);
        _textHeightPixels = SysFont.GetTextHeight(textureID);
        _widthPixels = SysFont.GetTextureWidth(textureID);
        _heightPixels = SysFont.GetTextureHeight(textureID);

        SysFont.UpdateQueuedTexture(textureID);

        _lastText = _text;
        _lastFontName = FontName;
        _lastFontSize = _fontSize;
        _lastIsBold = _isBold;
        _lastIsItalic = _isItalic;
        _lastAlignment = _alignment;
        _lastIsMultiLine = _isMultiLine;
        _lastMaxWidthPixels = _maxWidthPixels;
        _lastMaxHeightPixels = _maxHeightPixels;
        _lastLineBreakMode = _lineBreakMode;
        _lastFillColor = _fillColor;
        _lastIsStrokeEnabled = _isStrokeEnabled;
        _lastStrokeWidth = _strokeWidth;
        _lastStrokeColor = _strokeColor;
        _lastIsShadowEnabled = _isShadowEnabled;
        _lastShadowOffset = _shadowOffset;
        _lastShadowColor = _shadowColor;
    }