Closed Noir- closed 7 years ago
I'm not sure how to do this best. If there are no resources at all, then I can simply not draw anything. To cross-platform be able to show a error dialog box another library would have to be involved. I guess I could hardcode a message, pixel by pixel and if all else fails, draw that to the screen.
you can use a try catch block and send out a warning message box that says to reinstall the game because of missing file < insert here > please dont let the game start if there are missing components
I'm not sure if you read what I just wrote. If there are no resources I can't draw anything to the screen. It is not possible to create a message box without additional libraries.
Can't we draw warnings / error without relying on sfml?
Please have a look its cross-platform compatible
http://codereview.stackexchange.com/questions/74463/cross-platform-message-box-library
You can draw text using just SFML and TGUI without loading external files because TGUI has a built-in font. Just create a window and a tgui::Gui object and use *gui.getFont()
as font for your text object.
Edit: or use a tgui::Label instead of an sf::Text, since you already have to create a Gui object anyway, then you don't even have to set the font manually.
Very good. Thank you!
How to reproduce
Remove/move/rename the
sounds
andmedia
folder and execute the game.Current behavior
The game hangs.
Expected behavior
When the folders don't exist, it should show a error message and maybe the hint to re-install the game.