| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | #ifndef SNAPFILE_H#define SNAPFILE_H// Description/*SnapFile is a library based on SDL and SDL_gfx built to manage an index.Author : Jovian HersmeuleLast modification : 14 May 2017> Why is it relevant to use index ?Index are commonly used to list files inside a folder. Using index isrelevant because it doesn't rely on a specific exploitation system.Indeed, listing files in a folder recquires specific libraries whichare different between Windows and Linux.> What can perform SnapFile ?SnapFile has many functions do update and read your index. Thanks to SDL, SnapFilecan create windows in order to interact easily with a user, in order to type a filename or to choose a file from the index.*/// Basic includes#include <iostream>#include <vector>#include <fstream>// Graphic includes#include <SDL/SDL.h>#include <SDL/SDL_gfxPrimitives.h>// Graphic configstruct SF_Graphic{	unsigned int h;	unsigned int w;	Uint32 color_line; // GFX : RGBA	Uint32 color_back; // SDL : ARGB	Uint32 color_select; // GFX : RGBA	std::string name;};// Standard graphic config#define SF_STDGRPH {300, 400, 0xffff00ff, 0xff000000, 0xffffffff, "SnapFile"}// Add files listed in the index givenvoid SF_makeList( const std::string & indexName, std::vector<std::string> & dirList );// Keep files with desired extension, and remove them if wantedvoid SF_filter( std::vector<std::string> & dirList, std::string ext, bool autoRemove = false );// Use a window and return file chosenvoid SF_choose( const std::string & indexName, std::string & fileChosen, SDL_Surface* tgt = nullptr, const SF_Graphic cfg = SF_STDGRPH );// Use a window to write a namevoid SF_keyName( std::string & fileName, SDL_Surface* tgt = nullptr, const SF_Graphic cfg = SF_STDGRPH );// Use a window to add a file, modify arg "fileName"void SF_addAskedFile( const std::string & indexName, std::string & fileName, SDL_Surface* tgt = nullptr, const SF_Graphic cfg = SF_STDGRPH );// Add a file in a index, with occurence checkvoid SF_addFile( const std::string & indexName, const std::string & fileName );// Create a window if needed, return true if creationbool SF_fixWindow( SDL_Surface* & tgt, const SF_Graphic cfg = SF_STDGRPH );// Add shape and estheticvoid SF_enhanceWindow( SDL_Surface* screen, const SF_Graphic & cfg );#endif
 |