-
Notifications
You must be signed in to change notification settings - Fork 49
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
Use zig fmt
to fix the casting changes in the latest zig version
#39
Conversation
Ah ok, tests are expected to fail because the CI pipeline doesn't use the Zig dev version. I'll try to test the change manually before merging the PR, might take a couple of days though until I get around it. |
This Fixes #40 but |
zig fmt
to fix the casting changes in the latest zig version
IMO it'd be great to always format the Zig sources in Sokol with |
pip_desc = .{ | ||
.shader = sg.makeShader(shd.quadShaderDesc(sg.queryBackend())), | ||
.primitive_type = .TRIANGLE_STRIP, | ||
.blend_color = .{ .r=1.0, .g=0.0, .b=0.0, .a=1.0 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a trailing comma for the last argument, zig fmt
will preserve multiple lines for pip_desc
initialization. In other words, add a comma ,
after the closing brace }
of .blend_color = ...
.
.blend_color = .{ .r=1.0, .g=0.0, .b=0.0, .a=1.0 },
const t: vec3 = .{ | ||
.x = (@intToFloat(f32, dst) - shift) * 3.0, | ||
.y = (@intToFloat(f32, src) - shift) * 2.2, | ||
.z = 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, trailing comma would preserve the multiple lines here.
Tried to preserve the old formatting but I'm sure I'm missing a lot. |
Looks good to me at least. That's the style of Zig that I see everywhere. I used to sweat over code formatting, like aligning tables & such, but the convenience of just hitting Save in VSCode and letting it run "zig fmt" to clean things up is so high. |
Hmm, we should probably fix the code generation so that the output matches This can wait a bit though.
This is my main complaint with formatting tools, anything that's not properly aligned seems to trigger my OCPD ;) It's ok though, maybe zig fmt will one day get a bit more clever about column formatting. |
Yup, that's been my biggest issue with auto-formatting tool. At some point I just gave up though since auto-formatting seem to be increasingly prevalent (esp. with golang where it's basically required for any real work) and none of these tools seem to care much for this type of alignment. I wouldn't go back to manual formatting anymore, "format on save" is just so convenient and you learn to rely on it a lot. It's nice that at least line breaks can be controlled pretty well with added commas, as was used in this PR too.
I can volunteer for looking into this. :) EDIT: here you go: floooh/sokol#849 |
...going to merge this now, and then apply the new bindgen with @nurpax's formatting fixes. |
ah... when doing this I also need to fix the samples for the last round of breaking changes (in the sokol headers) doh... (the 0.11.0 branch unfortunately wasn't updated yet... would have made sense to do this first, but too late now) |
Ok, the zig-0.11.0 branch should now be in good shape again, and also updated with the latest headers and example fixes from master. |
New change from the latest zig version uses
@destFromSrc()
instead of@srcToDest()
for casting