![]() |
Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
|
#include <file.hpp>
Public Member Functions | |
| ~File () | |
| void | flush () const |
| void | close () |
| void | seek (int offset, Whence whence) const |
| int | getSize () const |
| std::string | getAsText () |
| std::string | getAbsolutePath () |
| int | getPosition () |
| std::string | getLine () |
| bool | eofReached () const |
| void | storeString (const std::string &str) |
| void | storeLine (const std::string &str) |
Static Public Member Functions | |
| static std::string | getAbsoluteFilePath (const std::string &path) |
| static File * | open (std::string path, const std::string &mode) |
| static int | getFileSize (const std::string &path) |
| static bool | fileExists (const std::string &path) |
| static std::string | getFileAsText (std::string path) |
| static void | fileCopy (const std::string &path1, const std::string &path2) |
| static void | fileDelete (const std::string &path) |
| static void | directoryCreate (const std::string &path) |
| static std::vector< std::string > | directoryEnumerate (const std::string &path) |
Public Attributes | |
| std::string | mode |
| std::string | path |
Can be used to access the host filesystem. Generally, you would only want access to an app-specific folder (for save data, for example) or to the root of the app. So, that's exactly what you get!
When trying to access a file anywhere in calamity engine, you can use the user:// and res:// prefixes to access the user folder and the base folder of the app respectively:
You can also write to files:
If you structured your project like was recommended in the getting started guide, you access your game assets like so:
| File::~File | ( | ) |
| void File::close | ( | ) |
|
static |
|
static |
| bool File::eofReached | ( | ) | const |
|
static |
|
static |
|
static |
| void File::flush | ( | ) | const |
|
static |
| std::string File::getAbsolutePath | ( | ) |
| std::string File::getAsText | ( | ) |
|
static |
|
static |
| std::string File::getLine | ( | ) |
| int File::getPosition | ( | ) |
| int File::getSize | ( | ) | const |
|
static |
| void File::seek | ( | int | offset, |
| Whence | whence | ||
| ) | const |
| void File::storeLine | ( | const std::string & | str | ) |
| void File::storeString | ( | const std::string & | str | ) |
| std::string File::mode |
| std::string File::path |