SagaPDev / Godot-SDL-Gyro

Add Gamepad Gyro Funtionality to Godot
MIT License
26 stars 3 forks source link

Add .NET support #1

Open ThePhantomMask opened 6 months ago

ThePhantomMask commented 6 months ago

Is there also the possibility of adding support for .NET/C# programming in addition to GDScript?

SagaPDev commented 6 months ago

I'm not familiar using c# with the mono build of Godot, do you get any errors when trying to make "SDLGyro.new()" from a C# script?

From what i know functions added by GDextention should behave as regular built-in Godot functions.

ThePhantomMask commented 6 months ago

It just doesn't work, I think it must be made on purpose the combinability.

SagaPDev commented 6 months ago

Yes apparently it is true, but there is not much official documentation around it, just discussions and proposed solutions, i will take a look and post here if there is any progress, if you find anything that could be helpful feel free to link it.

ThePhantomMask commented 6 months ago

And then on the GDScript side: I get this error: modules/gdscript/gdscript_compiler.cpp:121 - GDScript bug: Native class 'SDLGyro' not found.

SagaPDev commented 6 months ago

sdl_mono_test.zip make sure you place the addons folder in the root of your project (here is an example i made with the mono build of godot but still using gdscript)

ThePhantomMask commented 6 months ago

It works. For the .NET issue, there are some communities that might help you Chickensoft and CoaguCo Industries

ThePhantomMask commented 6 months ago

getCalibratedGyro() and getProcessedAcceleration() these two methods do not seem to work.

SagaPDev commented 6 months ago

Remember that is necessary to call gamepadPolling() for the other functions to work (like this):

...
func _process(_delta):
  Gyro.gamepadPolling()
  print(Gyro.getCalibratedGyro())
...
ThePhantomMask commented 6 months ago

A suggestion: Integrating vectors (2/3/4) would be convenient via Godot's Vectors

SagaPDev commented 6 months ago

could you elaborate on that?

ThePhantomMask commented 6 months ago

Instead of the typed array you could use Vector2/3/4 of Godot

SagaPDev commented 6 months ago

I tried it at first but, but gamepadMotionHelperes expected floats so i ended up using the Typed Array instead, i considered converting the array to a vector and returning it but didn't want to put more chain in the process. I will revisit this idea

ThePhantomMask commented 6 months ago

OK...got it. Have you tried putting a vector that is initialised with the array data and then return the vector?

SagaPDev commented 6 months ago

This is the exact thing i want to try, (i'm currently doing some freelance job, i will add this to the list on changes i have planed when i come back)

SagaPDev commented 5 months ago

if you're in windows, inside this project folder you will have to make the libs folder and then the mingw_dev_lib folder inside of it, place the files and folders extracted from SDL2-X.XX.X\x86_64-w64-mingw32 there) i hope i was clear, maybe i should change this

ThePhantomMask commented 5 months ago

Meanwhile on my fork I am trying to add Vector3 and 4

ThePhantomMask commented 5 months ago

if you're in windows, inside this project folder you will have to make the libs folder and then the mingw_dev_lib folder inside of it, place the files and folders extracted from SDL2-X.XX.X\x86_64-w64-mingw32 there) i hope i was clear, maybe i should change this

But within src folder?

SagaPDev commented 5 months ago

no no, in the root of your project, take a look: 1714955981_grim

ThePhantomMask commented 5 months ago

no no, in the root of your project, take a look: 1714955981_grim

Then I have to put the folder with all the SDL2 functions on src, right? But how to solve a fatal error where it is impossible to open SDL2.lib how do I do it?