Skip to content

Commit

Permalink
use new ImGui::ImageButton API
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Sep 10, 2024
1 parent 767971d commit 3255497
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/immvision/internal/drawing/internal_icons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ namespace ImmVision
ImmVision::Image("test2", img, &imageParams2);

ImVec2 iconSize(15.f, 15.f);
ImGui::ImageButton(GetIcon(IconType::ZoomScaleOne), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomPlus), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomMinus), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomFullView), iconSize);
ImGui::ImageButton(GetIcon(IconType::AdjustLevels), iconSize);
ImGui::ImageButton("ZoomScaleOne", GetIcon(IconType::ZoomScaleOne), iconSize);
ImGui::ImageButton("ZoomPlus", GetIcon(IconType::ZoomPlus), iconSize);
ImGui::ImageButton("ZoomMinus", GetIcon(IconType::ZoomMinus), iconSize);
ImGui::ImageButton("ZoomFullView", GetIcon(IconType::ZoomFullView), iconSize);
ImGui::ImageButton("AdjustLevels", GetIcon(IconType::AdjustLevels), iconSize);
}

void ClearIconsTextureCache()
Expand Down
4 changes: 3 additions & 1 deletion src/immvision/internal/gl/gl_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ namespace ImmVision
ImVec2 size_(size);
if (size.x == 0.f)
size_ = this->mImageSize;
return ImGui::ImageButton(this->mImTextureId, size_, uv0, uv1, frame_padding, bg_col, tint_col);
char id[64];
snprintf(id, 64, "##%p", this->mImTextureId);
return ImGui::ImageButton(id, this->mImTextureId, size_, uv0, uv1, bg_col, tint_col);
}

void GlTexture::Draw_DisableDragWindow(const ImVec2 &size, bool disableDragWindow) const
Expand Down
14 changes: 8 additions & 6 deletions src_all_in_one/immvision/immvision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7015,11 +7015,11 @@ namespace ImmVision
ImmVision::Image("test2", img, &imageParams2);

ImVec2 iconSize(15.f, 15.f);
ImGui::ImageButton(GetIcon(IconType::ZoomScaleOne), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomPlus), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomMinus), iconSize);
ImGui::ImageButton(GetIcon(IconType::ZoomFullView), iconSize);
ImGui::ImageButton(GetIcon(IconType::AdjustLevels), iconSize);
ImGui::ImageButton("ZoomScaleOne", GetIcon(IconType::ZoomScaleOne), iconSize);
ImGui::ImageButton("ZoomPlus", GetIcon(IconType::ZoomPlus), iconSize);
ImGui::ImageButton("ZoomMinus", GetIcon(IconType::ZoomMinus), iconSize);
ImGui::ImageButton("ZoomFullView", GetIcon(IconType::ZoomFullView), iconSize);
ImGui::ImageButton("AdjustLevels", GetIcon(IconType::AdjustLevels), iconSize);
}

void ClearIconsTextureCache()
Expand Down Expand Up @@ -7220,7 +7220,9 @@ namespace ImmVision
ImVec2 size_(size);
if (size.x == 0.f)
size_ = this->mImageSize;
return ImGui::ImageButton(this->mImTextureId, size_, uv0, uv1, frame_padding, bg_col, tint_col);
char id[64];
snprintf(id, 64, "##%p", this->mImTextureId);
return ImGui::ImageButton(id, this->mImTextureId, size_, uv0, uv1, bg_col, tint_col);
}

void GlTexture::Draw_DisableDragWindow(const ImVec2 &size, bool disableDragWindow) const
Expand Down

0 comments on commit 3255497

Please sign in to comment.