diff options
| author | Christian Cunningham <cc@local.lan> | 2025-03-02 19:09:22 -0800 |
|---|---|---|
| committer | Christian Cunningham <cc@local.lan> | 2025-03-02 19:09:22 -0800 |
| commit | 2b402d17676ef85a45cf4f8a05660e62443bbb9e (patch) | |
| tree | 891261a2e0c4fc7b96d9a0c25a01a59093139f1e | |
| parent | a154b5f6d4cea43569b7215fed7b8eca47669d56 (diff) | |
Drawing image with Raylib
| -rw-r--r-- | src/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -37,6 +37,19 @@ int main() return 1; } + Image RaylibImage; + RaylibImage.data = raster; + RaylibImage.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; + RaylibImage.width = width; + RaylibImage.height = height; + RaylibImage.mipmaps = 1; + Texture2D RaylibTexture = LoadTextureFromImage(RaylibImage); + + Rectangle sourceRec = { 0.0f, 0.0f, (float)width, (float)height }; + Rectangle destRec = { 0.0f, 0.0f, (float)80, (float)80 }; + + Vector2 origin = { (float)0, (float)-10 }; + SetTargetFPS(60); Camera2D camera = { 0 }; camera.zoom = 1.0f; @@ -49,7 +62,8 @@ int main() ClearBackground(RAYWHITE); BeginMode2D(camera); EndMode2D(); - DrawText("Image Manip", 0, 0, 0, DARKGRAY); + DrawText("Image Manip", 0, 0, 10, DARKGRAY); + DrawTexturePro(RaylibTexture, sourceRec, destRec, origin, (float)0, RAYWHITE); EndDrawing(); //----------------------------------------------- } |
