Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Cursor #6923

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Custom Cursor #6923

wants to merge 9 commits into from

Conversation

TheColorRed
Copy link
Contributor

Allows the user to use a custom window cursor.

Example usage:

import { Button } from "std-widgets.slint";

export component AppWindow inherits Window {
  property <int> counter: 0;
  property <[image]> cursors: [
    @image-url("cursors/red.png"),
    @image-url("cursors/green.png"),
    @image-url("cursors/blue.png"),
    @image-url("cursors/pink.png"),
  ];

  cursor: cursors[counter];
  cursor-hotspot-x: 20px;
  cursor-hotspot-y: 0px;

  width: 800px;
  height: 600px;

  TouchArea {
    clicked => {
      root.counter += 1;
      if (root.counter >= root.cursors.length) {
        root.counter = 0;
      }
    }
  }
}

@TheColorRed
Copy link
Contributor Author

Looking for feedback, There are a few things I was unsure of.

The TODO. Not sure if it should only update when the input changes, as I am not sure if it should run on every frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant