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); }
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); }
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); }
private void CursorChanged(object sender, EventArgs args) { CursorVisible = !(Settings.CursorType != CursorType.Native || _runtime.CurrentCursor == MouseCursor.None); CursorTexture?.Dispose(); CursorTexture = CreateTexture(_runtime.Cursor); }
public void setTexture(CursorTexture texture) { textureSize = texture.size; hotspot = texture.hotspot; updateSize(); }