summaryrefslogtreecommitdiffhomepage
path: root/examples/src/textures
diff options
context:
space:
mode:
authorRay <[email protected]>2018-08-14 19:32:27 +0200
committerRay <[email protected]>2018-08-14 19:32:27 +0200
commitab07e099dbf782c4c69cd0f0e06d1f37a3a887bf (patch)
tree3b251a6667d3ea3696b0435f9b5306be31d32ba4 /examples/src/textures
parenta8e30fb58fcc414aae8533f6f118c4f005b02833 (diff)
downloadraylib.com-ab07e099dbf782c4c69cd0f0e06d1f37a3a887bf.tar.gz
raylib.com-ab07e099dbf782c4c69cd0f0e06d1f37a3a887bf.zip
Updated examples
Diffstat (limited to 'examples/src/textures')
-rw-r--r--examples/src/textures/textures_image_drawing.c4
-rw-r--r--examples/src/textures/textures_image_generation.c6
-rw-r--r--examples/src/textures/textures_particles_blending.c6
-rw-r--r--examples/src/textures/textures_rectangle.c4
-rw-r--r--examples/src/textures/textures_srcrec_dstrec.c12
5 files changed, 16 insertions, 16 deletions
diff --git a/examples/src/textures/textures_image_drawing.c b/examples/src/textures/textures_image_drawing.c
index ac128af..b179612 100644
--- a/examples/src/textures/textures_image_drawing.c
+++ b/examples/src/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/src/textures/textures_image_generation.c b/examples/src/textures/textures_image_generation.c
index 7d8e017..b9608c8 100644
--- a/examples/src/textures/textures_image_generation.c
+++ b/examples/src/textures/textures_image_generation.c
@@ -24,10 +24,10 @@ int main()
Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE);
Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE);
- Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.f, WHITE, BLACK);
+ Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK);
Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE);
Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f);
- Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 8.f);
+ Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
Texture2D textures[NUM_TEXTURES];
@@ -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/src/textures/textures_particles_blending.c b/examples/src/textures/textures_particles_blending.c
index 842ac77..3b7dcaa 100644
--- a/examples/src/textures/textures_particles_blending.c
+++ b/examples/src/textures/textures_particles_blending.c
@@ -42,7 +42,7 @@ int main()
mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
mouseTail[i].alpha = 1.0f;
mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f;
- mouseTail[i].rotation = GetRandomValue(0, 360);
+ mouseTail[i].rotation = (float)GetRandomValue(0, 360);
mouseTail[i].active = false;
}
@@ -107,9 +107,9 @@ int main()
// Draw active particles
for (int i = 0; i < MAX_PARTICLES; i++)
{
- if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0, 0, smoke.width, smoke.height },
+ if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float)smoke.width, (float)smoke.height },
(Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
- (Vector2){ smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2 }, mouseTail[i].rotation,
+ (Vector2){ (float)(smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation,
Fade(mouseTail[i].color, mouseTail[i].alpha));
}
diff --git a/examples/src/textures/textures_rectangle.c b/examples/src/textures/textures_rectangle.c
index c90db8a..e124774 100644
--- a/examples/src/textures/textures_rectangle.c
+++ b/examples/src/textures/textures_rectangle.c
@@ -27,7 +27,7 @@ int main()
Texture2D scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
Vector2 position = { 350.0f, 280.0f };
- Rectangle frameRec = { 0, 0, scarfy.width/6, scarfy.height };
+ Rectangle frameRec = { 0.0f, 0.0f, (float)scarfy.width/6, (float)scarfy.height };
int currentFrame = 0;
int framesCounter = 0;
@@ -50,7 +50,7 @@ int main()
if (currentFrame > 5) currentFrame = 0;
- frameRec.x = currentFrame*scarfy.width/6;
+ frameRec.x = (float)currentFrame*(float)scarfy.width/6;
}
if (IsKeyPressed(KEY_RIGHT)) framesSpeed++;
diff --git a/examples/src/textures/textures_srcrec_dstrec.c b/examples/src/textures/textures_srcrec_dstrec.c
index 53ffd1d..cc08eb5 100644
--- a/examples/src/textures/textures_srcrec_dstrec.c
+++ b/examples/src/textures/textures_srcrec_dstrec.c
@@ -27,13 +27,13 @@ int main()
int frameHeight = scarfy.height;
// NOTE: Source rectangle (part of the texture to use for drawing)
- Rectangle sourceRec = { 0, 0, frameWidth, frameHeight };
+ Rectangle sourceRec = { 0.0f, 0.0f, (float)frameWidth, (float)frameHeight };
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
- Rectangle destRec = { screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2 };
+ Rectangle destRec = { (float)screenWidth/2, (float)screenHeight/2, (float)frameWidth*2, (float)frameHeight*2 };
// NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
- Vector2 origin = { frameWidth, frameHeight };
+ Vector2 origin = { (float)frameWidth, (float)frameHeight };
int rotation = 0;
@@ -59,10 +59,10 @@ int main()
// destRec defines the rectangle where our texture part will fit (scaling it to fit)
// origin defines the point of the texture used as reference for rotation and scaling
// rotation defines the texture rotation (using origin as rotation point)
- DrawTexturePro(scarfy, sourceRec, destRec, origin, rotation, WHITE);
+ DrawTexturePro(scarfy, sourceRec, destRec, origin, (float)rotation, WHITE);
- DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);
- DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY);
+ DrawLine((int) destRec.x, 0, (int) destRec.x, screenHeight, GRAY);
+ DrawLine(0, (int)destRec.y, screenWidth, (int)destRec.y, GRAY);
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);