i have a file.txt with some text i want to read them and view in a render window with this function
void textLoader (){
bool dummy;
string menuLine;
ifstream infile;
infile.open ("Tools/datiMenu.txt");
while(!dummy){
getline(infile,menuLine); // Saves the line in menuLine.
cout<<menuLine <<endl;
menu.setString(menuLine);
dummy=infile.eof();
}
infile.close();
}
the main part if I remove the comment from
// textLoader();
the line
menu.setString("hello!!!");
is not visible any more!
int main(){
RenderWindow window(VideoMode(1000, 600), "Scheduler Simulator",Style::Titlebar);
fontLoad();
menu.setString("hello!!!");
// textLoader();
menu.setCharacterSize(20);
menu.setFillColor(Color::Red);
while (window.isOpen()){ // main Loop
Event event;
while (window.pollEvent(event)){
if (event.type == Event::Closed)
window.close();
}
window.clear(Color::Blue);
window.draw(menu);
window.display();
}
return 0;
}
anyone can help me?