Page 1 of 1

Screen wobble SGDK sample

Posted: Wed Dec 30, 2020 6:30 pm
by Joe Musashi
Hi,

I wanted to get a bit more used to the new SGDK 1.60 release, so I programmed a sample as an exercise. Something I always wanted to try on the Genesis is screen warping. To achieve this, the demo uses a horizontal interrupt handler which modifies the vertical scrolling settings each line. Included is also an on-screen menu, where you can change the parameters of the wave function that distorts the screen.

wobble.png
wobble.png (32.21 KiB) Viewed 11865 times

Binary and source are attached. If you want to compile the source yourself, simply define the $GDK environment variable so that it points to your SGDK folder and then run:

Code: Select all

cd wobble
make -f $GDK/makefile.gen 
Have Fun!

Re: Screen wobble SGDK sample

Posted: Wed Dec 30, 2020 9:47 pm
by Stef
The effect looks gorgeous ! well done !
And the settings menu is really nicely done too.
Can i eventually use it as default sample ? that is the kind of sample i always wanted to do but never spent time for that. Of course you will be credited for that :)
Also it's good that you made it for SGDK 1.6 as i modified the way the hint / vint callback handler to make it faster (less overload compared to previous SGDK) :)

Re: Screen wobble SGDK sample

Posted: Thu Dec 31, 2020 12:43 am
by danibus
Very nice example! Love it!
Is there any possibility to make this in horizontal instead vertical?

Re: Screen wobble SGDK sample

Posted: Thu Dec 31, 2020 6:42 pm
by Joe Musashi
Stef wrote:
Wed Dec 30, 2020 9:47 pm
The effect looks gorgeous ! well done !
And the settings menu is really nicely done too.
Can i eventually use it as default sample ? that is the kind of sample i always wanted to do but never spent time for that. Of course you will be credited for that :)
Also it's good that you made it for SGDK 1.6 as i modified the way the hint / vint callback handler to make it faster (less overload compared to previous SGDK) :)
Thanks for the kind words!
Of course you can use it if you like, I'd love to see it as an SGDK default sample.

Speaking of hint callback :), I noticed that sys.h still defines

Code: Select all

extern VoidCallback *internalHIntCB;
even though it does not seem to be used anymore. It might be just a leftover, but I would like to ask if this is intentional and if there is any use to it?

Re: Screen wobble SGDK sample

Posted: Thu Dec 31, 2020 6:47 pm
by Joe Musashi
danibus wrote:
Thu Dec 31, 2020 12:43 am
Very nice example! Love it!
Is there any possibility to make this in horizontal instead vertical?
Thanks!

It's possible to shift each line horizontally, but that would not warp (or scale) the line, just move it.
Thinking more of it, one could pre-compute some warping as tiles, and then repeat them (a bit like the flags in VectorMan). That might make a cool effect in a game :)

Re: Screen wobble SGDK sample

Posted: Fri Jan 01, 2021 9:51 pm
by Stef
Joe Musashi wrote:
Thu Dec 31, 2020 6:42 pm
Thanks for the kind words!
Of course you can use it if you like, I'd love to see it as an SGDK default sample.
Thanks ! i will probably add it soon then :D
I may eventually add some comments here and there (I saw you used low level sprite API for instance)
Speaking of hint callback :), I noticed that sys.h still defines

Code: Select all

extern VoidCallback *internalHIntCB;
even though it does not seem to be used anymore. It might be just a leftover, but I would like to ask if this is intentional and if there is any use to it?
Oh in fact it was renamed ! But to be honest i shouldn't had made directly accessible, and now you really need to use the setXintCallback(..) method in every case so i will remove the direct access to the variable :)