Browse Source

Merge pull request #7 from SplatTab/main Add rlImGuiImageButton

Jeffery Myers 3 years ago
parent
commit
267b4d5bee
3 changed files with 7 additions and 1 deletions
  1. 1 0
      README.md
  2. 5 1
      rlImGui.cpp
  3. 1 0
      rlImGui.h

+ 1 - 0
README.md

@@ -68,6 +68,7 @@ rlImGuiAddForkAwesomeIconFonts(12);
 Raylib textures can be drawn in ImGui using the following functions
 Raylib textures can be drawn in ImGui using the following functions
 ```
 ```
 void rlImGuiImage(const Texture *image);
 void rlImGuiImage(const Texture *image);
+bool rlImGuiImageButton(const Texture *image);
 void rlImGuiImageSize(const Texture *image, int width, int height);
 void rlImGuiImageSize(const Texture *image, int width, int height);
 void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);
 void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);
 ```
 ```

+ 5 - 1
rlImGui.cpp

@@ -434,6 +434,10 @@ void rlImGuiImage(const Texture *image)
     ImGui::Image((ImTextureID)image, ImVec2(float(image->width), float(image->height)));
     ImGui::Image((ImTextureID)image, ImVec2(float(image->width), float(image->height)));
 }
 }
 
 
+bool rlImGuiImageButton(const Texture *image) {
+    return ImGui::ImageButton((ImTextureID)image, ImVec2(float(image->width), float(image->height)));
+}
+
 void rlImGuiImageSize(const Texture *image, int width, int height)
 void rlImGuiImageSize(const Texture *image, int width, int height)
 {
 {
     ImGui::Image((ImTextureID)image, ImVec2(float(width), float(height)));
     ImGui::Image((ImTextureID)image, ImVec2(float(width), float(height)));
@@ -467,4 +471,4 @@ void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Recta
     }
     }
 
 
     ImGui::Image((ImTextureID)image, ImVec2(float(destWidth), float(destHeight)),uv0,uv1);
     ImGui::Image((ImTextureID)image, ImVec2(float(destWidth), float(destHeight)),uv0,uv1);
-}
+}

+ 1 - 0
rlImGui.h

@@ -49,6 +49,7 @@ void rlImGuiReloadFonts();
 
 
 // image API
 // image API
 void rlImGuiImage(const Texture *image);
 void rlImGuiImage(const Texture *image);
+bool rlImGuiImageButton(const Texture *image);
 void rlImGuiImageSize(const Texture *image, int width, int height);
 void rlImGuiImageSize(const Texture *image, int width, int height);
 void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);
 void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);