-
Notifications
You must be signed in to change notification settings - Fork 636
Add sdl3 renderer demo #825
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
base: master
Are you sure you want to change the base?
Conversation
Apply 825.diff from: Immediate-Mode-UI#825 which adds updated backend for SDL3 Renderer Hopefully, it will work just fine (untested) Big thanks to github.com/suboyar
There is already an advanced PR for SDL3 demo which uses SDL_renderer, see #779 |
I skimmed through #779, nuklear_sdl3_renderer.h seem quite similar, while their nuklear_sdl3_renderer.c (compared to my main.c) is missing some initialization property and uses SDL's own main callback. While I tried to make a 1:1 implementation of the provided sdl2 demo. As for why I made this PR, I searched for "SLD3 renderer demo" which didn't yield any results. |
Is there anything important/critical in those properties? If not, this isn't really a problem since *.c files are more of an example. Having less code in them would be even preferable.
It is now preferred to use those callbacks in SDL3, see https://wiki.libsdl.org/SDL3/README-main-functions
Actually, the other PR is missing
Yea, I also had this issue. I started working with your PR, then realized that #779 exists. IMO, the other PR has really misleading name... @suboyar Anyway, I'm currently working on #779 since there are more people involved there, but would love to know if the other PR misses anything that your PR solves better. |
|
||
Uint64 now = SDL_GetTicks(); | ||
sdl.ctx.delta_time_seconds = (float)(now - sdl.time_of_last_frame) / 1000; | ||
sdl.time_of_last_frame = now; |
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.
Is sdl.ctx.delta_time_seconds
being used anywhere? I think that #779 is missing this one. I was also wondering, if we could use delta time for proper double-click (mentioned here)
EDIT: ahh, now I understand, Nuklear needs this for hiding scroll bar!
/tmp/Nuklear/src $ grep -rn 'delta_time_seconds' .
./nuklear_panel.c:493: window->scrollbar_hiding_timer += ctx->delta_time_seconds;
./nuklear.h:5737: float delta_time_seconds;
I have ported
sdl_renderer
to SDL3.Changes from
sdl_renderer
tosdl3_renderer
:SDL_WINDOW_SHOWN
)SDL_PropertiesID
system