mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	BREAKING CHANGE: Renamed SpriteFont type to Font
- Preparing MP3 files support - Jumped version to raylib 2.0-dev (too many breaking changes...)
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| /******************************************************************************************* | ||||
| * | ||||
| *   raylib [text] example - BMFont and TTF SpriteFonts loading | ||||
| *   raylib [text] example - BMFont and TTF Fonts loading | ||||
| * | ||||
| *   This example has been created using raylib 1.4 (www.raylib.com) | ||||
| *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | ||||
| @@ -24,8 +24,8 @@ int main() | ||||
|     const char msgTtf[64] = "THIS SPRITE FONT has been GENERATED from a TTF"; | ||||
|  | ||||
|     // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) | ||||
|     SpriteFont fontBm = LoadSpriteFont("resources/bmfont.fnt");       // BMFont (AngelCode) | ||||
|     SpriteFont fontTtf = LoadSpriteFont("resources/pixantiqua.ttf");  // TTF font | ||||
|     Font fontBm = LoadFont("resources/bmfont.fnt");       // BMFont (AngelCode) | ||||
|     Font fontTtf = LoadFont("resources/pixantiqua.ttf");  // TTF font | ||||
|  | ||||
|     Vector2 fontPosition; | ||||
|  | ||||
| @@ -58,8 +58,8 @@ int main() | ||||
|  | ||||
|     // De-Initialization | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|     UnloadSpriteFont(fontBm);     // AngelCode SpriteFont unloading | ||||
|     UnloadSpriteFont(fontTtf);    // TTF SpriteFont unloading | ||||
|     UnloadFont(fontBm);     // AngelCode Font unloading | ||||
|     UnloadFont(fontTtf);    // TTF Font unloading | ||||
|  | ||||
|     CloseWindow();                // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -25,7 +25,7 @@ int main() | ||||
|     const char msg[256] = "ASCII extended characters:\n¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆ\nÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ\nçèéêëìíîïðñòóôõö÷øùúûüýþÿ"; | ||||
|  | ||||
|     // NOTE: Loaded font has an unordered list of characters (chars in the range 32..255) | ||||
|     SpriteFont font = LoadSpriteFont("resources/pixantiqua.fnt");       // BMFont (AngelCode) | ||||
|     Font font = LoadFont("resources/pixantiqua.fnt");       // BMFont (AngelCode) | ||||
|  | ||||
|     SetTargetFPS(60); | ||||
|     //-------------------------------------------------------------------------------------- | ||||
| @@ -56,7 +56,7 @@ int main() | ||||
|  | ||||
|     // De-Initialization | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|     UnloadSpriteFont(font);     // AngelCode SpriteFont unloading | ||||
|     UnloadFont(font);     // AngelCode Font unloading | ||||
|      | ||||
|     CloseWindow();                // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -26,16 +26,16 @@ int main() | ||||
|     InitWindow(screenWidth, screenHeight, "raylib [text] example - raylib fonts"); | ||||
|  | ||||
|     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) | ||||
|     SpriteFont fonts[MAX_FONTS]; | ||||
|     Font fonts[MAX_FONTS]; | ||||
|      | ||||
|     fonts[0] = LoadSpriteFont("resources/fonts/alagard.png"); | ||||
|     fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.png"); | ||||
|     fonts[2] = LoadSpriteFont("resources/fonts/mecha.png"); | ||||
|     fonts[3] = LoadSpriteFont("resources/fonts/setback.png"); | ||||
|     fonts[4] = LoadSpriteFont("resources/fonts/romulus.png"); | ||||
|     fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.png"); | ||||
|     fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.png"); | ||||
|     fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.png"); | ||||
|     fonts[0] = LoadFont("resources/fonts/alagard.png"); | ||||
|     fonts[1] = LoadFont("resources/fonts/pixelplay.png"); | ||||
|     fonts[2] = LoadFont("resources/fonts/mecha.png"); | ||||
|     fonts[3] = LoadFont("resources/fonts/setback.png"); | ||||
|     fonts[4] = LoadFont("resources/fonts/romulus.png"); | ||||
|     fonts[5] = LoadFont("resources/fonts/pixantiqua.png"); | ||||
|     fonts[6] = LoadFont("resources/fonts/alpha_beta.png"); | ||||
|     fonts[7] = LoadFont("resources/fonts/jupiter_crash.png"); | ||||
|      | ||||
|     const char *messages[MAX_FONTS] = { "ALAGARD FONT designed by Hewett Tsoi",  | ||||
|                                 "PIXELPLAY FONT designed by Aleksander Shevchuk", | ||||
| @@ -93,8 +93,8 @@ int main() | ||||
|     // De-Initialization | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|      | ||||
|     // SpriteFonts unloading | ||||
|     for (int i = 0; i < MAX_FONTS; i++) UnloadSpriteFont(fonts[i]); | ||||
|     // Fonts unloading | ||||
|     for (int i = 0; i < MAX_FONTS; i++) UnloadFont(fonts[i]); | ||||
|  | ||||
|     CloseWindow();                 // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /******************************************************************************************* | ||||
| * | ||||
| *   raylib [text] example - SpriteFont loading and usage | ||||
| *   raylib [text] example - Font loading and usage | ||||
| * | ||||
| *   This example has been created using raylib 1.0 (www.raylib.com) | ||||
| *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | ||||
| @@ -25,9 +25,9 @@ int main() | ||||
|     const char msg3[50] = "...and a THIRD one! GREAT! :D"; | ||||
|  | ||||
|     // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) | ||||
|     SpriteFont font1 = LoadSpriteFont("resources/custom_mecha.png");          // SpriteFont loading | ||||
|     SpriteFont font2 = LoadSpriteFont("resources/custom_alagard.png");        // SpriteFont loading | ||||
|     SpriteFont font3 = LoadSpriteFont("resources/custom_jupiter_crash.png");  // SpriteFont loading | ||||
|     Font font1 = LoadFont("resources/custom_mecha.png");          // Font loading | ||||
|     Font font2 = LoadFont("resources/custom_alagard.png");        // Font loading | ||||
|     Font font3 = LoadFont("resources/custom_jupiter_crash.png");  // Font loading | ||||
|  | ||||
|     Vector2 fontPosition1, fontPosition2, fontPosition3; | ||||
|  | ||||
| @@ -66,9 +66,9 @@ int main() | ||||
|  | ||||
|     // De-Initialization | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|     UnloadSpriteFont(font1);      // SpriteFont unloading | ||||
|     UnloadSpriteFont(font2);      // SpriteFont unloading | ||||
|     UnloadSpriteFont(font3);      // SpriteFont unloading | ||||
|     UnloadFont(font1);      // Font unloading | ||||
|     UnloadFont(font2);      // Font unloading | ||||
|     UnloadFont(font3);      // Font unloading | ||||
|  | ||||
|     CloseWindow();                // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -20,12 +20,12 @@ int main() | ||||
|  | ||||
|     InitWindow(screenWidth, screenHeight, "raylib [text] example - ttf loading"); | ||||
|      | ||||
|     const char msg[50] = "TTF SpriteFont"; | ||||
|     const char msg[50] = "TTF Font"; | ||||
|  | ||||
|     // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) | ||||
|      | ||||
|     // TTF SpriteFont loading with custom generation parameters | ||||
|     SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 96, 0, 0); | ||||
|     // TTF Font loading with custom generation parameters | ||||
|     Font font = LoadFontEx("resources/KAISG.ttf", 96, 0, 0); | ||||
|      | ||||
|     // Generate mipmap levels to use trilinear filtering | ||||
|     // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR | ||||
| @@ -85,8 +85,8 @@ int main() | ||||
|              | ||||
|             if (count == 1) // Only support one ttf file dropped | ||||
|             { | ||||
|                 UnloadSpriteFont(font); | ||||
|                 font = LoadSpriteFontEx(droppedFiles[0], fontSize, 0, 0); | ||||
|                 UnloadFont(font); | ||||
|                 font = LoadFontEx(droppedFiles[0], fontSize, 0, 0); | ||||
|                 ClearDroppedFiles(); | ||||
|             } | ||||
|         } | ||||
| @@ -127,7 +127,7 @@ int main() | ||||
| #if defined(PLATFORM_DESKTOP) | ||||
|     ClearDroppedFiles();        // Clear internal buffers | ||||
| #endif | ||||
|     UnloadSpriteFont(font);     // SpriteFont unloading | ||||
|     UnloadFont(font);     // Font unloading | ||||
|      | ||||
|     CloseWindow();              // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -38,12 +38,12 @@ int main() | ||||
|     UnloadImage(cat);       // Unload image from RAM | ||||
|      | ||||
|     // Load custom font for frawing on image | ||||
|     SpriteFont font = LoadSpriteFont("resources/custom_jupiter_crash.png"); | ||||
|     Font font = LoadFont("resources/custom_jupiter_crash.png"); | ||||
|      | ||||
|     // Draw over image using custom font | ||||
|     ImageDrawTextEx(&parrots, (Vector2){ 300, 230 }, font, "PARROTS & CAT", font.baseSize, -2, WHITE); | ||||
|      | ||||
|     UnloadSpriteFont(font); // Unload custom spritefont (already drawn used on image) | ||||
|     UnloadFont(font); // Unload custom spritefont (already drawn used on image) | ||||
|  | ||||
|     Texture2D texture = LoadTextureFromImage(parrots);      // Image converted to texture, uploaded to GPU memory (VRAM) | ||||
|     UnloadImage(parrots);   // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM | ||||
|   | ||||
| @@ -20,8 +20,8 @@ int main() | ||||
|  | ||||
|     InitWindow(screenWidth, screenHeight, "raylib [texture] example - image text drawing"); | ||||
|      | ||||
|     // TTF SpriteFont loading with custom generation parameters | ||||
|     SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 64, 0, 0); | ||||
|     // TTF Font loading with custom generation parameters | ||||
|     Font font = LoadFontEx("resources/KAISG.ttf", 64, 0, 0); | ||||
|      | ||||
|     Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM) | ||||
|  | ||||
| @@ -74,7 +74,7 @@ int main() | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|     UnloadTexture(texture);     // Texture unloading | ||||
|          | ||||
|     UnloadSpriteFont(font);     // Unload custom spritefont | ||||
|     UnloadFont(font);     // Unload custom spritefont | ||||
|      | ||||
|     CloseWindow();              // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -49,7 +49,7 @@ int main() | ||||
|     Texture2D gframe = LoadTexture("resources/gframe.png"); | ||||
|      | ||||
|     // Load game resources: fonts | ||||
|     SpriteFont font = LoadSpriteFont("resources/komika.png"); | ||||
|     Font font = LoadFont("resources/komika.png"); | ||||
|  | ||||
|     // Define scrolling variables | ||||
|     int backScrolling = 0; | ||||
| @@ -438,7 +438,7 @@ int main() | ||||
|     UnloadTexture(gamera); | ||||
|      | ||||
|     // Unload font texture | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|      | ||||
|     CloseWindow();          // Close window and OpenGL context | ||||
|     //-------------------------------------------------------------------------------------- | ||||
|   | ||||
| @@ -52,7 +52,7 @@ int main() | ||||
|     Texture2D gframe = LoadTexture("resources/gframe.png"); | ||||
|      | ||||
|     // Load game resources: fonts | ||||
|     SpriteFont font = LoadSpriteFont("resources/komika.png"); | ||||
|     Font font = LoadFont("resources/komika.png"); | ||||
|      | ||||
|     // Load game resources: sounds | ||||
|     Sound eat = LoadSound("resources/eat.wav"); | ||||
| @@ -454,7 +454,7 @@ int main() | ||||
|     UnloadTexture(gamera); | ||||
|      | ||||
|     // Unload font texture | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|      | ||||
|     // Unload sounds | ||||
|     UnloadSound(eat); | ||||
|   | ||||
| @@ -55,7 +55,7 @@ int main() | ||||
|     Texture2D gframe = LoadTexture("resources/gframe.png"); | ||||
|      | ||||
|     // Load game resources: fonts | ||||
|     SpriteFont font = LoadSpriteFont("resources/komika.png"); | ||||
|     Font font = LoadFont("resources/komika.png"); | ||||
|      | ||||
|     // Load game resources: sounds | ||||
|     Sound eat = LoadSound("resources/eat.wav"); | ||||
| @@ -479,7 +479,7 @@ int main() | ||||
|     UnloadTexture(gamera); | ||||
|      | ||||
|     // Unload font texture | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|      | ||||
|     // Unload sounds | ||||
|     UnloadSound(eat); | ||||
|   | ||||
| @@ -48,7 +48,7 @@ Texture2D swhale; | ||||
| Texture2D fish; | ||||
| Texture2D gframe; | ||||
|  | ||||
| SpriteFont font; | ||||
| Font font; | ||||
|  | ||||
| Sound eat; | ||||
| Sound die; | ||||
| @@ -119,7 +119,7 @@ int main() | ||||
|     gframe = LoadTexture("resources/gframe.png"); | ||||
|      | ||||
|     // Load game resources: fonts | ||||
|     font = LoadSpriteFont("resources/komika.png"); | ||||
|     font = LoadFont("resources/komika.png"); | ||||
|      | ||||
|     // Load game resources: sounds | ||||
|     eat = LoadSound("resources/eat.wav"); | ||||
| @@ -186,7 +186,7 @@ int main() | ||||
|     UnloadTexture(gamera); | ||||
|      | ||||
|     // Unload font texture | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|      | ||||
|     // Unload sounds | ||||
|     UnloadSound(eat); | ||||
|   | ||||
| @@ -57,7 +57,7 @@ int main(void) { | ||||
|     InitWindow(screenWidth, screenHeight, windowTitle); | ||||
|  | ||||
|     // Load global data here (assets that must be available in all screens, i.e. fonts) | ||||
|     font = LoadSpriteFont("resources/graphics/mainfont.png"); | ||||
|     font = LoadFont("resources/graphics/mainfont.png"); | ||||
|  | ||||
|     atlas01 = LoadTexture("resources/graphics/atlas01.png"); | ||||
|     atlas02 = LoadTexture("resources/graphics/atlas02.png"); | ||||
| @@ -114,7 +114,7 @@ int main(void) { | ||||
|      | ||||
|     UnloadTexture(atlas01); | ||||
|     UnloadTexture(atlas02); | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|      | ||||
|     UnloadShader(colorBlend);   // Unload color overlay blending shader | ||||
|      | ||||
|   | ||||
| @@ -42,7 +42,7 @@ typedef enum GameScreen { LOGO, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScreen; | ||||
| GameScreen currentScreen; | ||||
|  | ||||
| // NOTE: This is all the data used in the game | ||||
| SpriteFont font; | ||||
| Font font; | ||||
| Shader colorBlend; | ||||
| Texture2D atlas01; | ||||
| Texture2D atlas02; | ||||
|   | ||||
| @@ -68,7 +68,7 @@ int main(void) | ||||
|      | ||||
|     UnloadImage(image);                         // Unload image from CPU memory (RAM) | ||||
|      | ||||
|     font = LoadSpriteFont("resources/font_arcadian.png"); | ||||
|     font = LoadFont("resources/font_arcadian.png"); | ||||
| 	//doors = LoadTexture("resources/textures/doors.png"); | ||||
|     //sndDoor = LoadSound("resources/audio/door.ogg"); | ||||
|      | ||||
| @@ -106,7 +106,7 @@ int main(void) | ||||
|     } | ||||
|      | ||||
|     // Unload all global loaded data (i.e. fonts) here! | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|     //UnloadSound(sndDoor); | ||||
|      | ||||
|     UnloadMusicStream(music); | ||||
|   | ||||
| @@ -35,7 +35,7 @@ typedef enum GameScreen { LOGO_RL = 0, TITLE, GAMEPLAY } GameScreen; | ||||
| // Global Variables Definition | ||||
| //---------------------------------------------------------------------------------- | ||||
| GameScreen currentScreen; | ||||
| SpriteFont font; | ||||
| Font font; | ||||
|  | ||||
| Color *lightsMap; | ||||
| int lightsMapWidth, lightsMapHeight; | ||||
|   | ||||
| @@ -47,7 +47,7 @@ typedef struct Door { | ||||
| // Global Variables Definition | ||||
| //---------------------------------------------------------------------------------- | ||||
| GameScreen currentScreen; | ||||
| SpriteFont font; | ||||
| Font font; | ||||
|  | ||||
| Texture2D doors; | ||||
| Sound sndDoor; | ||||
|   | ||||
| @@ -60,7 +60,7 @@ int main(void) | ||||
|     music = LoadMusicStream("resources/audio/come_play_with_me.ogg"); | ||||
|     PlayMusicStream(music); | ||||
|      | ||||
|     font = LoadSpriteFont("resources/textures/alagard.png"); | ||||
|     font = LoadFont("resources/textures/alagard.png"); | ||||
| 	doors = LoadTexture("resources/textures/doors.png"); | ||||
|     sndDoor = LoadSound("resources/audio/door.ogg"); | ||||
|     sndScream = LoadSound("resources/audio/scream.ogg"); | ||||
| @@ -89,7 +89,7 @@ int main(void) | ||||
|      | ||||
|     // Unload all global loaded data (i.e. fonts) here! | ||||
| 	UnloadPlayer(); | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|     UnloadTexture(doors); | ||||
|     UnloadSound(sndDoor); | ||||
|     UnloadSound(sndScream); | ||||
|   | ||||
| @@ -68,7 +68,7 @@ static Mission *missions = NULL; | ||||
|  | ||||
| static char headline[MAX_TITLE_CHAR] = "\0"; | ||||
|  | ||||
| SpriteFont fontNews; | ||||
| Font fontNews; | ||||
|  | ||||
| // String (const char *) replacement function | ||||
| static char *StringReplace(char *orig, char *rep, char *with); | ||||
| @@ -121,11 +121,11 @@ void InitEndingScreen(void) | ||||
|      | ||||
|     // Generate newspaper with title and subtitle | ||||
|     Image imNewspaper = LoadImage("resources/textures/ending_newspaper.png"); | ||||
|     fontNews = LoadSpriteFontEx("resources/fonts/Lora-Bold.ttf", 32, 250, 0); | ||||
|     fontNews = LoadFontEx("resources/fonts/Lora-Bold.ttf", 32, 250, 0); | ||||
|     ImageDrawTextEx(&imNewspaper, (Vector2){ 50, 220 }, fontNews, headline, fontNews.baseSize, 0, DARKGRAY); | ||||
|      | ||||
|     texNewspaper = LoadTextureFromImage(imNewspaper); | ||||
|     //UnloadSpriteFont(fontNews); | ||||
|     //UnloadFont(fontNews); | ||||
|     UnloadImage(imNewspaper); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -95,7 +95,7 @@ static int framesCounter; | ||||
| static int finishScreen; | ||||
|  | ||||
| static Texture2D texBackground; | ||||
| static SpriteFont fontMessage; | ||||
| static Font fontMessage; | ||||
| static Texture2D texWordsAtlas; | ||||
| static Texture2D texVignette; | ||||
|  | ||||
| @@ -126,7 +126,7 @@ void InitGameplayScreen(void) | ||||
|     framesCounter = 0; | ||||
|     finishScreen = 0; | ||||
|      | ||||
|     fontMessage = LoadSpriteFontEx("resources/fonts/traveling_typewriter.ttf", 30, 250, 0); | ||||
|     fontMessage = LoadFontEx("resources/fonts/traveling_typewriter.ttf", 30, 250, 0); | ||||
|      | ||||
|     texBackground = LoadTexture("resources/textures/message_background.png"); | ||||
|     texVignette = LoadTexture("resources/textures/message_vignette.png"); | ||||
|   | ||||
| @@ -36,7 +36,7 @@ static int framesCounter; | ||||
| static int finishScreen; | ||||
|  | ||||
| static Texture2D texBackground; | ||||
| static SpriteFont fontTitle; | ||||
| static Font fontTitle; | ||||
| static Sound fxTyping; | ||||
|  | ||||
| static float titleSize; | ||||
| @@ -71,7 +71,7 @@ void InitTitleScreen(void) | ||||
|      | ||||
|     texBackground = LoadTexture("resources/textures/title_background.png"); | ||||
|     fxTyping = LoadSound("resources/audio/fx_typing.ogg"); | ||||
|     fontTitle = LoadSpriteFontEx("resources/fonts/mom_typewritter.ttf", 96, 0, 0); | ||||
|     fontTitle = LoadFontEx("resources/fonts/mom_typewritter.ttf", 96, 0, 0); | ||||
|      | ||||
|     titleSize = 44; | ||||
|     transmissionPosition = (Vector2){519, 221}; | ||||
| @@ -148,7 +148,7 @@ void UnloadTitleScreen(void) | ||||
| { | ||||
|     UnloadTexture(texBackground); | ||||
|     UnloadSound(fxTyping); | ||||
|     UnloadSpriteFont(fontTitle); | ||||
|     UnloadFont(fontTitle); | ||||
| } | ||||
|  | ||||
| // Title Screen should finish? | ||||
|   | ||||
| @@ -76,7 +76,7 @@ Color textColorButton; | ||||
| int currentMission; | ||||
| int totalMissions; | ||||
|  | ||||
| SpriteFont fontMission; | ||||
| Font fontMission; | ||||
|  | ||||
| Word messageWords[MAX_MISSION_WORDS]; | ||||
|  | ||||
|   | ||||
| @@ -70,7 +70,7 @@ int main(void) | ||||
|     SetMusicVolume(music, 1.0f); | ||||
|     PlayMusicStream(music); | ||||
|      | ||||
|     fontMission = LoadSpriteFontEx("resources/fonts/traveling_typewriter.ttf", 64, 250, 0); | ||||
|     fontMission = LoadFontEx("resources/fonts/traveling_typewriter.ttf", 64, 250, 0); | ||||
|     texButton = LoadTexture("resources/textures/title_ribbon.png"); | ||||
|      | ||||
| 	// UI BUTTON | ||||
| @@ -122,7 +122,7 @@ int main(void) | ||||
|     UnloadMusicStream(music); | ||||
|     UnloadSound(fxButton); | ||||
|      | ||||
|     UnloadSpriteFont(fontMission); | ||||
|     UnloadFont(fontMission); | ||||
|     UnloadTexture(texButton); | ||||
| 	 | ||||
|     CloseAudioDevice();     // Close audio context | ||||
|   | ||||
| @@ -35,7 +35,7 @@ typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen; | ||||
| // Global Variables Definition | ||||
| //---------------------------------------------------------------------------------- | ||||
| GameScreen currentScreen; | ||||
| SpriteFont font; | ||||
| Font font; | ||||
| Music music; | ||||
| int endingStatus;       // 1 - Win, 2 - Lose | ||||
|  | ||||
|   | ||||
| @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) | ||||
|     // Global data loading (assets that must be available in all screens, i.e. fonts) | ||||
|     InitAudioDevice(); | ||||
|  | ||||
|     font = LoadSpriteFont("resources/font.fnt"); | ||||
|     font = LoadFont("resources/font.fnt"); | ||||
|     music = LoadMusicStream("resources/audio/wave.ogg"); | ||||
|      | ||||
|     SetMusicVolume(music, 1.0f); | ||||
| @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) | ||||
|     } | ||||
|      | ||||
|     // Unload all global loaded data (i.e. fonts) here! | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|     UnloadMusicStream(music); | ||||
|  | ||||
|     CloseAudioDevice();     // Close audio context | ||||
|   | ||||
| @@ -1,14 +1,12 @@ | ||||
| /********************************************************************************************** | ||||
| * | ||||
| *   raylib v1.9.6-dev | ||||
| * | ||||
| *   A simple and easy-to-use library to learn videogames programming (www.raylib.com) | ||||
| *   raylib - A simple and easy-to-use library to learn videogames programming (www.raylib.com) | ||||
| * | ||||
| *   FEATURES: | ||||
| *       - Written in plain C code (C99) in PascalCase/camelCase notation | ||||
| *       - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile) | ||||
| *       - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] | ||||
| *       - Powerful fonts module with SpriteFonts support (XNA fonts, AngelCode fonts, TTF) | ||||
| *       - Powerful fonts module with Fonts support (XNA fonts, AngelCode fonts, TTF) | ||||
| *       - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC) | ||||
| *       - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more! | ||||
| *       - Flexible Materials system, supporting classic maps and PBR maps | ||||
| @@ -138,6 +136,9 @@ | ||||
| #define KEY_RIGHT_SHIFT     344 | ||||
| #define KEY_RIGHT_CONTROL   345 | ||||
| #define KEY_RIGHT_ALT       346 | ||||
| #define KEY_GRAVE            96 | ||||
| #define KEY_SLASH            47 | ||||
| #define KEY_BACKSLASH        92 | ||||
|  | ||||
| // Keyboard Alpha Numeric Keys | ||||
| #define KEY_ZERO             48 | ||||
| @@ -189,7 +190,7 @@ | ||||
| #define MOUSE_MIDDLE_BUTTON   2 | ||||
|  | ||||
| // Touch points registered | ||||
| #define MAX_TOUCH_POINTS     2 | ||||
| #define MAX_TOUCH_POINTS      2 | ||||
|  | ||||
| // Gamepad Number | ||||
| #define GAMEPAD_PLAYER1       0 | ||||
| @@ -348,10 +349,10 @@ typedef struct Color { | ||||
|  | ||||
| // Rectangle type | ||||
| typedef struct Rectangle { | ||||
|     int x; | ||||
|     int y; | ||||
|     int width; | ||||
|     int height; | ||||
|     float x; | ||||
|     float y; | ||||
|     float width; | ||||
|     float height; | ||||
| } Rectangle; | ||||
|  | ||||
| // Image type, bpp always RGBA (32bit) | ||||
| @@ -381,7 +382,7 @@ typedef struct RenderTexture2D { | ||||
|     Texture2D depth;        // Depth buffer attachment texture | ||||
| } RenderTexture2D; | ||||
|  | ||||
| // SpriteFont character info | ||||
| // Font character info | ||||
| typedef struct CharInfo { | ||||
|     int value;              // Character value (Unicode) | ||||
|     Rectangle rec;          // Character rectangle in sprite font | ||||
| @@ -390,28 +391,26 @@ typedef struct CharInfo { | ||||
|     int advanceX;           // Character advance position X | ||||
| } CharInfo; | ||||
|  | ||||
| // SpriteFont type, includes texture and charSet array data | ||||
| typedef struct SpriteFont { | ||||
| // Font type, includes texture and charSet array data | ||||
| typedef struct Font { | ||||
|     Texture2D texture;      // Font texture | ||||
|     int baseSize;           // Base size (default chars height) | ||||
|     int charsCount;         // Number of characters | ||||
|     CharInfo *chars;        // Characters info data | ||||
| } SpriteFont; | ||||
| } Font; | ||||
|  | ||||
| // Camera projection modes | ||||
| typedef enum { | ||||
|     CAMERA_PERSPECTIVE = 0, | ||||
|     CAMERA_ORTHOGRAPHIC | ||||
| } CameraType; | ||||
| #define SpriteFont  Font    // SpriteFont type fallback, defaults to Font | ||||
|  | ||||
| // Camera type, defines a camera position/orientation in 3d space | ||||
| typedef struct Camera { | ||||
| typedef struct Camera3D { | ||||
|     Vector3 position;       // Camera position | ||||
|     Vector3 target;         // Camera target it looks-at | ||||
|     Vector3 up;             // Camera up vector (rotation over its axis) | ||||
|     float fovy;             // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic | ||||
|     CameraType type;        // Camera type, controlling projection type, either CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC. | ||||
| } Camera; | ||||
|     int type;               // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC | ||||
| } Camera3D; | ||||
|  | ||||
| #define Camera  Camera3D    // Camera type fallback, defaults to Camera3D | ||||
|  | ||||
| // Camera2D type, defines a 2d camera | ||||
| typedef struct Camera2D { | ||||
| @@ -675,6 +674,12 @@ typedef enum { | ||||
|     CAMERA_THIRD_PERSON | ||||
| } CameraMode; | ||||
|  | ||||
| // Camera projection modes | ||||
| typedef enum { | ||||
|     CAMERA_PERSPECTIVE = 0, | ||||
|     CAMERA_ORTHOGRAPHIC | ||||
| } CameraType; | ||||
|  | ||||
| // Head Mounted Display devices | ||||
| typedef enum { | ||||
|     HMD_DEFAULT_DEVICE = 0, | ||||
| @@ -725,15 +730,15 @@ RLAPI void DisableCursor(void);                                   // Disables cu | ||||
| RLAPI void ClearBackground(Color color);                          // Set background color (framebuffer clear color) | ||||
| RLAPI void BeginDrawing(void);                                    // Setup canvas (framebuffer) to start drawing | ||||
| RLAPI void EndDrawing(void);                                      // End canvas drawing and swap buffers (double buffering) | ||||
| RLAPI void Begin2dMode(Camera2D camera);                          // Initialize 2D mode with custom camera (2D) | ||||
| RLAPI void End2dMode(void);                                       // Ends 2D mode with custom camera | ||||
| RLAPI void Begin3dMode(Camera camera);                            // Initializes 3D mode with custom camera (3D) | ||||
| RLAPI void End3dMode(void);                                       // Ends 3D mode and returns to default 2D orthographic mode | ||||
| RLAPI void BeginMode2D(Camera2D camera);                          // Initialize 2D mode with custom camera (2D) | ||||
| RLAPI void EndMode2D(void);                                       // Ends 2D mode with custom camera | ||||
| RLAPI void BeginMode3D(Camera3D camera);                          // Initializes 3D mode with custom camera (3D) | ||||
| RLAPI void EndMode3D(void);                                       // Ends 3D mode and returns to default 2D orthographic mode | ||||
| RLAPI void BeginTextureMode(RenderTexture2D target);              // Initializes render texture for drawing | ||||
| RLAPI void EndTextureMode(void);                                  // Ends drawing to render texture | ||||
|  | ||||
| // Screen-space-related functions | ||||
| RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera);            // Returns a ray trace from mouse position | ||||
| RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera);      // Returns a ray trace from mouse position | ||||
| RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera);  // Returns the screen space position for a 3d world space position | ||||
| RLAPI Matrix GetCameraMatrix(Camera camera);                      // Returns camera transform matrix (view matrix) | ||||
|  | ||||
| @@ -744,8 +749,8 @@ RLAPI float GetFrameTime(void);                                   // Returns tim | ||||
| RLAPI double GetTime(void);                                       // Returns elapsed time in seconds since InitWindow() | ||||
|  | ||||
| // Color-related functions | ||||
| RLAPI float *ColorToFloat(Color color);                           // Returns normalized float array for a Color | ||||
| RLAPI int ColorToInt(Color color);                                // Returns hexadecimal value for a Color | ||||
| RLAPI Vector4 ColorNormalize(Color color);                        // Returns color normalized as float [0..1] | ||||
| RLAPI Vector3 ColorToHSV(Color color);                            // Returns HSV values for a Color | ||||
| RLAPI Color GetColor(int hexValue);                               // Returns a Color struct from hexadecimal value | ||||
| RLAPI Color Fade(Color color, float alpha);                       // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f | ||||
| @@ -836,9 +841,7 @@ RLAPI void UpdateCamera(Camera *camera);                          // Update came | ||||
| RLAPI void SetCameraPanControl(int panKey);                       // Set camera pan key to combine with mouse movement (free camera) | ||||
| RLAPI void SetCameraAltControl(int altKey);                       // Set camera alt key to combine with mouse movement (free camera) | ||||
| RLAPI void SetCameraSmoothZoomControl(int szKey);                 // Set camera smooth zoom key to combine with mouse (free camera) | ||||
| RLAPI void SetCameraMoveControls(int frontKey, int backKey, | ||||
|                                  int rightKey, int leftKey, | ||||
|                                  int upKey, int downKey);         // Set camera move controls (1st person and 3rd person cameras) | ||||
| RLAPI void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras) | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
| // Basic Shapes Drawing Functions (Module: shapes) | ||||
| @@ -888,6 +891,7 @@ RLAPI Image LoadImage(const char *fileName); | ||||
| RLAPI Image LoadImageEx(Color *pixels, int width, int height);                                           // Load image from Color array data (RGBA - 32bit) | ||||
| RLAPI Image LoadImagePro(void *data, int width, int height, int format);                                 // Load image from raw data with parameters | ||||
| RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize);       // Load image from RAW file data | ||||
| RLAPI void ExportImage(const char *fileName, Image image);                                               // Export image as a PNG file | ||||
| RLAPI Texture2D LoadTexture(const char *fileName);                                                       // Load texture from file into GPU memory (VRAM) | ||||
| RLAPI Texture2D LoadTextureFromImage(Image image);                                                       // Load texture from image data | ||||
| RLAPI RenderTexture2D LoadRenderTexture(int width, int height);                                          // Load texture for rendering (framebuffer) | ||||
| @@ -898,7 +902,6 @@ RLAPI Color *GetImageData(Image image); | ||||
| RLAPI int GetPixelDataSize(int width, int height, int format);                                           // Get pixel data size in bytes (image or texture) | ||||
| RLAPI Image GetTextureData(Texture2D texture);                                                           // Get pixel data from GPU texture and return an Image | ||||
| RLAPI void UpdateTexture(Texture2D texture, const void *pixels);                                         // Update GPU texture with new data | ||||
| RLAPI void SaveImageAs(const char *fileName, Image image);                                               // Save image to a PNG file | ||||
|  | ||||
| // Image manipulation functions | ||||
| RLAPI Image ImageCopy(Image image);                                                                      // Create an image duplicate (useful for transformations) | ||||
| @@ -914,11 +917,11 @@ RLAPI void ImageResizeNN(Image *image,int newWidth,int newHeight); | ||||
| RLAPI void ImageMipmaps(Image *image);                                                                   // Generate all mipmap levels for a provided image | ||||
| RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);                            // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) | ||||
| RLAPI Image ImageText(const char *text, int fontSize, Color color);                                      // Create an image from text (default font) | ||||
| RLAPI Image ImageTextEx(SpriteFont font, const char *text, float fontSize, int spacing, Color tint);     // Create an image from text (custom sprite font) | ||||
| RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint);     // Create an image from text (custom sprite font) | ||||
| RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec);                         // Draw a source image within a destination image | ||||
| RLAPI void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color);                 // Draw rectangle within an image | ||||
| RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color);     // Draw text (default font) within an image (destination) | ||||
| RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text, | ||||
|                            float fontSize, int spacing, Color color);                                    // Draw text (custom sprite font) within an image (destination) | ||||
| RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination) | ||||
| RLAPI void ImageFlipVertical(Image *image);                                                              // Flip image vertically | ||||
| RLAPI void ImageFlipHorizontal(Image *image);                                                            // Flip image horizontally | ||||
| RLAPI void ImageColorTint(Image *image, Color color);                                                    // Modify image color: tint | ||||
| @@ -947,31 +950,30 @@ RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); | ||||
| RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint);                                // Draw a Texture2D with position defined as Vector2 | ||||
| RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint);  // Draw a Texture2D with extended parameters | ||||
| RLAPI void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint);         // Draw a part of a texture defined by a rectangle | ||||
| RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin,     // Draw a part of a texture defined by a rectangle with 'pro' parameters | ||||
|                     float rotation, Color tint); | ||||
| RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters | ||||
|                      | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
| // Font Loading and Text Drawing Functions (Module: text) | ||||
| //------------------------------------------------------------------------------------ | ||||
|  | ||||
| // SpriteFont loading/unloading functions | ||||
| RLAPI SpriteFont GetDefaultFont(void);                                                                   // Get the default SpriteFont | ||||
| RLAPI SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load SpriteFont from file into GPU memory (VRAM) | ||||
| RLAPI SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars);   // Load SpriteFont from file with extended parameters | ||||
| RLAPI void UnloadSpriteFont(SpriteFont font);                                                            // Unload SpriteFont from GPU memory (VRAM) | ||||
| // Font loading/unloading functions | ||||
| RLAPI Font GetDefaultFont(void);                                                                   // Get the default Font | ||||
| RLAPI Font LoadFont(const char *fileName);                                                   // Load Font from file into GPU memory (VRAM) | ||||
| RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars);   // Load Font from file with extended parameters | ||||
| RLAPI void UnloadFont(Font font);                                                            // Unload Font from GPU memory (VRAM) | ||||
|  | ||||
| // Text drawing functions | ||||
| RLAPI void DrawFPS(int posX, int posY);                                                                  // Shows current FPS | ||||
| RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color);                    // Draw text (using default font) | ||||
| RLAPI void DrawTextEx(SpriteFont font, const char* text, Vector2 position,                               // Draw text using SpriteFont and additional parameters | ||||
|                 float fontSize, int spacing, Color tint); | ||||
| RLAPI void DrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using Font and additional parameters | ||||
|  | ||||
| // Text misc. functions | ||||
| RLAPI int MeasureText(const char *text, int fontSize);                                                   // Measure string width for default font | ||||
| RLAPI Vector2 MeasureTextEx(SpriteFont font, const char *text, float fontSize, int spacing);             // Measure string size for SpriteFont | ||||
| RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);           // Measure string size for Font | ||||
| RLAPI const char *FormatText(const char *text, ...);                                                     // Formatting of text with variables to 'embed' | ||||
| RLAPI const char *SubText(const char *text, int position, int length);                                   // Get a piece of a text string | ||||
| RLAPI int GetGlyphIndex(SpriteFont font, int character);                                                 // Returns index position for a unicode character on sprite font | ||||
| RLAPI int GetGlyphIndex(Font font, int character);                                                 // Returns index position for a unicode character on sprite font | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
| // Basic 3d Shapes Drawing Functions (Module: models) | ||||
| @@ -1007,6 +1009,7 @@ RLAPI void UnloadModel(Model model); | ||||
| // Mesh loading/unloading functions | ||||
| RLAPI Mesh LoadMesh(const char *fileName);                                                              // Load mesh from file | ||||
| RLAPI void UnloadMesh(Mesh *mesh);                                                                      // Unload mesh from memory (RAM and/or VRAM) | ||||
| RLAPI void ExportMesh(const char *fileName, Mesh mesh);                                                 // Export mesh as an OBJ file | ||||
|  | ||||
| // Mesh manipulation functions | ||||
| RLAPI BoundingBox MeshBoundingBox(Mesh mesh);                                                           // Compute mesh bounding box limits | ||||
| @@ -1031,25 +1034,21 @@ RLAPI void UnloadMaterial(Material material); | ||||
|  | ||||
| // Model drawing functions | ||||
| RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint);                           // Draw a model (with texture if set) | ||||
| RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, | ||||
|                        float rotationAngle, Vector3 scale, Color tint);                                 // Draw a model with extended parameters | ||||
| RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters | ||||
| RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint);                      // Draw a model wires (with texture if set) | ||||
| RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, | ||||
|                             float rotationAngle, Vector3 scale, Color tint);                            // Draw a model wires (with texture if set) with extended parameters | ||||
| RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters | ||||
| RLAPI void DrawBoundingBox(BoundingBox box, Color color);                                               // Draw bounding box (wires) | ||||
| RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint);     // Draw a billboard texture | ||||
| RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, | ||||
|                             Vector3 center, float size, Color tint);                                    // Draw a billboard texture defined by sourceRec | ||||
| RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec | ||||
|  | ||||
| // Collision detection functions | ||||
| RLAPI bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB);       // Detect collision between two spheres | ||||
| RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);                                     // Detect collision between two bounding boxes | ||||
| RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 centerSphere, float radiusSphere);          // Detect collision between box and sphere | ||||
| RLAPI bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius);                // Detect collision between ray and sphere | ||||
| RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, | ||||
|                                      Vector3 *collisionPoint);                                          // Detect collision between ray and sphere, returns collision point | ||||
| RLAPI bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere, returns collision point | ||||
| RLAPI bool CheckCollisionRayBox(Ray ray, BoundingBox box);                                              // Detect collision between ray and box | ||||
| RLAPI RayHitInfo GetCollisionRayMesh(Ray ray, Mesh *mesh);                                              // Get collision info between ray and mesh | ||||
| RLAPI RayHitInfo GetCollisionRayModel(Ray ray, Model *model);                                           // Get collision info between ray and model | ||||
| RLAPI RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3);                  // Get collision info between ray and triangle | ||||
| RLAPI RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight);                                    // Get collision info between ray and ground plane (Y-normal plane) | ||||
|  | ||||
| @@ -1148,8 +1147,7 @@ RLAPI float GetMusicTimeLength(Music music);                          // Get mus | ||||
| RLAPI float GetMusicTimePlayed(Music music);                          // Get current music time played (in seconds) | ||||
|  | ||||
| // AudioStream management functions | ||||
| RLAPI AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, | ||||
|                                   unsigned int channels);             // Init audio stream (to stream raw audio pcm data) | ||||
| RLAPI AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Init audio stream (to stream raw audio pcm data) | ||||
| RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount); // Update audio stream buffers with data | ||||
| RLAPI void CloseAudioStream(AudioStream stream);                      // Close audio stream and free memory | ||||
| RLAPI bool IsAudioBufferProcessed(AudioStream stream);                // Check if any audio stream buffers requires refill | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -24,6 +24,7 @@ | ||||
| *   #define SUPPORT_FILEFORMAT_XM | ||||
| *   #define SUPPORT_FILEFORMAT_MOD | ||||
| *   #define SUPPORT_FILEFORMAT_FLAC | ||||
| *   #define SUPPORT_FILEFORMAT_MP3 | ||||
| *       Selected desired fileformats to be supported for loading. Some of those formats are | ||||
| *       supported by default, to remove support, just comment unrequired #define in this module | ||||
| * | ||||
| @@ -127,6 +128,11 @@ | ||||
|     #include "external/dr_flac.h"       // FLAC loading functions | ||||
| #endif | ||||
|  | ||||
| #if defined(SUPPORT_FILEFORMAT_MP3) | ||||
|     #define DR_MP3_IMPLEMENTATION | ||||
|     #include "external/dr_mp3.h"       // MP3 loading functions | ||||
| #endif | ||||
|  | ||||
| #ifdef _MSC_VER | ||||
|     #undef bool | ||||
| #endif | ||||
|   | ||||
| @@ -25,7 +25,7 @@ | ||||
| * | ||||
| **********************************************************************************************/ | ||||
|  | ||||
| #define RAYLIB_VERSION  "1.9.7-dev" | ||||
| #define RAYLIB_VERSION  "2.0-dev" | ||||
|  | ||||
| // Edit to control what features Makefile'd raylib is compiled with | ||||
| #if defined(RAYLIB_CMAKE) | ||||
| @@ -124,6 +124,7 @@ | ||||
| #define SUPPORT_FILEFORMAT_XM       1 | ||||
| #define SUPPORT_FILEFORMAT_MOD      1 | ||||
| //#define SUPPORT_FILEFORMAT_FLAC   1 | ||||
| //#define SUPPORT_FILEFORMAT_MP3    1 | ||||
|  | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
|   | ||||
							
								
								
									
										2841
									
								
								src/external/dr_mp3.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2841
									
								
								src/external/dr_mp3.h
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										30
									
								
								src/raylib.h
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/raylib.h
									
									
									
									
									
								
							| @@ -382,7 +382,7 @@ typedef struct RenderTexture2D { | ||||
|     Texture2D depth;        // Depth buffer attachment texture | ||||
| } RenderTexture2D; | ||||
|  | ||||
| // SpriteFont character info | ||||
| // Font character info | ||||
| typedef struct CharInfo { | ||||
|     int value;              // Character value (Unicode) | ||||
|     Rectangle rec;          // Character rectangle in sprite font | ||||
| @@ -391,13 +391,15 @@ typedef struct CharInfo { | ||||
|     int advanceX;           // Character advance position X | ||||
| } CharInfo; | ||||
|  | ||||
| // SpriteFont type, includes texture and charSet array data | ||||
| typedef struct SpriteFont { | ||||
| // Font type, includes texture and charSet array data | ||||
| typedef struct Font { | ||||
|     Texture2D texture;      // Font texture | ||||
|     int baseSize;           // Base size (default chars height) | ||||
|     int charsCount;         // Number of characters | ||||
|     CharInfo *chars;        // Characters info data | ||||
| } SpriteFont; | ||||
| } Font; | ||||
|  | ||||
| #define SpriteFont  Font    // SpriteFont type fallback, defaults to Font | ||||
|  | ||||
| // Camera type, defines a camera position/orientation in 3d space | ||||
| typedef struct Camera3D { | ||||
| @@ -915,11 +917,11 @@ RLAPI void ImageResizeNN(Image *image,int newWidth,int newHeight); | ||||
| RLAPI void ImageMipmaps(Image *image);                                                                   // Generate all mipmap levels for a provided image | ||||
| RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);                            // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) | ||||
| RLAPI Image ImageText(const char *text, int fontSize, Color color);                                      // Create an image from text (default font) | ||||
| RLAPI Image ImageTextEx(SpriteFont font, const char *text, float fontSize, float spacing, Color tint);     // Create an image from text (custom sprite font) | ||||
| RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint);     // Create an image from text (custom sprite font) | ||||
| RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec);                         // Draw a source image within a destination image | ||||
| RLAPI void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color);                 // Draw rectangle within an image | ||||
| RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color);     // Draw text (default font) within an image (destination) | ||||
| RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination) | ||||
| RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination) | ||||
| RLAPI void ImageFlipVertical(Image *image);                                                              // Flip image vertically | ||||
| RLAPI void ImageFlipHorizontal(Image *image);                                                            // Flip image horizontally | ||||
| RLAPI void ImageColorTint(Image *image, Color color);                                                    // Modify image color: tint | ||||
| @@ -955,23 +957,23 @@ RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle dest | ||||
| // Font Loading and Text Drawing Functions (Module: text) | ||||
| //------------------------------------------------------------------------------------ | ||||
|  | ||||
| // SpriteFont loading/unloading functions | ||||
| RLAPI SpriteFont GetDefaultFont(void);                                                                   // Get the default SpriteFont | ||||
| RLAPI SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load SpriteFont from file into GPU memory (VRAM) | ||||
| RLAPI SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars);   // Load SpriteFont from file with extended parameters | ||||
| RLAPI void UnloadSpriteFont(SpriteFont font);                                                            // Unload SpriteFont from GPU memory (VRAM) | ||||
| // Font loading/unloading functions | ||||
| RLAPI Font GetDefaultFont(void);                                                                   // Get the default Font | ||||
| RLAPI Font LoadFont(const char *fileName);                                                   // Load Font from file into GPU memory (VRAM) | ||||
| RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars);   // Load Font from file with extended parameters | ||||
| RLAPI void UnloadFont(Font font);                                                            // Unload Font from GPU memory (VRAM) | ||||
|  | ||||
| // Text drawing functions | ||||
| RLAPI void DrawFPS(int posX, int posY);                                                                  // Shows current FPS | ||||
| RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color);                    // Draw text (using default font) | ||||
| RLAPI void DrawTextEx(SpriteFont font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using SpriteFont and additional parameters | ||||
| RLAPI void DrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using Font and additional parameters | ||||
|  | ||||
| // Text misc. functions | ||||
| RLAPI int MeasureText(const char *text, int fontSize);                                                   // Measure string width for default font | ||||
| RLAPI Vector2 MeasureTextEx(SpriteFont font, const char *text, float fontSize, float spacing);           // Measure string size for SpriteFont | ||||
| RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);           // Measure string size for Font | ||||
| RLAPI const char *FormatText(const char *text, ...);                                                     // Formatting of text with variables to 'embed' | ||||
| RLAPI const char *SubText(const char *text, int position, int length);                                   // Get a piece of a text string | ||||
| RLAPI int GetGlyphIndex(SpriteFont font, int character);                                                 // Returns index position for a unicode character on sprite font | ||||
| RLAPI int GetGlyphIndex(Font font, int character);                                                 // Returns index position for a unicode character on sprite font | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
| // Basic 3d Shapes Drawing Functions (Module: models) | ||||
|   | ||||
							
								
								
									
										68
									
								
								src/text.c
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								src/text.c
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| /********************************************************************************************** | ||||
| * | ||||
| *   raylib.text - Basic functions to load SpriteFonts and draw Text | ||||
| *   raylib.text - Basic functions to load Fonts and draw Text | ||||
| * | ||||
| *   CONFIGURATION: | ||||
| * | ||||
| @@ -73,7 +73,7 @@ | ||||
| // Global variables | ||||
| //---------------------------------------------------------------------------------- | ||||
| #if defined(SUPPORT_DEFAULT_FONT) | ||||
| static SpriteFont defaultFont;        // Default font provided by raylib | ||||
| static Font defaultFont;        // Default font provided by raylib | ||||
| // NOTE: defaultFont is loaded on InitWindow and disposed on CloseWindow [module: core] | ||||
| #endif | ||||
|  | ||||
| @@ -85,12 +85,12 @@ static SpriteFont defaultFont;        // Default font provided by raylib | ||||
| //---------------------------------------------------------------------------------- | ||||
| // Module specific Functions Declaration | ||||
| //---------------------------------------------------------------------------------- | ||||
| static SpriteFont LoadImageFont(Image image, Color key, int firstChar); // Load a Image font file (XNA style) | ||||
| static Font LoadImageFont(Image image, Color key, int firstChar); // Load a Image font file (XNA style) | ||||
| #if defined(SUPPORT_FILEFORMAT_FNT) | ||||
| static SpriteFont LoadBMFont(const char *fileName);     // Load a BMFont file (AngelCode font file) | ||||
| static Font LoadBMFont(const char *fileName);     // Load a BMFont file (AngelCode font file) | ||||
| #endif | ||||
| #if defined(SUPPORT_FILEFORMAT_TTF) | ||||
| static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load spritefont from TTF data | ||||
| static Font LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load spritefont from TTF data | ||||
| #endif | ||||
|  | ||||
| #if defined(SUPPORT_DEFAULT_FONT) | ||||
| @@ -114,7 +114,7 @@ extern void LoadDefaultFont(void) | ||||
|     defaultFont.charsCount = 224;             // Number of chars included in our default font | ||||
|  | ||||
|     // Default font is directly defined here (data generated from a sprite font image) | ||||
|     // This way, we reconstruct SpriteFont without creating large global variables | ||||
|     // This way, we reconstruct Font without creating large global variables | ||||
|     // This data is automatically allocated to Stack and automatically deallocated at the end of this function | ||||
|     int defaultFontData[512] = { | ||||
|         0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00200020, 0x0001b000, 0x00000000, 0x00000000, 0x8ef92520, 0x00020a00, 0x7dbe8000, 0x1f7df45f, | ||||
| @@ -261,28 +261,28 @@ extern void UnloadDefaultFont(void) | ||||
| #endif      // SUPPORT_DEFAULT_FONT | ||||
|  | ||||
| // Get the default font, useful to be used with extended parameters | ||||
| SpriteFont GetDefaultFont() | ||||
| Font GetDefaultFont() | ||||
| { | ||||
| #if defined(SUPPORT_DEFAULT_FONT) | ||||
|     return defaultFont; | ||||
| #else | ||||
|     SpriteFont font = { 0 }; | ||||
|     Font font = { 0 }; | ||||
|     return font; | ||||
| #endif    | ||||
| } | ||||
|  | ||||
| // Load SpriteFont from file into GPU memory (VRAM) | ||||
| SpriteFont LoadSpriteFont(const char *fileName) | ||||
| // Load Font from file into GPU memory (VRAM) | ||||
| Font LoadFont(const char *fileName) | ||||
| { | ||||
|     // Default hardcoded values for ttf file loading | ||||
|     #define DEFAULT_TTF_FONTSIZE    32      // Font first character (32 - space) | ||||
|     #define DEFAULT_TTF_NUMCHARS    95      // ASCII 32..126 is 95 glyphs | ||||
|     #define DEFAULT_FIRST_CHAR      32      // Expected first char for image spritefont | ||||
|  | ||||
|     SpriteFont spriteFont = { 0 }; | ||||
|     Font spriteFont = { 0 }; | ||||
|  | ||||
| #if defined(SUPPORT_FILEFORMAT_TTF) | ||||
|     if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL); | ||||
|     if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL); | ||||
|     else | ||||
| #endif | ||||
| #if defined(SUPPORT_FILEFORMAT_FNT) | ||||
| @@ -297,7 +297,7 @@ SpriteFont LoadSpriteFont(const char *fileName) | ||||
|  | ||||
|     if (spriteFont.texture.id == 0) | ||||
|     { | ||||
|         TraceLog(LOG_WARNING, "[%s] SpriteFont could not be loaded, using default font", fileName); | ||||
|         TraceLog(LOG_WARNING, "[%s] Font could not be loaded, using default font", fileName); | ||||
|         spriteFont = GetDefaultFont(); | ||||
|     } | ||||
|     else SetTextureFilter(spriteFont.texture, FILTER_POINT);    // By default we set point filter (best performance) | ||||
| @@ -305,12 +305,12 @@ SpriteFont LoadSpriteFont(const char *fileName) | ||||
|     return spriteFont; | ||||
| } | ||||
|  | ||||
| // Load SpriteFont from TTF font file with generation parameters | ||||
| // Load Font from TTF font file with generation parameters | ||||
| // NOTE: You can pass an array with desired characters, those characters should be available in the font | ||||
| // if array is NULL, default char set is selected 32..126 | ||||
| SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars) | ||||
| Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars) | ||||
| { | ||||
|     SpriteFont spriteFont = { 0 }; | ||||
|     Font spriteFont = { 0 }; | ||||
|     int totalChars = 95;            // Default charset [32..126] | ||||
|  | ||||
| #if defined(SUPPORT_FILEFORMAT_TTF) | ||||
| @@ -330,15 +330,15 @@ SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, | ||||
|  | ||||
|     if (spriteFont.texture.id == 0) | ||||
|     { | ||||
|         TraceLog(LOG_WARNING, "[%s] SpriteFont could not be generated, using default font", fileName); | ||||
|         TraceLog(LOG_WARNING, "[%s] Font could not be generated, using default font", fileName); | ||||
|         spriteFont = GetDefaultFont(); | ||||
|     } | ||||
|  | ||||
|     return spriteFont; | ||||
| } | ||||
|  | ||||
| // Unload SpriteFont from GPU memory (VRAM) | ||||
| void UnloadSpriteFont(SpriteFont font) | ||||
| // Unload Font from GPU memory (VRAM) | ||||
| void UnloadFont(Font font) | ||||
| { | ||||
|     // NOTE: Make sure spriteFont is not default font (fallback) | ||||
|     if (font.texture.id != GetDefaultFont().texture.id) | ||||
| @@ -368,9 +368,9 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color) | ||||
|     } | ||||
| } | ||||
|  | ||||
| // Draw text using SpriteFont | ||||
| // Draw text using Font | ||||
| // NOTE: chars spacing is NOT proportional to fontSize | ||||
| void DrawTextEx(SpriteFont font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) | ||||
| void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) | ||||
| { | ||||
|     int length = strlen(text); | ||||
|     int textOffsetX = 0;        // Offset between characters | ||||
| @@ -482,8 +482,8 @@ int MeasureText(const char *text, int fontSize) | ||||
|     return (int)vec.x; | ||||
| } | ||||
|  | ||||
| // Measure string size for SpriteFont | ||||
| Vector2 MeasureTextEx(SpriteFont font, const char *text, float fontSize, float spacing) | ||||
| // Measure string size for Font | ||||
| Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing) | ||||
| { | ||||
|     int len = strlen(text); | ||||
|     int tempLen = 0;                // Used to count longer text line num chars | ||||
| @@ -527,7 +527,7 @@ Vector2 MeasureTextEx(SpriteFont font, const char *text, float fontSize, float s | ||||
| } | ||||
|  | ||||
| // Returns index position for a unicode character on spritefont | ||||
| int GetGlyphIndex(SpriteFont font, int character) | ||||
| int GetGlyphIndex(Font font, int character) | ||||
| { | ||||
| #define UNORDERED_CHARSET | ||||
| #if defined(UNORDERED_CHARSET) | ||||
| @@ -575,7 +575,7 @@ void DrawFPS(int posX, int posY) | ||||
| //---------------------------------------------------------------------------------- | ||||
|  | ||||
| // Load an Image font file (XNA style) | ||||
| static SpriteFont LoadImageFont(Image image, Color key, int firstChar) | ||||
| static Font LoadImageFont(Image image, Color key, int firstChar) | ||||
| { | ||||
|     #define COLOR_EQUAL(col1, col2) ((col1.r == col2.r)&&(col1.g == col2.g)&&(col1.b == col2.b)&&(col1.a == col2.a)) | ||||
|  | ||||
| @@ -648,7 +648,7 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar) | ||||
|         xPosToRead = charSpacing; | ||||
|     } | ||||
|  | ||||
|     TraceLog(LOG_DEBUG, "SpriteFont data parsed correctly from image"); | ||||
|     TraceLog(LOG_DEBUG, "Font data parsed correctly from image"); | ||||
|  | ||||
|     // NOTE: We need to remove key color borders from image to avoid weird | ||||
|     // artifacts on texture scaling when using FILTER_BILINEAR or FILTER_TRILINEAR | ||||
| @@ -660,7 +660,7 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar) | ||||
|     free(pixels);    // Free pixels array memory | ||||
|  | ||||
|     // Create spritefont with all data parsed from image | ||||
|     SpriteFont spriteFont = { 0 }; | ||||
|     Font spriteFont = { 0 }; | ||||
|  | ||||
|     spriteFont.texture = LoadTextureFromImage(fontClear); // Convert processed image to OpenGL texture | ||||
|     spriteFont.charsCount = index; | ||||
| @@ -684,18 +684,18 @@ static SpriteFont LoadImageFont(Image image, Color key, int firstChar) | ||||
|  | ||||
|     spriteFont.baseSize = spriteFont.chars[0].rec.height; | ||||
|  | ||||
|     TraceLog(LOG_INFO, "Image file loaded correctly as SpriteFont"); | ||||
|     TraceLog(LOG_INFO, "Image file loaded correctly as Font"); | ||||
|  | ||||
|     return spriteFont; | ||||
| } | ||||
|  | ||||
| #if defined(SUPPORT_FILEFORMAT_FNT) | ||||
| // Load a BMFont file (AngelCode font file) | ||||
| static SpriteFont LoadBMFont(const char *fileName) | ||||
| static Font LoadBMFont(const char *fileName) | ||||
| { | ||||
|     #define MAX_BUFFER_SIZE     256 | ||||
|  | ||||
|     SpriteFont font = { 0 }; | ||||
|     Font font = { 0 }; | ||||
|     font.texture.id = 0; | ||||
|  | ||||
|     char buffer[MAX_BUFFER_SIZE]; | ||||
| @@ -800,10 +800,10 @@ static SpriteFont LoadBMFont(const char *fileName) | ||||
|  | ||||
|     if (font.texture.id == 0) | ||||
|     { | ||||
|         UnloadSpriteFont(font); | ||||
|         UnloadFont(font); | ||||
|         font = GetDefaultFont(); | ||||
|     } | ||||
|     else TraceLog(LOG_INFO, "[%s] SpriteFont loaded successfully", fileName); | ||||
|     else TraceLog(LOG_INFO, "[%s] Font loaded successfully", fileName); | ||||
|  | ||||
|     return font; | ||||
| } | ||||
| @@ -812,7 +812,7 @@ static SpriteFont LoadBMFont(const char *fileName) | ||||
| #if defined(SUPPORT_FILEFORMAT_TTF) | ||||
| // Generate a sprite font from TTF file data (font size required) | ||||
| // TODO: Review texture packing method and generation (use oversampling) | ||||
| static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars) | ||||
| static Font LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars) | ||||
| { | ||||
|     #define MAX_TTF_SIZE    16      // Maximum ttf file size in MB | ||||
|      | ||||
| @@ -830,7 +830,7 @@ static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, in | ||||
|     unsigned char *dataBitmap = (unsigned char *)malloc(textureSize*textureSize*sizeof(unsigned char));   // One channel bitmap returned! | ||||
|     stbtt_bakedchar *charData = (stbtt_bakedchar *)malloc(sizeof(stbtt_bakedchar)*charsCount); | ||||
|  | ||||
|     SpriteFont font = { 0 }; | ||||
|     Font font = { 0 }; | ||||
|  | ||||
|     FILE *ttfFile = fopen(fileName, "rb"); | ||||
|  | ||||
|   | ||||
| @@ -1371,7 +1371,7 @@ Image ImageText(const char *text, int fontSize, Color color) | ||||
| } | ||||
|  | ||||
| // Create an image from text (custom sprite font) | ||||
| Image ImageTextEx(SpriteFont font, const char *text, float fontSize, float spacing, Color tint) | ||||
| Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) | ||||
| { | ||||
|     int length = strlen(text); | ||||
|     int posX = 0; | ||||
| @@ -1385,7 +1385,7 @@ Image ImageTextEx(SpriteFont font, const char *text, float fontSize, float spaci | ||||
|  | ||||
|     // NOTE: glGetTexImage() not available in OpenGL ES | ||||
|     // TODO: This is horrible, retrieving font texture from GPU!!!  | ||||
|     // Define ImageFont struct? or include Image spritefont in SpriteFont struct? | ||||
|     // Define ImageFont struct? or include Image spritefont in Font struct? | ||||
|     Image imFont = GetTextureData(font.texture); | ||||
|      | ||||
|     ImageColorTint(&imFont, tint);                    // Apply color tint to font | ||||
| @@ -1466,7 +1466,7 @@ void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, | ||||
| } | ||||
|  | ||||
| // Draw text (custom sprite font) within an image (destination) | ||||
| void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text, float fontSize, float spacing, Color color) | ||||
| void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color) | ||||
| { | ||||
|     Image imText = ImageTextEx(font, text, fontSize, spacing, color); | ||||
|  | ||||
|   | ||||
| @@ -58,7 +58,7 @@ int main(void) | ||||
|     // Global data loading (assets that must be available in all screens, i.e. fonts) | ||||
|     InitAudioDevice(); | ||||
|  | ||||
|     font = LoadSpriteFont("resources/mecha.png"); | ||||
|     font = LoadFont("resources/mecha.png"); | ||||
|     music = LoadMusicStream("resources/ambient.ogg"); | ||||
|     fxCoin = LoadSound("resources/coin.wav"); | ||||
|      | ||||
| @@ -96,7 +96,7 @@ int main(void) | ||||
|     } | ||||
|      | ||||
|     // Unload all global loaded data (i.e. fonts) here! | ||||
|     UnloadSpriteFont(font); | ||||
|     UnloadFont(font); | ||||
|     UnloadMusicStream(music); | ||||
|     UnloadSound(fxCoin); | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ typedef enum GameScreen { LOGO = 0, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScree | ||||
| // Global Variables Definition | ||||
| //---------------------------------------------------------------------------------- | ||||
| GameScreen currentScreen; | ||||
| SpriteFont font; | ||||
| Font font; | ||||
| Music music; | ||||
| Sound fxCoin; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ray San
					Ray San