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

OOP Library #4

Draft
wants to merge 110 commits into
base: main
Choose a base branch
from
Draft

OOP Library #4

wants to merge 110 commits into from

Conversation

Charadon
Copy link

@Charadon Charadon commented Feb 8, 2024

This isn't currently done, and i'm more opening this as a way to go "Hey, this exists."

This pull request basically adds a library that abstracts Raylib into a more Vala-like experience. The reason I went down the library route instead of doing it directly through the vapi was because I quickly realized it would make the raylib vapi a massive 10,000+ line unmaintainable monstrosity. This also allows the ability to keep the more c-like API alongside the OOP API.

This also has an unattended consequence of making it work on any language that supports GObject Introspection.

Another thing I did was add Raylib as a subproject, so people could use this binding as a subproject for their own projects and have the full stack.

The Util namespace just contains functions that I made to help me out, and thought it'd be useful in general.

The code is also documented, so using valadoc will create pretty good documentation.

Now, I don't think i'll be able to get around to doing the 3D stuff, as I don't really do anything with 3D.

With a bunnymark score of around 62,000 before it dips below 60fps. I'd say it performs pretty well, as well!

@lxmcf
Copy link
Owner

lxmcf commented Feb 8, 2024

Hey!

This looks awesome and I agree going down the library path is best, main thing that prevented me from working on a VAPI for it was; as you said, how massive it would end up!

Let me know when you think everything 2D wise is sorted and I have no issues with merging this across :-)

Charadon added 4 commits May 15, 2024 22:58
Vala seems to produce quite of a bit of warnings on GCC 13.

So I added some -Wno args to disable them to stop clogging the output.
Shapes.Rectangle needs to be made before I can continue.
@Charadon
Copy link
Author

Aw yeah, back in action! Gonna start re-creating the examples from Raylib upstream as that'll be a good way to indicate what needs to be implemented.

As a sidenote, I love that Raylib is API stable, so I don't feel rushed at all to accomplish this =D

Like, 6.0 could come out tomorrow, and i'd probably have to do minimal effort to get it working with it.

@Charadon
Copy link
Author

Found out if I want to make all the examples, I gotta add raymath to the vapi file, and then OOP it 😅

@lxmcf
Copy link
Owner

lxmcf commented May 27, 2024

Ah yes!

I was working on a raymath VAPI a while ago but couldn't work out an easy way to make it 'portable' and usable without the raylib VAPI itself

@Charadon
Copy link
Author

Charadon commented May 28, 2024

Ah yes!

I was working on a raymath VAPI a while ago but couldn't work out an easy way to make it 'portable' and usable without the raylib VAPI itself

Interestingly, a lot of the float math functions are already methods in vala's float object (Such as clamp). I might ask around to see if I could somehow extend the float object to have the other functions such as lerp

Now as for adding those functions to the vapi, i'm gonna err on the side of simplicity and just add it into it's own namespace Raylib.Math inside the raylib.vapi file.

@lw64
Copy link

lw64 commented Sep 27, 2024

changing the parameters to use ints instead of enum types. Since enums in vala are not really the same kind of enum in C, and it causes issues.

Hi, I was wondering what your specific issue here was?

@Charadon
Copy link
Author

Charadon commented Sep 30, 2024

changing the parameters to use ints instead of enum types. Since enums in vala are not really the same kind of enum in C, and it causes issues.

Hi, I was wondering what your specific issue here was?

If I remember correctly, I was getting type errors at compilation. However, I think it was only an issue on 0.48, the one that comes with RHEL 8

@lw64
Copy link

lw64 commented Oct 1, 2024

ah I see. If the errors are still there it might be fixable with attributes.

@lxmcf
Copy link
Owner

lxmcf commented Nov 26, 2024

Just a heads up I will be updating the base VAPI to raylib 5.5 in the coming days, will try not to touch anything else to avoid further conflicts! 😄

@Charadon
Copy link
Author

Just a heads up I will be updating the base VAPI to raylib 5.5 in the coming days, will try not to touch anything else to avoid further conflicts! 😄

Raysan is pretty good about backwards compatibility, so it shouldn't break anything... I hope lol

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.

4 participants