3069505852
Améliore un affichage de chemin de fichier L'utilisateur peut choisir son fichier cible pour l'enregistrement !
81 lines
2.3 KiB
C
81 lines
2.3 KiB
C
#include "tinyFileDialogsCalls.h"
|
|
|
|
|
|
const char* chooseSavingFile(sfRenderWindow *const window, const sfSprite *const renderSprite)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
char defaultPath[MAXPATH];
|
|
getcwd(defaultPath, MAXPATH);
|
|
strncat(defaultPath, "/"DATADIRECTORY"/logsSecured.txt", MAXPATH);
|
|
|
|
const char *temp = tinyfd_saveFileDialog("Où enregistrer les données ?", defaultPath, 0, NULL, NULL);
|
|
|
|
sfRenderWindow_setVisible(window, true);
|
|
displayBackgroundSprite(window, renderSprite);
|
|
|
|
return temp;
|
|
}
|
|
|
|
|
|
const char* chooseFilesToOpen(sfRenderWindow *const window, const sfSprite *const renderSprite, const bool multipleFilesAllowed)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
char defaultPath[MAXPATH];
|
|
getcwd(defaultPath, MAXPATH);
|
|
strncat(defaultPath, "/"DATADIRECTORY"/", MAXPATH);
|
|
|
|
const char *temp = tinyfd_openFileDialog((multipleFilesAllowed ? "Choisir des fichiers à ouvrir" : "Choisir un fichier à ouvrir"), defaultPath, 4, (const char* [4]){"*.txt", "*.text", "*.log", "*.logs"}, NULL, (multipleFilesAllowed ? 1 : 0));
|
|
|
|
sfRenderWindow_setVisible(window, true);
|
|
displayBackgroundSprite(window, renderSprite);
|
|
|
|
return temp;
|
|
}
|
|
|
|
|
|
bool questionBox(sfRenderWindow *const window, const sfSprite *const renderSprite, const char *const message)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
bool temp = (tinyfd_messageBox(PROJECTDESC, message, "yesno", "question", 1) == 0 ? false : true);
|
|
|
|
sfRenderWindow_setVisible(window, true);
|
|
displayBackgroundSprite(window, renderSprite);
|
|
|
|
return temp;
|
|
}
|
|
|
|
|
|
void messageBox(sfRenderWindow *const window, const sfSprite *const renderSprite, const char *const message)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
tinyfd_messageBox(PROJECTDESC, message, "ok", "info", 0);
|
|
|
|
sfRenderWindow_setVisible(window, true);
|
|
displayBackgroundSprite(window, renderSprite);
|
|
}
|
|
|
|
|
|
void warningBox(sfRenderWindow *const window, const sfSprite *const renderSprite, const char *const message)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
tinyfd_messageBox(PROJECTDESC, message, "ok", "warning", 0);
|
|
|
|
sfRenderWindow_setVisible(window, true);
|
|
displayBackgroundSprite(window, renderSprite);
|
|
}
|
|
|
|
|
|
void errorBox(sfRenderWindow *const window, const char *const message)
|
|
{
|
|
sfRenderWindow_setVisible(window, false);
|
|
|
|
tinyfd_messageBox(PROJECTDESC, message, "ok", "error", 0);
|
|
|
|
exit(EXIT_FAILURE);
|
|
}
|