Skip to content
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

Change the text to use the VBL interrupt from the start #112

Open
AntonioND opened this issue Aug 7, 2024 · 2 comments
Open

Change the text to use the VBL interrupt from the start #112

AntonioND opened this issue Aug 7, 2024 · 2 comments

Comments

@AntonioND
Copy link
Member

AntonioND commented Aug 7, 2024

vid_vsync() is a really bad hack that shouldn't be used in any serious project. However, Tonc uses that function all the time up to chapter 16. Hardware interrupts.

This is done because Cearn wanted to explain things step by step and not use anything that hadn't been explained, but it's very unlikely that anyone will reach chapter 16 after learning how to do graphics, input, etc, especially if the chapter name is "Hardware interrupts", which sounds boring.

I think teaching people from the start to use:

irq_init(NULL);
irq_add(II_VBLANK, NULL);

and:

VBlankIntrWait();

Is reasonable, and they can keep using them even if they never reach chapter 16.

Personally, when I started with NDS development, I used interrupts from the start without understanding them at all, and I only started to understand them months after starting. It was fine. I just knew that the "wait for VBL interrupt" function waited for the next frame.

Opinions?

@GValiente
Copy link
Member

I would add a very small warning/intro about interrupts before using them, but yeah, vid_vsync() sucks xD

@AntonioND
Copy link
Member Author

AntonioND commented Aug 22, 2024

I've done something similar with memcpy() when used to copy data to VRAM: gbadev-org/libtonc-examples@89d84ea

That way people won't copy broken code.

We will also need to update the examples to not use vid_flip().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants