diff options
| author | _Tradam <[email protected]> | 2022-07-14 18:50:39 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-07-14 18:50:39 -0400 |
| commit | 203b8e04ad961c91d544a0907a563a0e3cd2c29a (patch) | |
| tree | 874a370ee55c0708ceffd5482e30e1a074daceb1 | |
| parent | b9eacd472bfbbc736ae69e525468cac1f4cae9d8 (diff) | |
| parent | 9dcd4c4075f7c0538e6ca09fc7afa5de2243e5da (diff) | |
| download | raylib-DrawTexturePro-interactive-demo-203b8e04ad961c91d544a0907a563a0e3cd2c29a.tar.gz raylib-DrawTexturePro-interactive-demo-203b8e04ad961c91d544a0907a563a0e3cd2c29a.zip | |
Merge pull request #1 from Peter0x44/master
Allow changing the texture used
| -rw-r--r-- | main.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -110,6 +110,8 @@ void CheckDifference(); void DrawCodeDisplay(); void DrawOutput(); +void HandleDroppedFiles(); + int main() { InitWindow(screenWidth, screenHeight, "DrawTexturePro Example"); @@ -138,6 +140,8 @@ int main() while (!WindowShouldClose()) { + HandleDroppedFiles(); + BeginDrawing(); ClearBackground(RAYWHITE); @@ -850,3 +854,17 @@ void DrawOutput() { ); }; + +void HandleDroppedFiles() +{ + if (IsFileDropped()) { + FilePathList droppedFiles = LoadDroppedFiles(); + Texture2D tmp = LoadTexture(droppedFiles.paths[0]); + if (tmp.id != 0) { + // Texture loaded successfully + UnloadTexture(sampleSprite); + sampleSprite = tmp; + } + UnloadDroppedFiles(droppedFiles); + } +} |
