mirror of
				https://gitlab.com/octospacc/MultiSpaccSDK
				synced 2025-06-05 22:09:21 +02:00 
			
		
		
		
	Upload stale local changes (MultiSpacc_PrintString)
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1,3 @@ | |||||||
| *.o | *.o | ||||||
|  | *.exe | ||||||
|  | *.run | ||||||
|   | |||||||
| @@ -22,23 +22,26 @@ int main( int argc, char *args[] ) | |||||||
| 	// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT) | 	// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT) | ||||||
| 	MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL ); | 	MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL ); | ||||||
|  |  | ||||||
| 	const char Text[] = "Hello, World!"; | 	/*char Text[] = "Hello, World!"; | ||||||
| 	for(int i = 0; i < sizeof(Text); i++){ | 	for(int i = 0; i < sizeof( Text ); i++){ | ||||||
| 		SDL_Rect Offset = { | 		MultiSpacc_Rect Offset = { | ||||||
| 			.x = (8 * i) + (ScreenWidth / sizeof(Text)), | 			.x = (8 * i) + (ScreenWidth / sizeof( Text )), | ||||||
| 			.y = ScreenHeight / 3, | 			.y = ScreenHeight / 3, | ||||||
| 		}; | 		}; | ||||||
| 		SDL_Rect Clip = { | 		MultiSpacc_Rect Clip = { | ||||||
| 			.x = 8 * ((int)Text[i] % 16), | 			.x = 8 * (Text[i] % 16), | ||||||
| 			.y = 8 * ((int)Text[i] / 16), | 			.y = 8 * (Text[i] / 16), | ||||||
| 			.w = 8, | 			.w = 8, | ||||||
| 			.h = 8, | 			.h = 8, | ||||||
| 		}; | 		}; | ||||||
| 		SDL_BlitSurface( TilesImg, &Clip, Screen, &Offset ); | 		SDL_BlitSurface( TilesImg, &Clip, Screen, &Offset ); | ||||||
| 	}; | 	};*/ | ||||||
|  | 	MultiSpacc_PrintString( "Hello, World!", Screen, ScreenWidth, ScreenHeight, 4, 4, TilesImg ); | ||||||
|  |  | ||||||
| 	if( MultiSpacc_UpdateWindowSurface( Window ) != 0 ) { | 	if( MultiSpacc_UpdateWindowSurface( Window ) != 0 ) | ||||||
|  | 	{ | ||||||
| 		printf("[E] Error updating Screen.\n"); | 		printf("[E] Error updating Screen.\n"); | ||||||
|  | 		return -1; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	MultiSpacc_Sleep( 3000 ); | 	MultiSpacc_Sleep( 3000 ); | ||||||
|   | |||||||
| @@ -22,3 +22,5 @@ MultiSpacc_Surface *MultiSpacc_LoadImage( char FilePath[], MultiSpacc_Surface *S | |||||||
| int MultiSpacc_SetColorKey( MultiSpacc_Surface *Surface, bool Flag, Uint32 Key ); | int MultiSpacc_SetColorKey( MultiSpacc_Surface *Surface, bool Flag, Uint32 Key ); | ||||||
|  |  | ||||||
| int MultiSpacc_PollEvent( MultiSpacc_Event *Event ); | int MultiSpacc_PollEvent( MultiSpacc_Event *Event ); | ||||||
|  |  | ||||||
|  | void MultiSpacc_PrintString( char Text[], MultiSpacc_Surface *Surface, int ScreenWidth, int ScreenHeight, int x, int y, MultiSpacc_Surface *Tiles /*, int FontSize, int Color */ ); // WIP | ||||||
|   | |||||||
| @@ -31,3 +31,22 @@ MultiSpacc_Surface *MultiSpacc_LoadImage( char FilePath[], MultiSpacc_Surface *S | |||||||
| 	}; | 	}; | ||||||
| 	return Final; | 	return Final; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | void MultiSpacc_PrintString( char Text[], MultiSpacc_Surface *Surface, int ScreenWidth, int ScreenHeight, int x, int y, MultiSpacc_Surface *Tiles /*, int FontSize, int Color */ ) | ||||||
|  | { | ||||||
|  | 	for(int i = 0; i < strlen( Text ); i++) | ||||||
|  | 	//while(*(Text++)) | ||||||
|  | 	{ | ||||||
|  | 		MultiSpacc_Rect Offset = { | ||||||
|  | 			.x = (x * 8) + (8 * i), | ||||||
|  | 			.y = (y * 8), | ||||||
|  | 		}; | ||||||
|  | 		MultiSpacc_Rect Clip = { | ||||||
|  | 			.x = 8 * (Text[i] % 16), | ||||||
|  | 			.y = 8 * (Text[i] / 16), | ||||||
|  | 			.w = 8, | ||||||
|  | 			.h = 8, | ||||||
|  | 		}; | ||||||
|  | 		SDL_BlitSurface( Tiles, &Clip, Surface, &Offset ); | ||||||
|  | 	}; | ||||||
|  | }; | ||||||
|   | |||||||
| @@ -6,3 +6,4 @@ | |||||||
| #define MultiSpacc_Surface SDL_Surface | #define MultiSpacc_Surface SDL_Surface | ||||||
| #define MultiSpacc_GetTicks SDL_GetTicks | #define MultiSpacc_GetTicks SDL_GetTicks | ||||||
| #define MultiSpacc_Sleep SDL_Delay | #define MultiSpacc_Sleep SDL_Delay | ||||||
|  | #define MultiSpacc_Rect SDL_Rect | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user