8#ifndef GALAXY_FS_VIRTUALFILESYSTEM_HPP_
9#define GALAXY_FS_VIRTUALFILESYSTEM_HPP_
47 std::string
read(
const std::string& file);
57 std::vector<std::uint8_t>
read_binary(
const std::string& file);
70 bool write(
const std::string& data,
const std::string& file);
83 bool write_binary(std::span<std::uint8_t> data,
const std::string& file);
95 bool write_raw(
const void* data,
const std::size_t size,
const std::string& file);
105 std::optional<ray::Image>
load_ray_image(
const std::string& filename)
noexcept;
116 std::optional<ray::Image>
load_ray_image_anim(
const std::string& filename,
int* frames)
noexcept;
126 std::optional<ray::Texture2D>
load_ray_texture(
const std::string& filename)
noexcept;
136 std::optional<ray::Wave>
load_ray_wave(
const std::string& filename)
noexcept;
158 std::optional<ray::Font>
load_ray_font(
const std::string& filename,
int font_size, std::span<int> font_chars)
noexcept;
167 void mkdir(
const std::string& dir)
noexcept;
176 void remove(
const std::string& path)
noexcept;
186 bool exists(
const std::string& file)
noexcept;
196 bool is_dir(
const std::string& path)
noexcept;
206 std::vector<std::string>
list(
const std::string& dir);
211 void alert()
noexcept;
247 std::string
input_box(
const std::string& title,
const std::string& msg,
const std::string& default_text =
"",
const bool password =
false)
noexcept;
258 std::string
open_save_dialog(
const std::string& default_filename,
const std::vector<const char*>& filters = {});
269 std::string
open_file_dialog(
const std::vector<const char*>& filters = {},
const std::string& def_path =
"");
void alert() noexcept
Trigger a standard filesystem audio alert.
int message_box(const std::string &title, const std::string &msg, const DialogType type, const DialogIcon icon, const DialogButton btn) noexcept
Opens a platform specific message box.
VirtualFileSystem(const VirtualFileSystem &)=delete
Copy constructor.
~VirtualFileSystem() noexcept
Destructor.
bool is_dir(const std::string &path) noexcept
Checks if a file is a folder.
bool write_binary(std::span< std::uint8_t > data, const std::string &file)
Writes a binary file to disk.
std::vector< std::string > list(const std::string &dir)
Get assets in an asset folder.
std::optional< ray::Image > load_ray_image_anim(const std::string &filename, int *frames) noexcept
Load an animated image from VFS (e.g. GIF). You must manually free the data after.
std::string read(const std::string &file)
Read a file.
std::optional< ray::Wave > load_ray_wave(const std::string &filename) noexcept
Load wave data from VFS. You must manually free the data after.
VirtualFileSystem & operator=(const VirtualFileSystem &)=delete
Copy assignment operator.
std::optional< ray::Texture2D > load_ray_texture(const std::string &filename) noexcept
Load a texture from VFS. You must manually free the data after.
bool write_raw(const void *data, const std::size_t size, const std::string &file)
Raw data writing.
bool write(const std::string &data, const std::string &file)
Writes a file to disk.
void notification(const std::string &title, const std::string &msg, const DialogIcon icon) noexcept
Trigger a system notification.
std::string input_box(const std::string &title, const std::string &msg, const std::string &default_text="", const bool password=false) noexcept
Opens a platform specific text input box.
bool exists(const std::string &file) noexcept
Does the file exist in the vfs.
std::string open_file_dialog(const std::vector< const char * > &filters={}, const std::string &def_path="")
Open a file dialog.
std::optional< ray::Image > load_ray_image(const std::string &filename) noexcept
Load an image from VFS. You must manually free the data after.
std::optional< ray::Music > load_ray_music_stream(const std::string &filename) noexcept
Load module music from VFS. You must manually free the data after.
std::string open_save_dialog(const std::string &default_filename, const std::vector< const char * > &filters={})
Open a save file dialog.
std::string select_folder_dialog(const std::string &def_path="")
Select a folder using a dialog.
VirtualFileSystem(VirtualFileSystem &&)=delete
Move constructor.
VirtualFileSystem & operator=(VirtualFileSystem &&)=delete
Move assignment operator.
void remove(const std::string &path) noexcept
Delete a file or folder.
std::optional< ray::Font > load_ray_font(const std::string &filename, int font_size, std::span< int > font_chars) noexcept
Load font from VFS. You must manually free the data after.
VirtualFileSystem() noexcept
Constructor.
std::vector< std::uint8_t > read_binary(const std::string &file)
Read a binary file.
void mkdir(const std::string &dir) noexcept
Creates an empty folder in the filesystem relative to the root.
DialogButton
Type of button for tinyfd boxes.
DialogType
Type of dialog box for use with tinyfd.
DialogIcon
Type of native system icon to display on file dialogs.