| 626 | } |
| 627 | |
| 628 | bool UpdateFontTexture() |
| 629 | { |
| 630 | assert(s_currWindowCtx); |
| 631 | |
| 632 | ImGuiIO& io = ImGui::GetIO(); |
| 633 | unsigned char* pixels = nullptr; |
| 634 | int width = 0; |
| 635 | int height = 0; |
| 636 | |
| 637 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); |
| 638 | |
| 639 | sf::Texture newTexture; |
| 640 | if (!newTexture.resize(sf::Vector2u(sf::Vector2(width, height)))) |
| 641 | { |
| 642 | return false; |
| 643 | } |
| 644 | |
| 645 | newTexture.update(pixels); |
| 646 | |
| 647 | ImTextureID texID = convertGLTextureHandleToImTextureID(newTexture.getNativeHandle()); |
| 648 | io.Fonts->SetTexID(texID); |
| 649 | |
| 650 | s_currWindowCtx->fontTexture = std::move(newTexture); |
| 651 | |
| 652 | return true; |
| 653 | } |
| 654 | |
| 655 | std::optional<sf::Texture>& GetFontTexture() |
| 656 | { |
no test coverage detected