Skip to content

Commit

Permalink
No need to cast to void* if ImTextureID is defined in imconfig-SFML.h
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasdaler committed Sep 12, 2018
1 parent 0a13622 commit e71bd24
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion imconfig-SFML.h
Original file line number Diff line number Diff line change
@@ -35,4 +35,6 @@
#endif
#else
#define IMGUI_API
#endif
#endif

#define ImTextureID unsigned int
8 changes: 4 additions & 4 deletions imgui-SFML.cpp
Original file line number Diff line number Diff line change
@@ -459,7 +459,7 @@ void UpdateFontTexture()
texture.create(width, height);
texture.update(pixels);

io.Fonts->TexID = (void*)texture.getNativeHandle();
io.Fonts->TexID = texture.getNativeHandle();
}

sf::Texture& GetFontTexture()
@@ -531,7 +531,7 @@ void Image(const sf::Texture& texture,
void Image(const sf::Texture& texture, const sf::Vector2f& size,
const sf::Color& tintColor, const sf::Color& borderColor)
{
ImGui::Image((void*)texture.getNativeHandle(), size, ImVec2(0, 0), ImVec2(1, 1), tintColor, borderColor);
ImGui::Image(texture.getNativeHandle(), size, ImVec2(0, 0), ImVec2(1, 1), tintColor, borderColor);
}

void Image(const sf::Texture& texture, const sf::FloatRect& textureRect,
@@ -547,7 +547,7 @@ void Image(const sf::Texture& texture, const sf::Vector2f& size, const sf::Float
ImVec2 uv0(textureRect.left / textureSize.x, textureRect.top / textureSize.y);
ImVec2 uv1((textureRect.left + textureRect.width) / textureSize.x,
(textureRect.top + textureRect.height) / textureSize.y);
ImGui::Image((void*)texture.getNativeHandle(), size, uv0, uv1, tintColor, borderColor);
ImGui::Image(texture.getNativeHandle(), size, uv0, uv1, tintColor, borderColor);
}

void Image(const sf::Sprite& sprite,
@@ -739,7 +739,7 @@ bool imageButtonImpl(const sf::Texture& texture, const sf::FloatRect& textureRec
ImVec2 uv1((textureRect.left + textureRect.width) / textureSize.x,
(textureRect.top + textureRect.height) / textureSize.y);

return ImGui::ImageButton((void*)texture.getNativeHandle(), size, uv0, uv1, framePadding, bgColor, tintColor);
return ImGui::ImageButton(texture.getNativeHandle(), size, uv0, uv1, framePadding, bgColor, tintColor);
}

unsigned int getConnectedJoystickId()

1 comment on commit e71bd24

@ocornut
Copy link

@ocornut ocornut commented on e71bd24 Dec 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this is making it impossible to link imgui-sfml with a prebuilt version of imgui:
microsoft/vcpkg#21530

Please sign in to comment.