aboutsummaryrefslogtreecommitdiff
path: root/examples/textures
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2017-04-14 13:58:39 +0200
committerraysan5 <raysan5@gmail.com>2017-04-14 13:58:39 +0200
commit4315b82ea7b42b68572f14c595aa46f030d82a43 (patch)
tree4a0faa9a4d6c6904ef67b2a21f63234679b7edc1 /examples/textures
parent82c54449bf4f472d2b46413288c0343e31eae8dc (diff)
downloadraylib-4315b82ea7b42b68572f14c595aa46f030d82a43.tar.gz
raylib-4315b82ea7b42b68572f14c595aa46f030d82a43.zip
Replaced some images and updated examples
Diffstat (limited to 'examples/textures')
-rw-r--r--examples/textures/resources/fudesumi.pngbin0 -> 219234 bytes
-rw-r--r--examples/textures/resources/fudesumi.rawbin0 -> 786432 bytes
-rw-r--r--examples/textures/textures_raw_data.c24
-rw-r--r--examples/textures/textures_raw_data.pngbin87424 -> 246014 bytes
-rw-r--r--examples/textures/textures_srcrec_dstrec.c12
-rw-r--r--examples/textures/textures_srcrec_dstrec.pngbin47563 -> 37887 bytes
6 files changed, 20 insertions, 16 deletions
diff --git a/examples/textures/resources/fudesumi.png b/examples/textures/resources/fudesumi.png
new file mode 100644
index 00000000..8ba983dc
--- /dev/null
+++ b/examples/textures/resources/fudesumi.png
Binary files differ
diff --git a/examples/textures/resources/fudesumi.raw b/examples/textures/resources/fudesumi.raw
new file mode 100644
index 00000000..e05fa0e1
--- /dev/null
+++ b/examples/textures/resources/fudesumi.raw
Binary files differ
diff --git a/examples/textures/textures_raw_data.c b/examples/textures/textures_raw_data.c
index d1922180..b038792b 100644
--- a/examples/textures/textures_raw_data.c
+++ b/examples/textures/textures_raw_data.c
@@ -27,9 +27,9 @@ int main()
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
// Load RAW image data (512x512, 32bit RGBA, no file header)
- Image sonicRaw = LoadImageRaw("resources/texture_formats/sonic_R8G8B8A8.raw", 512, 512, UNCOMPRESSED_R8G8B8A8, 0);
- Texture2D sonic = LoadTextureFromImage(sonicRaw); // Upload CPU (RAM) image to GPU (VRAM)
- UnloadImage(sonicRaw); // Unload CPU (RAM) image data
+ Image fudesumiRaw = LoadImageRaw("resources/fudesumi.raw", 384, 512, UNCOMPRESSED_R8G8B8A8, 0);
+ Texture2D fudesumi = LoadTextureFromImage(fudesumiRaw); // Upload CPU (RAM) image to GPU (VRAM)
+ UnloadImage(fudesumiRaw); // Unload CPU (RAM) image data
// Generate a checked texture by code (1024x1024 pixels)
int width = 1024;
@@ -42,8 +42,8 @@ int main()
{
for (int x = 0; x < width; x++)
{
- if (((x/32+y/32)/1)%2 == 0) pixels[y*height + x] = DARKBLUE;
- else pixels[y*height + x] = SKYBLUE;
+ if (((x/32+y/32)/1)%2 == 0) pixels[y*height + x] = ORANGE;
+ else pixels[y*height + x] = GOLD;
}
}
@@ -70,12 +70,14 @@ int main()
ClearBackground(RAYWHITE);
- DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.3f));
- DrawTexture(sonic, 330, -20, WHITE);
+ DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.5f));
+ DrawTexture(fudesumi, 430, -30, WHITE);
- DrawText("CHECKED TEXTURE ", 84, 100, 30, DARKBLUE);
- DrawText("GENERATED by CODE", 72, 164, 30, DARKBLUE);
- DrawText("and RAW IMAGE LOADING", 46, 226, 30, DARKBLUE);
+ DrawText("CHECKED TEXTURE ", 84, 100, 30, BROWN);
+ DrawText("GENERATED by CODE", 72, 164, 30, BROWN);
+ DrawText("and RAW IMAGE LOADING", 46, 226, 30, BROWN);
+
+ DrawText("(c) Fudesumi sprite by Eiden Marsal", 310, screenHeight - 20, 10, BROWN);
EndDrawing();
//----------------------------------------------------------------------------------
@@ -83,7 +85,7 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- UnloadTexture(sonic); // Texture unloading
+ UnloadTexture(fudesumi); // Texture unloading
UnloadTexture(checked); // Texture unloading
CloseWindow(); // Close window and OpenGL context
diff --git a/examples/textures/textures_raw_data.png b/examples/textures/textures_raw_data.png
index 374d2266..437e4b53 100644
--- a/examples/textures/textures_raw_data.png
+++ b/examples/textures/textures_raw_data.png
Binary files differ
diff --git a/examples/textures/textures_srcrec_dstrec.c b/examples/textures/textures_srcrec_dstrec.c
index 6d824ce6..53ffd1d0 100644
--- a/examples/textures/textures_srcrec_dstrec.c
+++ b/examples/textures/textures_srcrec_dstrec.c
@@ -21,10 +21,10 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
- Texture2D guybrush = LoadTexture("resources/guybrush.png"); // Texture loading
+ Texture2D scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
- int frameWidth = guybrush.width/7;
- int frameHeight = guybrush.height;
+ int frameWidth = scarfy.width/6;
+ int frameHeight = scarfy.height;
// NOTE: Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 0, 0, frameWidth, frameHeight };
@@ -59,10 +59,12 @@ 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(guybrush, sourceRec, destRec, origin, rotation, WHITE);
+ DrawTexturePro(scarfy, sourceRec, destRec, origin, rotation, WHITE);
DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);
DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY);
+
+ DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
@@ -70,7 +72,7 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- UnloadTexture(guybrush); // Texture unloading
+ UnloadTexture(scarfy); // Texture unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
diff --git a/examples/textures/textures_srcrec_dstrec.png b/examples/textures/textures_srcrec_dstrec.png
index 9ea00fe4..7691ff2e 100644
--- a/examples/textures/textures_srcrec_dstrec.png
+++ b/examples/textures/textures_srcrec_dstrec.png
Binary files differ