Ejemplo n.º 1
0
        public static void SetCursorTexture(CursorTexture cursorTexture)
        {
            Texture2D texture = GetTextureFromCursorTexture(cursorTexture);
            float     width   = 0;
            float     height  = 0;

            if (cursorTexture != CursorTexture.Normal)
            {
                width  = texture.width / 2f;
                height = texture.height / 2f;
            }
            Cursor.SetCursor(texture, new Vector2(width, height), CursorMode.Auto);
        }
Ejemplo n.º 2
0
    private void ChangeCursor(int number)
    {
        if (number < 0 || number >= CursorTextures.Length)
        {
            return;
        }

        CurrentCursor = number;

        CursorTexture c       = CursorTextures[number];
        Vector2       hotspot = c.Center ? new Vector2(c.texture.width, c.texture.height) * .5f : Vector2.zero;

        Cursor.SetCursor(c.texture, hotspot, CursorMode.Auto);
    }
Ejemplo n.º 3
0
        public static Texture2D GetTextureFromCursorTexture(CursorTexture cursorTexture)
        {
            var textures = DataHolder.GUIReferences.CursorTextures;

            for (int i = 0; i < textures.Length; i++)
            {
                var texture = textures[i];
                if (texture.CursorTexture == cursorTexture)
                {
                    return(texture.Texture);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
 private void CursorChanged(object sender, EventArgs args)
 {
     CursorVisible = !(Settings.CursorType != CursorType.Native || _runtime.CurrentCursor == MouseCursor.None);
     CursorTexture?.Dispose();
     CursorTexture = CreateTexture(_runtime.Cursor);
 }
Ejemplo n.º 5
0
 public void setTexture(CursorTexture texture)
 {
     textureSize = texture.size;
     hotspot     = texture.hotspot;
     updateSize();
 }