kroyee / SpeedBlocks

Fast paced tetris game cloned from Cultris II
GNU Lesser General Public License v3.0
11 stars 7 forks source link

[BUG] Missing resource folders makes the game hang/crash #37

Closed Noir- closed 7 years ago

Noir- commented 7 years ago

How to reproduce

Remove/move/rename the sounds and media 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.

kroyee commented 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.

zDEFz commented 7 years ago

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

kroyee commented 7 years ago

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.

zDEFz commented 7 years ago

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

http://stackoverflow.com/questions/13500069/simplest-way-to-pop-up-error-message-box-on-windows-nix-and-macos

texus commented 7 years ago

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.

kroyee commented 7 years ago

Very good. Thank you!