diff options
| author | Ray <[email protected]> | 2017-04-20 00:21:38 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-04-20 00:21:38 +0200 |
| commit | bc1bfe54d6df0b872b604870d3e55a9f9f4e19dd (patch) | |
| tree | fa1fb6c1b03008d98c342970fa095d7cc84c2252 /examples/textures | |
| parent | 407746193d991190fa4dead94649abb2ed27d462 (diff) | |
| parent | 35172430c6b5929e8f6781e0d92b4bc1f9fcc2a2 (diff) | |
| download | raylib-bc1bfe54d6df0b872b604870d3e55a9f9f4e19dd.tar.gz raylib-bc1bfe54d6df0b872b604870d3e55a9f9f4e19dd.zip | |
Merge pull request #262 from raysan5/develop
Integrate develop branch
Diffstat (limited to 'examples/textures')
46 files changed, 62 insertions, 281 deletions
diff --git a/examples/textures/resources/fudesumi.png b/examples/textures/resources/fudesumi.png Binary files differnew file mode 100644 index 00000000..8ba983dc --- /dev/null +++ b/examples/textures/resources/fudesumi.png diff --git a/examples/textures/resources/fudesumi.raw b/examples/textures/resources/fudesumi.raw Binary files differnew file mode 100644 index 00000000..e05fa0e1 --- /dev/null +++ b/examples/textures/resources/fudesumi.raw diff --git a/examples/textures/resources/guybrush.png b/examples/textures/resources/guybrush.png Binary files differdeleted file mode 100644 index 32c9dced..00000000 --- a/examples/textures/resources/guybrush.png +++ /dev/null diff --git a/examples/textures/resources/heightmap.png b/examples/textures/resources/heightmap.png Binary files differdeleted file mode 100644 index fe30f679..00000000 --- a/examples/textures/resources/heightmap.png +++ /dev/null diff --git a/examples/textures/resources/scarfy.png b/examples/textures/resources/scarfy.png Binary files differnew file mode 100644 index 00000000..a377a712 --- /dev/null +++ b/examples/textures/resources/scarfy.png diff --git a/examples/textures/resources/texture_formats/sonic.png b/examples/textures/resources/texture_formats/sonic.png Binary files differdeleted file mode 100644 index 7a096847..00000000 --- a/examples/textures/resources/texture_formats/sonic.png +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_A1R5G5B5.dds b/examples/textures/resources/texture_formats/sonic_A1R5G5B5.dds Binary files differdeleted file mode 100644 index 5e2347db..00000000 --- a/examples/textures/resources/texture_formats/sonic_A1R5G5B5.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_A4R4G4B4.dds b/examples/textures/resources/texture_formats/sonic_A4R4G4B4.dds Binary files differdeleted file mode 100644 index c5ccaf0c..00000000 --- a/examples/textures/resources/texture_formats/sonic_A4R4G4B4.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_A8R8G8B8.dds b/examples/textures/resources/texture_formats/sonic_A8R8G8B8.dds Binary files differdeleted file mode 100644 index fb71b7be..00000000 --- a/examples/textures/resources/texture_formats/sonic_A8R8G8B8.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ASTC_4x4_ldr.astc b/examples/textures/resources/texture_formats/sonic_ASTC_4x4_ldr.astc Binary files differdeleted file mode 100644 index 9a98d9a0..00000000 --- a/examples/textures/resources/texture_formats/sonic_ASTC_4x4_ldr.astc +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ASTC_8x8_ldr.astc b/examples/textures/resources/texture_formats/sonic_ASTC_8x8_ldr.astc Binary files differdeleted file mode 100644 index 360a264a..00000000 --- a/examples/textures/resources/texture_formats/sonic_ASTC_8x8_ldr.astc +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_DXT1_RGB.dds b/examples/textures/resources/texture_formats/sonic_DXT1_RGB.dds Binary files differdeleted file mode 100644 index 9d0b4598..00000000 --- a/examples/textures/resources/texture_formats/sonic_DXT1_RGB.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_DXT1_RGBA.dds b/examples/textures/resources/texture_formats/sonic_DXT1_RGBA.dds Binary files differdeleted file mode 100644 index 102bae7f..00000000 --- a/examples/textures/resources/texture_formats/sonic_DXT1_RGBA.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_DXT3_RGBA.dds b/examples/textures/resources/texture_formats/sonic_DXT3_RGBA.dds Binary files differdeleted file mode 100644 index 46d965cb..00000000 --- a/examples/textures/resources/texture_formats/sonic_DXT3_RGBA.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_DXT5_RGBA.dds b/examples/textures/resources/texture_formats/sonic_DXT5_RGBA.dds Binary files differdeleted file mode 100644 index b3a59a79..00000000 --- a/examples/textures/resources/texture_formats/sonic_DXT5_RGBA.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC1_RGB.ktx b/examples/textures/resources/texture_formats/sonic_ETC1_RGB.ktx Binary files differdeleted file mode 100644 index 66241b9d..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC1_RGB.ktx +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC1_RGB.pkm b/examples/textures/resources/texture_formats/sonic_ETC1_RGB.pkm Binary files differdeleted file mode 100644 index c6fc6df4..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC1_RGB.pkm +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx b/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx Binary files differdeleted file mode 100644 index b01812cb..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.old.pkm b/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.old.pkm Binary files differdeleted file mode 100644 index 61ac48ce..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.old.pkm +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm b/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm Binary files differdeleted file mode 100644 index 61ac48ce..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC2_RGB.ktx b/examples/textures/resources/texture_formats/sonic_ETC2_RGB.ktx Binary files differdeleted file mode 100644 index 7f1207f7..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC2_RGB.ktx +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_ETC2_RGB.pkm b/examples/textures/resources/texture_formats/sonic_ETC2_RGB.pkm Binary files differdeleted file mode 100644 index f290f019..00000000 --- a/examples/textures/resources/texture_formats/sonic_ETC2_RGB.pkm +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_GRAYSCALE.pvr b/examples/textures/resources/texture_formats/sonic_GRAYSCALE.pvr Binary files differdeleted file mode 100644 index d31e2651..00000000 --- a/examples/textures/resources/texture_formats/sonic_GRAYSCALE.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_L8A8.pvr b/examples/textures/resources/texture_formats/sonic_L8A8.pvr Binary files differdeleted file mode 100644 index ccf5932e..00000000 --- a/examples/textures/resources/texture_formats/sonic_L8A8.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_PVRT_RGB.pvr b/examples/textures/resources/texture_formats/sonic_PVRT_RGB.pvr Binary files differdeleted file mode 100644 index 22f3f66a..00000000 --- a/examples/textures/resources/texture_formats/sonic_PVRT_RGB.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_PVRT_RGBA.pvr b/examples/textures/resources/texture_formats/sonic_PVRT_RGBA.pvr Binary files differdeleted file mode 100644 index feb9aeaf..00000000 --- a/examples/textures/resources/texture_formats/sonic_PVRT_RGBA.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_PVRT_RGBA_2bpp.pvr b/examples/textures/resources/texture_formats/sonic_PVRT_RGBA_2bpp.pvr Binary files differdeleted file mode 100644 index 9147e1bb..00000000 --- a/examples/textures/resources/texture_formats/sonic_PVRT_RGBA_2bpp.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_PVRT_RGB_2bpp.pvr b/examples/textures/resources/texture_formats/sonic_PVRT_RGB_2bpp.pvr Binary files differdeleted file mode 100644 index 2a8aea8c..00000000 --- a/examples/textures/resources/texture_formats/sonic_PVRT_RGB_2bpp.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R4G4B4A4.pvr b/examples/textures/resources/texture_formats/sonic_R4G4B4A4.pvr Binary files differdeleted file mode 100644 index 3f7368a3..00000000 --- a/examples/textures/resources/texture_formats/sonic_R4G4B4A4.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R5G5B5A1.pvr b/examples/textures/resources/texture_formats/sonic_R5G5B5A1.pvr Binary files differdeleted file mode 100644 index c7fa098d..00000000 --- a/examples/textures/resources/texture_formats/sonic_R5G5B5A1.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R5G6B5.dds b/examples/textures/resources/texture_formats/sonic_R5G6B5.dds Binary files differdeleted file mode 100644 index 217da954..00000000 --- a/examples/textures/resources/texture_formats/sonic_R5G6B5.dds +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R5G6B5.pvr b/examples/textures/resources/texture_formats/sonic_R5G6B5.pvr Binary files differdeleted file mode 100644 index 9bb8320e..00000000 --- a/examples/textures/resources/texture_formats/sonic_R5G6B5.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R8G8B8.pvr b/examples/textures/resources/texture_formats/sonic_R8G8B8.pvr Binary files differdeleted file mode 100644 index 072cf3ef..00000000 --- a/examples/textures/resources/texture_formats/sonic_R8G8B8.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R8G8B8A8.pvr b/examples/textures/resources/texture_formats/sonic_R8G8B8A8.pvr Binary files differdeleted file mode 100644 index f82534f9..00000000 --- a/examples/textures/resources/texture_formats/sonic_R8G8B8A8.pvr +++ /dev/null diff --git a/examples/textures/resources/texture_formats/sonic_R8G8B8A8.raw b/examples/textures/resources/texture_formats/sonic_R8G8B8A8.raw Binary files differdeleted file mode 100644 index fc5858e7..00000000 --- a/examples/textures/resources/texture_formats/sonic_R8G8B8A8.raw +++ /dev/null diff --git a/examples/textures/textures_formats_loading.c b/examples/textures/textures_formats_loading.c deleted file mode 100644 index f416ce38..00000000 --- a/examples/textures/textures_formats_loading.c +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************************* -* -* raylib [textures] example - texture formats loading (compressed and uncompressed) -* -* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed textures, -* OpenGL 1.1 does not support compressed textures, only uncompressed ones. -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -#define NUM_TEXTURES 24 - -typedef enum { - PNG_R8G8B8A8 = 0, - PVR_GRAYSCALE, - PVR_GRAY_ALPHA, - PVR_R5G6B5, - PVR_R5G5B5A1, - PVR_R4G4B4A4, - DDS_R5G6B5, - DDS_R5G5B5A1, - DDS_R4G4B4A4, - DDS_R8G8B8A8, - DDS_DXT1_RGB, - DDS_DXT1_RGBA, - DDS_DXT3_RGBA, - DDS_DXT5_RGBA, - PKM_ETC1_RGB, - PKM_ETC2_RGB, - PKM_ETC2_EAC_RGBA, - KTX_ETC1_RGB, - KTX_ETC2_RGB, - KTX_ETC2_EAC_RGBA, - ASTC_4x4_LDR, - ASTC_8x8_LDR, - PVR_PVRT_RGB, - PVR_PVRT_RGBA - -} TextureFormats; - -static const char *formatText[] = { - "PNG_R8G8B8A8", - "PVR_GRAYSCALE", - "PVR_GRAY_ALPHA", - "PVR_R5G6B5", - "PVR_R5G5B5A1", - "PVR_R4G4B4A4", - "DDS_R5G6B5", - "DDS_R5G5B5A1", - "DDS_R4G4B4A4", - "DDS_R8G8B8A8", - "DDS_DXT1_RGB", - "DDS_DXT1_RGBA", - "DDS_DXT3_RGBA", - "DDS_DXT5_RGBA", - "PKM_ETC1_RGB", - "PKM_ETC2_RGB", - "PKM_ETC2_EAC_RGBA", - "KTX_ETC1_RGB", - "KTX_ETC2_RGB", - "KTX_ETC2_EAC_RGBA", - "ASTC_4x4_LDR", - "ASTC_8x8_LDR", - "PVR_PVRT_RGB", - "PVR_PVRT_RGBA" -}; - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture formats loading"); - - // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) - - Texture2D sonic[NUM_TEXTURES]; - - sonic[PNG_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic.png"); - - // Load UNCOMPRESSED PVR texture data - sonic[PVR_GRAYSCALE] = LoadTexture("resources/texture_formats/sonic_GRAYSCALE.pvr"); - sonic[PVR_GRAY_ALPHA] = LoadTexture("resources/texture_formats/sonic_L8A8.pvr"); - sonic[PVR_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.pvr"); - sonic[PVR_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_R5G5B5A1.pvr"); - sonic[PVR_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_R4G4B4A4.pvr"); - - // Load UNCOMPRESSED DDS texture data - sonic[DDS_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.dds"); - sonic[DDS_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_A1R5G5B5.dds"); - sonic[DDS_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_A4R4G4B4.dds"); - sonic[DDS_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic_A8R8G8B8.dds"); - - // Load COMPRESSED DXT DDS texture data (if supported) - sonic[DDS_DXT1_RGB] = LoadTexture("resources/texture_formats/sonic_DXT1_RGB.dds"); - sonic[DDS_DXT1_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT1_RGBA.dds"); - sonic[DDS_DXT3_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT3_RGBA.dds"); - sonic[DDS_DXT5_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT5_RGBA.dds"); - - // Load COMPRESSED ETC texture data (if supported) - sonic[PKM_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.pkm"); - sonic[PKM_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.pkm"); - sonic[PKM_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm"); - - sonic[KTX_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.ktx"); - sonic[KTX_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.ktx"); - sonic[KTX_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx"); - - // Load COMPRESSED ASTC texture data (if supported) - sonic[ASTC_4x4_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_4x4_ldr.astc"); - sonic[ASTC_8x8_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_8x8_ldr.astc"); - - // Load COMPRESSED PVR texture data (if supported) - sonic[PVR_PVRT_RGB] = LoadTexture("resources/texture_formats/sonic_PVRT_RGB.pvr"); - sonic[PVR_PVRT_RGBA] = LoadTexture("resources/texture_formats/sonic_PVRT_RGBA.pvr"); - - int selectedFormat = PNG_R8G8B8A8; - - Rectangle selectRecs[NUM_TEXTURES]; - - for (int i = 0; i < NUM_TEXTURES; i++) - { - if (i < NUM_TEXTURES/2) selectRecs[i] = (Rectangle){ 40, 30 + 32*i, 150, 30 }; - else selectRecs[i] = (Rectangle){ 40 + 152, 30 + 32*(i - NUM_TEXTURES/2), 150, 30 }; - } - - // Texture sizes in KB - float textureSizes[NUM_TEXTURES] = { - 512*512*32/8/1024, //PNG_R8G8B8A8 (32 bpp) - 512*512*8/8/1024, //PVR_GRAYSCALE (8 bpp) - 512*512*16/8/1024, //PVR_GRAY_ALPHA (16 bpp) - 512*512*16/8/1024, //PVR_R5G6B5 (16 bpp) - 512*512*16/8/1024, //PVR_R5G5B5A1 (16 bpp) - 512*512*16/8/1024, //PVR_R4G4B4A4 (16 bpp) - 512*512*16/8/1024, //DDS_R5G6B5 (16 bpp) - 512*512*16/8/1024, //DDS_R5G5B5A1 (16 bpp) - 512*512*16/8/1024, //DDS_R4G4B4A4 (16 bpp) - 512*512*32/8/1024, //DDS_R8G8B8A8 (32 bpp) - 512*512*4/8/1024, //DDS_DXT1_RGB (4 bpp) -Compressed- - 512*512*4/8/1024, //DDS_DXT1_RGBA (4 bpp) -Compressed- - 512*512*8/8/1024, //DDS_DXT3_RGBA (8 bpp) -Compressed- - 512*512*8/8/1024, //DDS_DXT5_RGBA (8 bpp) -Compressed- - 512*512*4/8/1024, //PKM_ETC1_RGB (4 bpp) -Compressed- - 512*512*4/8/1024, //PKM_ETC2_RGB (4 bpp) -Compressed- - 512*512*8/8/1024, //PKM_ETC2_EAC_RGBA (8 bpp) -Compressed- - 512*512*4/8/1024, //KTX_ETC1_RGB (4 bpp) -Compressed- - 512*512*4/8/1024, //KTX_ETC2_RGB (4 bpp) -Compressed- - 512*512*8/8/1024, //KTX_ETC2_EAC_RGBA (8 bpp) -Compressed- - 512*512*8/8/1024, //ASTC_4x4_LDR (8 bpp) -Compressed- - 512*512*2/8/1024, //ASTC_8x8_LDR (2 bpp) -Compressed- - 512*512*4/8/1024, //PVR_PVRT_RGB (4 bpp) -Compressed- - 512*512*4/8/1024, //PVR_PVRT_RGBA (4 bpp) -Compressed- - }; - - SetTargetFPS(60); // Set our game to run at 60 frames-per-second - //--------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - // Update - //---------------------------------------------------------------------------------- - if (IsKeyPressed(KEY_DOWN)) - { - selectedFormat++; - if (selectedFormat >= NUM_TEXTURES) selectedFormat = 0; - } - else if (IsKeyPressed(KEY_UP)) - { - selectedFormat--; - if (selectedFormat < 0) selectedFormat = NUM_TEXTURES - 1; - } - else if (IsKeyPressed(KEY_RIGHT)) - { - if (selectedFormat < NUM_TEXTURES/2) selectedFormat += NUM_TEXTURES/2; - } - else if (IsKeyPressed(KEY_LEFT)) - { - if (selectedFormat >= NUM_TEXTURES/2) selectedFormat -= NUM_TEXTURES/2; - } - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - - BeginDrawing(); - - ClearBackground(RAYWHITE); - - // Draw rectangles - for (int i = 0; i < NUM_TEXTURES; i++) - { - if (i == selectedFormat) - { - DrawRectangleRec(selectRecs[i], SKYBLUE); - DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE); - DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[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(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)/2, selectRecs[i].y + 11, 10, DARKGRAY); - } - } - - // Draw selected texture - if (sonic[selectedFormat].id != 0) - { - DrawTexture(sonic[selectedFormat], 350, -10, WHITE); - } - else - { - DrawRectangleLines(488, 165, 200, 110, DARKGRAY); - DrawText("FORMAT", 550, 180, 20, MAROON); - DrawText("NOT SUPPORTED", 500, 210, 20, MAROON); - DrawText("ON YOUR GPU", 520, 240, 20, MAROON); - } - - DrawText("Select texture format (use cursor keys):", 40, 10, 10, DARKGRAY); - DrawText("Required GPU memory size (VRAM):", 40, 427, 10, DARKGRAY); - DrawText(FormatText("%4.0f KB", textureSizes[selectedFormat]), 240, 420, 20, DARKBLUE); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(sonic[i]); - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/examples/textures/textures_formats_loading.png b/examples/textures/textures_formats_loading.png Binary files differdeleted file mode 100644 index 6778080f..00000000 --- a/examples/textures/textures_formats_loading.png +++ /dev/null diff --git a/examples/textures/textures_particles_trail_blending.c b/examples/textures/textures_particles_blending.c index 0b47c790..842ac77d 100644 --- a/examples/textures/textures_particles_trail_blending.c +++ b/examples/textures/textures_particles_blending.c @@ -1,11 +1,11 @@ /******************************************************************************************* * -* raylib example - particles trail blending +* raylib example - particles blending * -* This example has been created using raylib 1.3 (www.raylib.com) +* This example has been created using raylib 1.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Copyright (c) 2015 Ramon Santamaria (@raysan5) +* Copyright (c) 2017 Ramon Santamaria (@raysan5) * ********************************************************************************************/ @@ -30,7 +30,7 @@ int main() int screenWidth = 800; int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles trail blending"); + InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles blending"); // Particles pool, reuse them! Particle mouseTail[MAX_PARTICLES]; diff --git a/examples/textures/textures_particles_blending.png b/examples/textures/textures_particles_blending.png Binary files differnew file mode 100644 index 00000000..f90a87fd --- /dev/null +++ b/examples/textures/textures_particles_blending.png diff --git a/examples/textures/textures_particles_trail_blending.png b/examples/textures/textures_particles_trail_blending.png Binary files differdeleted file mode 100644 index b0c40fd2..00000000 --- a/examples/textures/textures_particles_trail_blending.png +++ /dev/null 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 Binary files differindex 374d2266..437e4b53 100644 --- a/examples/textures/textures_raw_data.png +++ b/examples/textures/textures_raw_data.png diff --git a/examples/textures/textures_rectangle.c b/examples/textures/textures_rectangle.c index cca5b216..c90db8ac 100644 --- a/examples/textures/textures_rectangle.c +++ b/examples/textures/textures_rectangle.c @@ -11,6 +11,9 @@ #include "raylib.h" +#define MAX_FRAME_SPEED 15 +#define MIN_FRAME_SPEED 1 + int main() { // Initialization @@ -21,11 +24,16 @@ int main() InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle"); // 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 - Vector2 position = { 350.0f, 240.0f }; - Rectangle frameRec = { 0, 0, guybrush.width/7, guybrush.height }; + Vector2 position = { 350.0f, 280.0f }; + Rectangle frameRec = { 0, 0, scarfy.width/6, scarfy.height }; int currentFrame = 0; + + int framesCounter = 0; + int framesSpeed = 8; // Number of spritesheet frames shown by second + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop @@ -33,14 +41,23 @@ int main() { // Update //---------------------------------------------------------------------------------- - if (IsKeyPressed(KEY_RIGHT)) + framesCounter++; + + if (framesCounter >= (60/framesSpeed)) { + framesCounter = 0; currentFrame++; - if (currentFrame > 6) currentFrame = 0; + if (currentFrame > 5) currentFrame = 0; - frameRec.x = currentFrame*guybrush.width/7; + frameRec.x = currentFrame*scarfy.width/6; } + + if (IsKeyPressed(KEY_RIGHT)) framesSpeed++; + else if (IsKeyPressed(KEY_LEFT)) framesSpeed--; + + if (framesSpeed > MAX_FRAME_SPEED) framesSpeed = MAX_FRAME_SPEED; + else if (framesSpeed < MIN_FRAME_SPEED) framesSpeed = MIN_FRAME_SPEED; //---------------------------------------------------------------------------------- // Draw @@ -49,19 +66,23 @@ int main() ClearBackground(RAYWHITE); - DrawTexture(guybrush, 35, 40, WHITE); - DrawRectangleLines(35, 40, guybrush.width, guybrush.height, LIME); - - DrawTextureRec(guybrush, frameRec, position, WHITE); // Draw part of the texture + DrawTexture(scarfy, 15, 40, WHITE); + DrawRectangleLines(15, 40, scarfy.width, scarfy.height, LIME); + DrawRectangleLines(15 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED); - DrawRectangleLines(35 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED); + DrawText("FRAME SPEED: ", 165, 210, 10, DARKGRAY); + DrawText(FormatText("%02i FPS", framesSpeed), 575, 210, 10, DARKGRAY); + DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, DARKGRAY); - DrawText("PRESS RIGHT KEY to", 540, 310, 10, GRAY); - DrawText("CHANGE DRAWING RECTANGLE", 520, 330, 10, GRAY); + for (int i = 0; i < MAX_FRAME_SPEED; i++) + { + if (i < framesSpeed) DrawRectangle(250 + 21*i, 205, 20, 20, RED); + DrawRectangleLines(250 + 21*i, 205, 20, 20, MAROON); + } - DrawText("Guybrush Ulysses Threepwood,", 100, 300, 10, GRAY); - DrawText("main character of the Monkey Island series", 80, 320, 10, GRAY); - DrawText("of computer adventure games by LucasArts.", 80, 340, 10, GRAY); + DrawTextureRec(scarfy, frameRec, position, WHITE); // Draw part of the texture + + DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY); EndDrawing(); //---------------------------------------------------------------------------------- @@ -69,7 +90,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_rectangle.png b/examples/textures/textures_rectangle.png Binary files differindex d89404ab..aa66464e 100644 --- a/examples/textures/textures_rectangle.png +++ b/examples/textures/textures_rectangle.png 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 Binary files differindex 9ea00fe4..7691ff2e 100644 --- a/examples/textures/textures_srcrec_dstrec.png +++ b/examples/textures/textures_srcrec_dstrec.png |
