Skip to content
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

Utility for swapping Raylib.Vector2 to Jaylib.Vector2 and vice versa #59

Closed
wants to merge 6 commits into from

Conversation

MerujSargsyan
Copy link
Contributor

Added a simple utility to do what the title says. May be unnessesary but may cause compilation issues is different vectors are used across projects.

@electronstudio
Copy link
Owner

Thanks for raising this issue - it does highlight that having the Jaylib.* subclasses causes a lot of confusion for users of the library.

The original reason they were created was that people didn’t like the JavaCPP fluent syntax and wanted traditional constructor methods. So I made those, but they couldn’t go in the auto generated Raylib.* classes, so they went in subclasses in Jaylib.*. I figured that any time Raylib required a struct as an argument, the user could supply a subclass if he preferred and no other changes would be required.

However if people are finding the need to convert back and forth between the Jaylib.* subclasses and and the Raylib.* classes then this must have been the wrong approach.

What I’m thinking now is we should eliminate the Jaylib.* stuff completely and instead of having constructors have methods like createCamera() that return a Raylib.Camera.

@MerujSargsyan
Copy link
Contributor Author

Honeslty, I do think that working on streamlining the process of using only Raylib.* instead of having to use both Raylib and Jaylib.* within the same file or project would make things much simpler. I believe the go language wrapper manages this by making an object like "Raylib" which can be used to access raylib functions and types.

I will take another look at the other language wrappers to see how they manage this and come up with a better and more clean picture.

@electronstudio
Copy link
Owner

Jaylib is auto generated using JavaCPP so this limits our ability to create what API we want. Jaylib-FFM is probably more flexible in this regard.

@MerujSargsyan
Copy link
Contributor Author

Oh in that case where do you think we would place functions such as create camera or create vector? Would this be static or would this be a new class implemented, perhaps called JLib?

Some uses cases would be: JLib.createCamera(...); or JLib.createVector2(x, y)

Or are you picturing something different?

@electronstudio
Copy link
Owner

@MerujSargsyan
Copy link
Contributor Author

I like the proposition and I said more on that open issue specifically. I am going to close this pull request now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants