Skip to content

Mouse Cursor Bitmap Improvements #7

@relic-se

Description

@relic-se

Currently, the default value of the cursor_image parameter within adafruit_usb_host_mouse.find_and_init_boot_mouse assumes that the application is running within Fruit Jam OS. To improve the usability of this library within other scenarios, the "mouse_cursor.bmp" should be included within this library and the find_and_init_boot_mouse method should be able to automatically determine its absolute path.

In case the user doesn't actually want to use this library with displayio, they should be able to disable the bitmap altogether and obtain x and y coordinates as a relative point from the initial position of the mouse without the use of a displayio.TileGrid object.

Here is my proposed implementation of the cursor_image parameter:

  • cursor_image="...", load the bitmap and generate the TileGrid object as is currently implemented
  • cursor_image=None, determine the local bitmap file absolute path and continue normal operation
  • cursor_image=False, create the BootMouse object without any displayio initialization

The x and y position of the mouse could be access using basic checks, ie: return self.tilegrid.x if self.tilegrid else self._x, or the position could be managed by class-level private variables regardless if a TileGrid object was provided.

Note: Is there a limitation with circup libraries about distributing non-mpy files? Would it be possible to load bitmap data as a bytes object instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions