diff options
author | Christian C <cc@localhost> | 2025-03-02 19:09:22 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-02 19:09:22 -0800 |
commit | 5aa50db3e7710659250b66a6b3eda54a29f21224 (patch) | |
tree | 891261a2e0c4fc7b96d9a0c25a01a59093139f1e /src | |
parent | f29e592996d3a86bfe6dab4b5a8f806878cfbb9c (diff) |
Drawing image with Raylib
Diffstat (limited to 'src')
-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(); //----------------------------------------------- } |