Testing some code display add ones for Live Writer and this blog.
First the code I’m wanting to add to a page:
#define getAt( x, y ) mapBG[ ( ( y ) << 5 ) + ( x ) ];
int main( int argc, char *argv[] )
{
initScreen(); // Call to the screen initialisation code
// Initialise the file system so that we can access external files.
if( !nitroFSInit() )
{
iprintf( "Unable to init file system" );
exit( 0 );
}
fLevels = fopen( "levels.dat", "rb" );
initPablo(); // Set up some global variables – these are normally
// bad, but for this little exercise they are good
initStats(); // init the status display
showLevel(); // Show the level
while(1) {
showPablo(); // Put Pablo on the screen
showStats(); // Show the players lives, etc on the screen.
swiWaitForVBlank();
erasePablo(); // Erase Pablo
}
return 0;
}
Prettified Code:
#define getAt( x, y ) mapBG[ ( ( y ) << 5 ) + ( x ) ];
int main( int argc, char *argv[] )
{
initScreen(); // Call to the screen initialisation code
// Initialise the file system so that we can access external files.
if( !nitroFSInit() )
{
iprintf( "Unable to init file system" );
exit( 0 );
}
fLevels = fopen( "levels.dat", "rb" );
initPablo(); // Set up some global variables – these are normally
// bad, but for this little exercise they are good
initStats(); // init the status display
showLevel(); // Show the level
while(1) {
showPablo(); // Put Pablo on the screen
showStats(); // Show the players lives, etc on the screen.
swiWaitForVBlank();
erasePablo(); // Erase Pablo
}
return 0;
}
Pasta as VS Code:
- #define getAt( x, y ) mapBG[ ( ( y ) << 5 ) + ( x ) ];
{
initScreen(); // Call to the screen initialisation code
// Initialise the file system so that we can access external files.
if( !nitroFSInit() )
{
iprintf( "Unable to init file system" );
exit( 0 );
}
fLevels = fopen( "levels.dat", "rb" );
initPablo(); // Set up some global variables these are normally
// bad, but for this little exercise they are good
initStats(); // init the status display
showLevel(); // Show the level
while(1) {
showPablo(); // Put Pablo on the screen
showStats(); // Show the players lives, etc on the screen.
swiWaitForVBlank();
erasePablo(); // Erase Pablo
}
return 0;
}
