79271294

Date: 2024-12-11 10:18:00
Score: 0.5
Natty:
Report link

I found that resizing the window after chroma-key has been disabled fixes the performance issues. I'm not sure why this is the case, but a workaround for this issue is to simply force the window to change size and then change it back.

static void disableWindowChromaKey(sf::RenderWindow* window)
{
    HWND windowHWND = window->getSystemHandle();
    SetWindowLongPtr(windowHWND, GWL_EXSTYLE, GetWindowLongPtr(windowHWND, GWL_EXSTYLE) & ~WS_EX_LAYERED);
    window->setSize(sf::Vector2u(window->getSize().x + 1, window->getSize().y));
    window->setSize(sf::Vector2u(window->getSize().x - 1, window->getSize().y));
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ben