Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@

- [V Earcut](https://github.com/Larpon/earcut) - fast (real-time) polygon triangulation library based on [mapbox/Earcut](https://github.com/mapbox/earcut) to handle holes, twisted polygons, degeneracies and self-intersections.
- [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.
Comment on lines 223 to +224
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

- [viup](https://github.com/kjlaw89/viup) - V wrapper for the C-based cross-platform UI library, IUP.
- [vsdl](https://github.com/kjlaw89/vsdl) - V wrapper for the C-based SDL library.
- [vsdl2](https://github.com/nsauzede/vsdl2) - A libSDL2 wrapper.
Expand Down