Update build system, small code updates/tests

This commit is contained in:
2023-11-17 13:53:12 +01:00
parent 2329a59f8f
commit 3ba1e58b75
13 changed files with 144 additions and 71 deletions

View File

@ -18,14 +18,14 @@ typedef struct MainArgs {
/*{pal:"nes",layout:"nes"}*/
const char palette[32] = {
0x0F, // screen
0x11,0x30,0x27,0x00, // background 0
0x1c,0x20,0x2c,0x00, // background 1
0x00,0x10,0x20,0x00, // background 2
0x06,0x16,0x26,0x00, // background 3
0x16,0x35,0x24,0x00, // sprite 0
0x00,0x37,0x25,0x00, // sprite 1
0x0d,0x2d,0x3a,0x00, // sprite 2
0x0d,0x27,0x2a, // sprite 3
0x11,0x02,0x02,0x00, // background 0
0x00,0x00,0x00,0x00, // background 1
0x00,0x00,0x00,0x00, // background 2
0x00,0x00,0x00,0x00, // background 3
0x16,0x00,0x00,0x00, // sprite 0
0x00,0x00,0x00,0x00, // sprite 1
0x00,0x00,0x00,0x00, // sprite 2
0x00,0x00,0x00, // sprite 3
};
Uint32 nextTick;
@ -34,7 +34,7 @@ bool MainLoop( void *args )
{
MainArgs *margs = (MainArgs*)args;
//SDL_FillRect(margs->Background, &rect, 0x000000);
//SDL_FillRect(margs->background, NULL, 0x00F);
MultiSpacc_BlitLayer( margs->background, margs->screen );
//SDL_BlitSurface( margs->Foreground, &rect, margs->Screen, &rect );
MultiSpacc_SetSprite( 0, margs->spriteX, margs->spriteY, 1, margs->tilesImg, margs->screen );
@ -58,6 +58,12 @@ bool MainLoop( void *args )
return false;
}
// for( int i=0; i< margs->screen->w * margs->screen->h * margs->screen->format->BytesPerPixel; i++ )
// {
// NOTE: format is BGRA for 32bits
// SDL_memset( (char*)margs->screen->pixels + i, 0xFF, 1 );
// }
if( !MultiSpacc_UpdateDisplay( margs->window ) )
{
MultiSpacc_PrintDebug("[E] Error Updating Screen.\n");
@ -78,11 +84,11 @@ int main( int argc, char *argv[] )
windowConfig.width = 320;
windowConfig.height = 240;
windowConfig.bits = 16;
//windowConfig.bits = 16;
memcpy( windowConfig.palette, palette, 32 );
//romfsInit();
//chdir("romfs:/.dummy");
//chdir("romfs:/");
margs.window = MultiSpacc_SetWindow( &windowConfig );
margs.screen = MultiSpacc_GetWindowSurface( margs.window );
@ -99,7 +105,7 @@ int main( int argc, char *argv[] )
// Bitmap font forked from: <https://github.com/nesdoug/01_Hello/blob/master/Alpha.chr>
// Original copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT)
margs.tilesImg = MultiSpacc_LoadImage( "../CHARS.png", margs.screen, NULL );
margs.tilesImg = MultiSpacc_LoadImage( "./Assets/CHARS.png", margs.background, NULL );
if( margs.tilesImg == NULL )
{
return -1;