8#include <entt/locator/locator.hpp>
20 auto& lua = entt::locator<sol::state>::value();
46 auto physfs_stream = lua.new_usertype<
fs::PhysfsStream>(
"PhysfsStream", sol::constructors<fs::PhysfsStream(), fs::PhysfsStream(const std::string&)>());
Custom SFML input stream using PhysFS.
bool open(const std::string &filename) noexcept
Open file in physfs.
std::optional< std::size_t > read(void *data, std::size_t size) override
Read data from the stream.
std::optional< std::size_t > seek(std::size_t position) override
Change the current reading position.
std::optional< std::size_t > tell() override
Get the current reading position in the stream.
void close() noexcept
Close the open physfs handle.
std::optional< std::size_t > getSize() override
Return the size of the stream.
bool is_open() const noexcept
Is the physfs file open.
File System to make managing files easier.
bool is_dir(const std::string &path) noexcept
Checks if a file is a folder.
bool exists(const std::string &file) noexcept
Does the file exist in the vfs.
std::vector< std::uint8_t > read_binary(const std::string &file)
Read a binary file.
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.
void mkdir(const std::string &dir) noexcept
Creates an empty folder in the filesystem relative to the root.
bool write_raw(const void *data, const std::size_t size, const std::string &file)
Raw data writing.
std::string select_folder_dialog(const std::string &def_path="")
Select a folder using a dialog.
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.
std::vector< std::string > list(const std::string &dir)
Get assets in an asset folder.
std::string get_file_extension(const std::string &file_name) noexcept
Get pointer to extension for a filename string.
bool write_binary(std::span< std::uint8_t > data, const std::string &file)
Writes a binary file to disk.
void alert() noexcept
Trigger a standard filesystem audio alert.
std::string open_save_dialog(const std::string &default_filename, const std::vector< const char * > &filters={})
Open a save file dialog.
std::string open_file_dialog(const std::vector< const char * > &filters={}, const std::string &def_path="")
Open a file dialog.
std::string read(const std::string &file)
Read a file.
void remove(const std::string &path) noexcept
Delete a file or folder.
DialogIcon
Type of native system icon to display on file dialogs.
DialogType
Type of dialog box for use with tinyfd.
DialogButton
Type of button for tinyfd boxes.
void inject_fs()
Injects VFS support into Lua.