[ad_1]
I’ve a most important window whose loop is simply in this system and a Window class through which separate sf::RenderWindow
objects are created and the loops for them are in std::thread
, so when including a button to such a window, the animation is just ignored, though when you add precisely the identical button to the principle window, then every little thing will work advantageous.
I run this perform within the std::thread
:
void Render() {
sf::Occasion occasion;
MSG msg = {};
if (prepare_window_function != nullptr) {
prepare_window_function(this);
}
whereas (Window_ptr->isOpen()) {
whereas (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == 160) {
std::ofstream coords("DaTa_hats/_ParamS_/coords");
coords << Window_ptr->getPosition().x << " " << Window_ptr->getPosition().y << std::endl;
coords.shut();
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
whereas (Window_ptr->pollEvent(occasion)) {
if (occasion.kind == sf::Occasion::KeyReleased and occasion.key.code == sf::Keyboard::D) {
Developer_Mode = 1;
}
if (occasion.kind == sf::Occasion::KeyReleased and occasion.key.code == sf::Keyboard::Escape) {
Developer_Mode = 0;
}
Handle_Events(occasion);
}
Window_ptr->clear(sf::Shade(100, 100, 100, 255));
if (Is_Rendering) {
Draw_All();
}
Window_ptr->show();
if (Pause_After_Start) {
Pause();
Pause_After_Start = 0;
}
}
}
Handel_Events
and Draw_All
are capabilities from a DLL, their contents are the identical because the capabilities of the principle window
[ad_2]