libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
Loading...
Searching...
No Matches
util.cpp File Reference

Implementation of mx::mxUtil and free utility functions (readFile, compress, random). More...

#include "util.hpp"
#include "loadpng.hpp"
#include <sstream>
#include "exception.hpp"
#include <zlib.h>
#include <memory>
#include <fstream>
#include <iostream>
#include <random>
Include dependency graph for util.cpp:

Go to the source code of this file.

Namespaces

namespace  mx

Functions

float mx::generateRandomFloat (float min, float max)
 Generate a random float in the given range.
int mx::generateRandomInt (int min, int max)
 Generate a random integer in the given range.
std::unique_ptr< char[]> mx::compressString (const std::string &text, uLong &len)
 Compress a string using zlib.
std::string mx::decompressString (void *data, uLong size_)
 Decompress a zlib-compressed data block.
std::vector< char > mx::readFile (const std::string &filename)
 Read an entire file into a byte vector.
std::string mx::readFileToString (const std::string &filename)
 Read an entire text file into a string.

Detailed Description

Implementation of mx::mxUtil and free utility functions (readFile, compress, random).

Definition in file util.cpp.