How callbacks work is very verbose and ugly. Instead, a wrapped function that sets up zig-like callbacks should be used similar to https://github.com/castholm/zig-examples/blob/master/breakout/main.zig#L943.
Simplify Callback Setup #82
Closed
opened 2025年06月12日 15:27:58 +02:00 by Gota7
·
2 comments
How callbacks work is very verbose and ugly. Instead, a wrapped function that sets up zig-like callbacks should be used similar to https://github.com/castholm/zig-examples/blob/master/breakout/main.zig#L943.
Ideally there would be no more ugly disable main hack too, and using callbacks would feel like a proper extension rather than have so much overhead. Having so much overhead is very discouraging for beginners, and switching from a main function to callbacks should be not too much effort if this is implemented.
Ideally there would be no more ugly disable main hack too, and using callbacks would feel like a proper extension rather than have so much overhead. Having so much overhead is very discouraging for beginners, and switching from a main function to callbacks should be not too much effort if this is implemented.
I did a new approach that works well, but I won't close this until you can avoid doing this:
// Use main callbacks.comptime{_=sdl3.main_callbacks;}I am not sure how to get SDL to export the functions for when you have the callbacks enabled but not anything else.
I did a new approach that works well, but I won't close this until you can avoid doing this:
```zig
// Use main callbacks.
comptime {
_ = sdl3.main_callbacks;
}
```
I am not sure how to get SDL to export the functions for when you have the callbacks enabled but not anything else.
Gota7
added this to the Jupiter project 2025年12月26日 04:09:49 +01:00
Gota7
added the 2026年03月04日 06:30:09 +01:00
enhancement
label
Gota7
closed this issue 2026年03月04日 07:47:35 +01:00
Sign in to join this conversation.
No Branch/Tag specified
Labels
Clear labels
bug
Something isn't working
CI
Ci related issues.
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
not a zig-sdl3 problem
possibly fixed
If a fix has been pushed to master, but is waiting on confirmation from the issue creator.
question
Further information is requested
wontfix
This will not be worked on
No labels
bug
CI
documentation
duplicate
enhancement
good first issue
help wanted
invalid
not a zig-sdl3 problem
possibly fixed
question
wontfix
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
7Games/zig-sdl3#82
Loading...
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?