OpenVic icon indicating copy to clipboard operation
OpenVic copied to clipboard

Cursors

Open Nemrav opened this issue 1 year ago • 0 comments

Draft, loads cursors, animated and not animated, handles switching between cursors. Currently contains code just for testing/demoing: right click the mouse to cycle through loaded cursors. The watch is set as an i-beam cursor so that you can try hovering over a text field (ex. in the new-game menu) to observe how the Cursor Manager handles auto-switching between animated cursors.

Loading of the cursors and generating new resolutions handled by the c++ side CursorSingleton. Managing what frame to display, and when to switch cursors handled by gdscript side CursorManager. This architecture is because we want a c++ dataloader, but we also need to listen to the scene tree to know when its safe to call a hardware cursor change.

Possible improvements:

  • Doesn't support the full image spec (unhandled things like 16bit colour images that vic2 doesn't use)
  • Might want to change how I handle collecting both .cur and .CUR files in the loading function (perhaps a new, "ignore-case" parameter for .lookup_files_in_dir_recursive?
  • CursorManager creates a new compat_Cursor inner class whenever we switch cursors, which re-fetches the cursor stored in CursorSingleton. We can store a list of all compat_cursors to avoid this.

Nemrav avatar Aug 20 '24 02:08 Nemrav