Hi everybody
I 'm pretty new in coding C++ and i use QT creator , i created a QT window with a button. when it is clicked on it is supposed to open an SFML window.
no mistakes in compilation , however when the sfml window pop up, the application slow down drastically, also when i click on anything it instantly crash.
so i guess adding an sfml window with a QT window is not that easy, is it even possible ?
here is the code just in case the mistake is from me :
bool MainWindow::InkJetFlush()
{
int IntCountDown(10);
string TxtCountDown("10");
Clock ClTimer;
Time TimeClock;
int32 TimeInt;
float AngleRotation;
Color BackGroudColor = Color::White;
RenderWindow WindFlushTimer(VideoMode(300, 300), "Flush");
Texture TxtNeedle;
Texture TxtClock;
if (!TxtNeedle.loadFromFile("ClockNeedle.png"))
{
return false;
}
Sprite SpNeedle(TxtNeedle);
SpNeedle.setOrigin(56, 9);
SpNeedle.rotate(270);
SpNeedle.setPosition(150, 150);
if (!TxtClock.loadFromFile("C:/Aprojects/InkJetProject/Clock_cadran.png"))
{
return false;
}
Sprite SpClock(TxtClock);
SpClock.setPosition(50, 50);
Font FoCountDown;
if (!FoCountDown.loadFromFile("C:/Aprojects/InkJetProject/arial.ttf"))
return false;
Text TextCountDown(TxtCountDown, FoCountDown, 90);
while (WindFlushTimer.isOpen())
{
Event TimerEv;
WindFlushTimer.clear(BackGroudColor);
WindFlushTimer.draw(SpNeedle);
WindFlushTimer.draw(SpClock);
WindFlushTimer.draw(TextCountDown);
WindFlushTimer.display();
TimeClock = ClTimer.getElapsedTime();
if (TimeClock.asSeconds() == 1)
{
TextCountDown.setString("9");
SpNeedle.rotate(AngleRotation);
if (TimeClock.asSeconds() == 10)
{
WindFlushTimer.close();
}
}
}
return true;
}
PS : as i said i'm new in c++ so i'm sure you will find a lot of thing i did the wrong way, sorry about that, also my english is far from perfect.