Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.75k stars 187 forks source link

"Hello World!" gives error #136

Closed ID453543435 closed 5 years ago

ID453543435 commented 5 years ago

include

int main() { VDP_drawText("Hello World!", 10, 13); return (0); } gives error https://i.ibb.co/JxcCtS3/image.png

https://github.com/Stephane-D/SGDK/wiki/Tuto-Hello-World

ehaliewicz commented 5 years ago

Try adding an empty while loop after the VDP_drawText call. You cannot return from the main function on the genesis.



int main()
{
VDP_drawText("Hello World!", 10, 13);
while(1) { }
return (0);
}
ID453543435 commented 5 years ago

do update the

https://github.com/Stephane-D/SGDK/wiki/Tuto-Hello-World

page

Stephane-D commented 5 years ago

Did you carefully read this tutorial ? :p It's explained that you can't use that code directly on Sega Genesis and that you need to add the infinite loop:

This code is correct but not Genesis friendly : do you think we can return (and stop) a program ?

Video games repeatedly update the TV screen, and it's up to you to handle things before or while a refresh.

So a more Genny Hello World is more like this :

include


int main()
{
VDP_drawText("Hello Genny World!", 10, 13);
while(1)
{
    //read input
    //move sprite
    //update score
    //draw current screen (logo, start screen, settings, game, gameover, credits...)
}
return (0);

}


> 
> This code is correct, even if return(0) will never be reached.