From 25831b053acadaa974c4031285178e5baf325ec1 Mon Sep 17 00:00:00 2001 From: Marius Petcu Date: Tue, 25 Dec 2018 18:14:29 +0200 Subject: [PATCH] Document defos.load_cursor() --- README.md | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ee1ae2f..cfa05ea 100644 --- a/README.md +++ b/README.md @@ -231,14 +231,10 @@ end) --- -**Set custom hardware cursors**. `cursor` can be one of the following: - * `nil`: Resets the cursor to default. Equivalent to `defos.reset_cursor()`. - * `defos.CURSOR_ARROW` - * `defos.CURSOR_HAND` - * `defos.CURSOR_CROSSHAIR` - * `defos.CURSOR_IBEAM` - * On HTML5, an URL to an image (data URLs work as well) +**Load custom hardware cursors**. `cursor_data` must be: + * On HTML5, an URL to an image (data URLs work as well). * On Windows, a path to an `.ani` or `.cur` file on the file system. + * On Linux, a path to an X11 cursor file on the file system. * On macOS, a table of the form: ```lua { @@ -257,6 +253,21 @@ functional position of the mouse pointer (eg. the tip of the arrow). [cursor-tiff]: https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW27 +```lua +local cursor = defos.load_cursor(cursor_data) +``` + +--- + +**Set custom hardware cursors**. `cursor` can be one of the following: + * `nil`: Resets the cursor to default. Equivalent to `defos.reset_cursor()`. + * `defos.CURSOR_ARROW` + * `defos.CURSOR_HAND` + * `defos.CURSOR_CROSSHAIR` + * `defos.CURSOR_IBEAM` + * A `cursor` value obtained with `defos.load_cursor()`. + * A `cursor_data` value that will be used to create a single-use cursor. See `defos.load_cursor()` above for supported values. + ```lua defos.set_cursor(cursor) defos.reset_cursor()