2023-10-31 18:06:39 +01:00
# include "./MultiSpacc.h"
2023-11-14 18:51:12 +01:00
void MultiSpacc_PrintText ( char text [ ] , MultiSpacc_Surface * Surface , MultiSpacc_SurfaceConfig * surfaceConfig , int x , int y , MultiSpacc_Surface * Tiles /*, int FontSize, int Color */ )
2023-10-31 18:06:39 +01:00
{
2023-11-14 18:51:12 +01:00
# if defined(MultiSpacc_Target_SDLCommon)
2023-11-08 23:46:18 +01:00
/* TODO: not just 8x8 tiles, and account for surface dimensions */
2023-11-14 18:51:12 +01:00
for ( int i = 0 ; i < strlen ( text ) ; i + + )
2023-10-31 18:06:39 +01:00
{
2023-11-14 18:51:12 +01:00
MultiSpacc_Rect offset = {
. x = 8 * x + 8 * i ,
. y = 8 * y ,
2023-10-31 18:06:39 +01:00
} ;
2023-11-14 18:51:12 +01:00
MultiSpacc_Rect clip = {
. x = 8 * ( text [ i ] % 16 ) ,
. y = 8 * ( text [ i ] / 16 ) ,
2023-10-31 18:06:39 +01:00
. w = 8 ,
. h = 8 ,
} ;
2023-11-14 18:51:12 +01:00
SDL_BlitSurface ( Tiles , & clip , Surface , & offset ) ;
2023-10-31 18:06:39 +01:00
} ;
2023-11-14 18:51:12 +01:00
# elif defined(MultiSpacc_Target_NDS)
iprintf ( " \x1b [%d;%dH%s " , y , x , text ) ;
2023-11-01 13:58:22 +01:00
2023-11-14 18:51:12 +01:00
# elif defined(MultiSpacc_Target_NES)
// NOTE: is there no alternative to ppu off and on there? it makes the screen flicker and so makes programming more difficult
2023-11-01 13:58:22 +01:00
ppu_off ( ) ;
vram_adr ( NTADR_A ( x , y ) ) ;
2023-11-14 18:51:12 +01:00
vram_write ( text , strlen ( text ) ) ;
2023-11-01 13:58:22 +01:00
ppu_on_all ( ) ;
2023-11-14 18:51:12 +01:00
2023-11-01 13:58:22 +01:00
# endif
2023-10-31 18:06:39 +01:00
}
void MultiSpacc_PrintDebug ( const char * format , . . . )
{
# ifdef MultiSpacc_Target_SDLCom
va_list args ;
2023-11-06 23:23:22 +01:00
va_start ( args , format ) ;
2023-11-08 23:46:18 +01:00
SDL_Log ( format , args ) ;
va_end ( args ) ;
2023-10-31 18:06:39 +01:00
# endif
}