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

readme: sokol_gp #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

readme: sokol_gp #224

wants to merge 1 commit into from

Conversation

sudokit
Copy link

@sudokit sudokit commented Jul 23, 2024

a more up-to-date wrapper for sokol_gp library (felt wrong just to replace the other)

a more up-to-date wrapper for sokol_gp library (felt wrong just to replace the other)
Comment on lines 223 to +224
- [V_sokol_gp](https://github.com/mohamedLT/V_sokol_gp) - A V wrapper for the sokol_gp library for easy and fast 2d graphics.
- [sokol_gp](https://github.com/sudokit/v_sokol_gp) - A up-to-date V wrapper for sokol_gp.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does your compare with the older sokol_qp?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not by too much, enum members named a bit differently and the sokol_gp header file is newer (some functions different because of that). I can prob also try submitting a pr for the original repo if thats better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am considering replacing the older one and keeping it because it is significantly outdated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah was thinking about that too but just felt wrong to replace it. I guess it would just be easier to replace it in order to get the latest version. Just if you could check that the code is according to the V naming convention and that stuff. First day with V so not too familiar yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't say "up-to-date" in the description... it's only true if you always keep the wrapper up-to-date. Otherwise the first time sokol_gp is updated, the wrapper is no longer up-to-date.

Copy link
Contributor

@JalonSolov JalonSolov Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. If it was a different thing (as in different functionality of the wrapper), and they both still work, I'd say keep both. If they are basically the same thing, just one more up-to-date than the other, or one will compile with latest V where the other won't, there's no reason to keep the other.

Copy link
Author

@sudokit sudokit Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so the old one just plain doesnt work. It uses deprecated attribute annotation and when trying to use it fails with an error.

================== C compilation error (from tcc): ==============
cc: In file included from /tmp/v_1000/src.01J3HWEZ1JK7ET951PM5V6C9C3.tmp.c:1232:
cc: /home/sudokit/.vmodules/mohamedlt/sotkolgp/sokol_gp.h:1036: error: field not found: context
... (the original output was 4 lines long, and was truncated to 2 lines)
=================================================================

And i couldnt figure what that error meant, but i think it has something to do with the new sokol library headers not having context and hence harder to fix without completely remaking the wrapper, so thats what i did.

another thing, some things arent working. like drawing many of something. cant figure out how to pass const sgp_point* points from V for example

Copy link
Contributor

@JalonSolov JalonSolov Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there was a fairly recent breaking change in the sokol headers, which could explain that error.

When you find an error in someone else's package, there's always the possibility of submitting a PR to them or just sending an email asking if they're willing to update theirs.

The autocomplete is still WIP, so it won't always be accurate as to what the compiler allows (or doesn't).

As far as passing an array from V to C code... an array in V is not a C array, it is a struct with several fields, including a C-style array named data. So you can pass &points.data to C and it will look like passing a C array.

However, you need to make sure the C code won't try to modify the length of the array, or V will not understand the changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sokol projects is very dependent on the sokol version they were written for/against. A fact that not everyone is aware of. Sokol is a very active project that often has breaking changes but it also has very stable releases. So projects written against sokol 2 years ago works with sokol at that point in time, but not newer versions of sokol.

Copy link
Author

@sudokit sudokit Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry disappeared for a while. That's for the .data, it worked. I totally forgot about that. And yeah ig I can try submitting a PR

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