diff --git a/imgui-SFML.cpp b/imgui-SFML.cpp index 44e8477..d9c4f52 100644 --- a/imgui-SFML.cpp +++ b/imgui-SFML.cpp @@ -572,10 +572,12 @@ void ProcessEvent(const sf::Event& event) { if (s_currWindowCtx->windowHasFocus) { switch (event.type) { case sf::Event::Resized: - io.DisplaySize = ImVec2(event.size.width, event.size.height); + io.DisplaySize = + ImVec2(static_cast(event.size.width), static_cast(event.size.height)); break; case sf::Event::MouseMoved: - io.AddMousePosEvent(event.mouseMove.x, event.mouseMove.y); + io.AddMousePosEvent(static_cast(event.mouseMove.x), + static_cast(event.mouseMove.y)); s_currWindowCtx->mouseMoved = true; break; case sf::Event::MouseButtonPressed: // fall-through @@ -804,11 +806,12 @@ bool UpdateFontTexture() { sf::Texture& texture = s_currWindowCtx->fontTexture; #if SFML_VERSION_MAJOR >= 3 - if (!texture.create(sf::Vector2u(width, height))) { + if (!texture.create( + sf::Vector2u(static_cast(width), static_cast(height)))) { return false; } #else - if (!texture.create(width, height)) { + if (!texture.create(static_cast(width), static_cast(height))) { return false; } #endif @@ -994,8 +997,8 @@ void Image(const sf::Sprite& sprite, const sf::Vector2f& size, const sf::Color& } const sf::Texture& texture = *texturePtr; #endif - sf::Vector2f textureSize = static_cast(texture.getSize()); - const sf::IntRect& textureRect = sprite.getTextureRect(); + const sf::Vector2f textureSize(texture.getSize()); + const sf::FloatRect textureRect(sprite.getTextureRect()); ImVec2 uv0(textureRect.left / textureSize.x, textureRect.top / textureSize.y); ImVec2 uv1((textureRect.left + textureRect.width) / textureSize.x, (textureRect.top + textureRect.height) / textureSize.y); @@ -1062,8 +1065,8 @@ bool ImageButton(const sf::Sprite& sprite, const sf::Vector2f& size, const int f } const sf::Texture& texture = *texturePtr; #endif - sf::Vector2f textureSize = static_cast(texture.getSize()); - const sf::IntRect& textureRect = sprite.getTextureRect(); + const sf::Vector2f textureSize(texture.getSize()); + const sf::FloatRect textureRect(sprite.getTextureRect()); ImVec2 uv0(textureRect.left / textureSize.x, textureRect.top / textureSize.y); ImVec2 uv1((textureRect.left + textureRect.width) / textureSize.x, (textureRect.top + textureRect.height) / textureSize.y); @@ -1249,10 +1252,11 @@ void RenderDrawLists(ImDrawData* draw_data) { clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x; clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y; - if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && + if (clip_rect.x < static_cast(fb_width) && + clip_rect.y < static_cast(fb_height) && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f) { // Apply scissor/clipping rectangle - glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), + glScissor((int)clip_rect.x, (int)(static_cast(fb_height) - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y)); // Bind texture, Draw @@ -1282,7 +1286,7 @@ void RenderDrawLists(ImDrawData* draw_data) { (GLsizei)last_viewport[3]); glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]); - glShadeModel(last_shade_model); + glShadeModel((GLenum)last_shade_model); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode); #ifdef GL_VERSION_ES_CL_1_1 @@ -1338,7 +1342,8 @@ void updateJoystickButtonState(ImGuiIO& io) { for (int i = 0; i < static_cast(sf::Joystick::ButtonCount); ++i) { ImGuiKey key = s_currWindowCtx->joystickMapping[i]; if (key != ImGuiKey_None) { - bool isPressed = sf::Joystick::isButtonPressed(s_currWindowCtx->joystickId, i); + bool isPressed = sf::Joystick::isButtonPressed(s_currWindowCtx->joystickId, + static_cast(i)); if (s_currWindowCtx->windowHasFocus || !isPressed) { io.AddKeyEvent(key, isPressed); }