13
114
Fork
You've already forked zig-sdl3
19

Simplify Callback Setup #82

Closed
opened 2025年06月12日 15:27:58 +02:00 by Gota7 · 2 comments
Gota7 commented 2025年06月12日 15:27:58 +02:00 (Migrated from github.com)
Copy link

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.

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.
Gota7 commented 2025年06月12日 15:29:28 +02:00 (Migrated from github.com)
Copy link

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.
Gota7 commented 2025年06月30日 04:22:09 +02:00 (Migrated from github.com)
Copy link

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
Sign in to join this conversation.
No Branch/Tag specified
master
docs
master-gpu
image-updates
net-cleanup
vulkan-template
shadercross
better-documentation-and-examples
145-web-ci
yaml-rework
v0.2.2
v0.2.1
v0.2.0
v0.1.9
v0.1.8
v0.1.7
v0.1.6
v0.1.5
v0.1.4
v0.1.3
v0.1.2
v0.1.1
v0.1.0
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
Reference in a new issue
7Games/zig-sdl3
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?