aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-02 19:09:22 -0800
committerChristian C <cc@localhost>2025-03-02 19:09:22 -0800
commit5aa50db3e7710659250b66a6b3eda54a29f21224 (patch)
tree891261a2e0c4fc7b96d9a0c25a01a59093139f1e
parentf29e592996d3a86bfe6dab4b5a8f806878cfbb9c (diff)
Drawing image with Raylib
-rw-r--r--src/main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 221deb1..02697aa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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();
//-----------------------------------------------
}