-
Notifications
You must be signed in to change notification settings - Fork 27
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
Cursors #252
base: master
Are you sure you want to change the base?
Cursors #252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some random comments from looking through the code (not form proper testing yet)
std::optional<godot::TypedArray<float>> displayRates; | ||
std::optional<godot::TypedArray<int>> sequence; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Godot has special Packed***Array
types that are faster and more space-efficient than regular arrays full of the same value type:
PackedByteArray
- array ofuint8_t
sPackedColorArray
- array ofColor
s (so basicallyVector4
s)PackedFloat32Array
- array offloat
sPackedFloat64Array
- array ofdouble
sPackedInt32Array
- array ofint32_t
sPackedInt64Array
- array ofint64_t
PackedStringArray
- array ofgodot::String
sPackedVector2Array
- array ofVector2
s (2 floats)PackedVector3Array
- array ofVector3
s (3 floats)PackedVector4Array
- array ofVector4
s (4 floats)
So here it would be best to use godot::PackedFloat32Array
and godot::PackedInt32Array
. Unfortunately there isn't a PackedVector2iArray
we could use for resolutions
, so that will have to stay as a regular array (unless you're able to switch to using float-based Vector2
s? Tbh probably not worth it anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the change to PackedFloat and Ints. You probably could use Vector2s instead of Vector2is, so I'll leave this unresolved in case you really do want that.
|
||
using namespace godot; | ||
using namespace OpenVic; | ||
using namespace OpenVic::NodeTools; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do use godot for various datatypes. Namespace OpenVic
is used for GameSingleton access only to my knowledge.
Removed NodeTools because it is completely unused.
Tell me if you want the using namespace Openvic;
removed, and to just use the double colon where appropriate instead.
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:
.lookup_files_in_dir_recursive
?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.