45 std::string
path =
"/assets";
47 std::string
path =
"assets";
55 std::string
getFilePath(
const std::string &filename);
66 void printText(SDL_Renderer *renderer, TTF_Font *font,
int x,
int y,
const std::string &text, SDL_Color col);
74 SDL_Texture *
loadTexture(SDL_Renderer *renderer,
const std::string &filename);
86 SDL_Texture *
loadTexture(SDL_Renderer *renderer,
const std::string &filename,
int &w,
int &h,
bool color, SDL_Color key);
101 TTF_Font *
loadFont(
const std::string &filename,
int size);
117 std::vector<char>
readFile(
const std::string &filename);
140 std::unique_ptr<char[]>
compressString(
const std::string &text, uLong &len);
std::vector< SDL_Joystick * > stick
Open joystick handles.
void initJoystick()
Initialise and open SDL joysticks.
mxUtil(const mxUtil &)=delete
~mxUtil()
Destructor — closes all open joystick handles.
std::string getFilePath(const std::string &filename)
Prepend the asset path to a filename.
SDL_Texture * loadTexture(SDL_Renderer *renderer, const std::string &filename)
Load an SDL_Texture from a file.
SDL_Surface * loadSurface(const std::string &name)
Load an image as an SDL_Surface.
std::string path
Root asset directory (native).
mxUtil & operator=(mxUtil &&)=delete
void printText(SDL_Renderer *renderer, TTF_Font *font, int x, int y, const std::string &text, SDL_Color col)
Render a text string onto an SDL_Renderer.
TTF_Font * loadFont(const std::string &filename, int size)
Load a TTF font at the specified point size.
void closeJoystick()
Close all open SDL joystick handles.
mxUtil & operator=(const mxUtil &)=delete
int generateRandomInt(int min, int max)
Generate a random integer in the given range.
std::unique_ptr< char[]> compressString(const std::string &text, uLong &len)
Compress a string using zlib.
std::string decompressString(void *data, uLong size_)
Decompress a zlib-compressed data block.
std::vector< char > readFile(const std::string &filename)
Read an entire file into a byte vector.
float generateRandomFloat(float min, float max)
Generate a random float in the given range.
std::string readFileToString(const std::string &filename)
Read an entire text file into a string.
Tee stream utilities that duplicate output to two sinks simultaneously.