diff options
Diffstat (limited to 'examples/textures')
| -rw-r--r-- | examples/textures/textures_image_drawing.c | 4 | ||||
| -rw-r--r-- | examples/textures/textures_image_generation.c | 2 | ||||
| -rw-r--r-- | examples/textures/textures_image_processing.c | 17 | ||||
| -rw-r--r-- | examples/textures/textures_image_text.c | 6 |
4 files changed, 10 insertions, 19 deletions
diff --git a/examples/textures/textures_image_drawing.c b/examples/textures/textures_image_drawing.c index ac128af9..b179612d 100644 --- a/examples/textures/textures_image_drawing.c +++ b/examples/textures/textures_image_drawing.c @@ -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 diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c index 790c34f1..b9608c89 100644 --- a/examples/textures/textures_image_generation.c +++ b/examples/textures/textures_image_generation.c @@ -58,7 +58,7 @@ int main() { // Update //---------------------------------------------------------------------------------- - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsKeyPressed(KEY_RIGHT)) { currentTexture = (currentTexture + 1)%NUM_TEXTURES; // Cycle between the textures } diff --git a/examples/textures/textures_image_processing.c b/examples/textures/textures_image_processing.c index 58b746e0..427faa60 100644 --- a/examples/textures/textures_image_processing.c +++ b/examples/textures/textures_image_processing.c @@ -51,7 +51,7 @@ int main() // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) Image image = LoadImage("resources/parrots.png"); // Loaded in CPU memory (RAM) - ImageFormat(&image, UNCOMPRESSED_R8G8B8A8); // Format image to RGBA 32bit (required for texture update) + ImageFormat(&image, UNCOMPRESSED_R8G8B8A8); // Format image to RGBA 32bit (required for texture update) <-- ISSUE Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM) int currentProcess = NONE; @@ -121,18 +121,9 @@ int main() // Draw rectangles for (int i = 0; i < NUM_PROCESSES; i++) { - if (i == currentProcess) - { - DrawRectangleRec(selectRecs[i], SKYBLUE); - DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE); - DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, 10, DARKBLUE); - } - else - { - DrawRectangleRec(selectRecs[i], LIGHTGRAY); - DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY); - DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, 10, DARKGRAY); - } + DrawRectangleRec(selectRecs[i], (i == currentProcess) ? SKYBLUE : LIGHTGRAY); + DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, (i == currentProcess) ? BLUE : GRAY); + DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, 10, (i == currentProcess) ? DARKBLUE : DARKGRAY); } DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE); diff --git a/examples/textures/textures_image_text.c b/examples/textures/textures_image_text.c index 1d4231f7..0a939b8d 100644 --- a/examples/textures/textures_image_text.c +++ b/examples/textures/textures_image_text.c @@ -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 //-------------------------------------------------------------------------------------- |
