Configuru
Classes | Typedefs | Functions
emilib Namespace Reference

Classes

class  CStrRange
 
class  DelayedDirWatcher
 
class  DirWatcher
 
class  Dual
 
class  FastReadWriteMutex
 
class  HashCache
 
class  HashMap
 
struct  HashMapEqualTo
 
class  HashSet
 
struct  HashSetEqualTo
 
class  ImGui_SDL
 
class  Int_
 
class  IteratorRange
 
class  ListMap
 
struct  ListMapEqualTo
 
class  ListSet
 
struct  ListSetEqualTo
 
class  MemMap
 
class  MovementTracker
 
class  Music
 
class  Range
 
class  ReadLock
 
class  RotationTracker
 
class  ScopeGuard
 
class  ShaderMngr
 
class  SlowReadWriteMutex
 
class  StringInterner
 
class  TextureMngr
 
class  ThreadPool
 
class  Timer
 
struct  TupleArrayRef
 
struct  TupleArrayRef< 0 >
 
struct  Wav
 
class  WriteLock
 

Typedefs

using DelayedDirWatcher_UP = std::unique_ptr< DelayedDirWatcher >
 
using ImageData = std::unique_ptr< void, std::function< void(void *)>>
 
using ImageLoader = std::function< ImageData(const char *path, int *width, int *height, int *comp, int req_comp)>
 
using CalcWidth = std::function< float(const std::string &text)>
 

Functions

template<typename T >
constexpr Dual< T > operator+ (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr Dual< T > operator+ (const Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator+ (const T &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator+= (Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator+= (Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator- (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr Dual< T > operator- (const Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator- (const T &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator-= (Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator-= (Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator* (const T &left, const Dual< T > &right)
 
template<typename T >
constexpr Dual< T > operator* (const Dual< T > &left, const T &right)
 
template<typename T >
constexpr void operator*= (Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator* (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator*= (Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr Dual< T > operator/ (const Dual< T > &left, const T &right)
 
template<typename T >
constexpr void operator/= (Dual< T > &left, const T &right)
 
template<typename T >
constexpr Dual< T > operator/ (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr void operator/= (Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr Dual< T > operator+ (const Dual< T > &operand)
 
template<typename T >
constexpr Dual< T > operator- (const Dual< T > &operand)
 
template<typename T >
constexpr bool operator== (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr bool operator!= (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr bool operator< (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr bool operator<= (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr bool operator>= (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
constexpr bool operator> (const Dual< T > &left, const Dual< T > &right)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Dual< T > &x)
 
template<typename Integer >
Range< Integer > irange (Integer end)
 
template<typename Integer >
Range< Integer > irange (Integer begin, Integer end)
 
template<typename Integer >
Range< Integer > irange_inclusive (Integer first, Integer last)
 
template<typename Integer = size_t, typename Container >
Range< Integer > indices (const Container &container)
 
template<typename Integer , typename Visitor >
void repeat (Integer count, const Visitor &visitor)
 
template<typename It >
auto it_range (It begin, It end)
 
template<typename Chr >
CStrRange< Chr > cstr_range (Chr *str)
 
std::vector< float > marching_squares (size_t width, size_t height, const float *iso)
 
float calc_area (size_t num_line_segments, const float *xy)
 Calculate the area of one or several shapes from their outline, as returned by marching_squares.
 
template<class Fun >
ScopeGuard< Fun > make_scope_guard (Fun f)
 
gl::ProgramSource load_shader_file (const std::string &shader_dir, const std::string &name)
 
const char * intern_string (const std::string &str)
 
std::string strprintfv (const char *format, va_list)
 
std::string strprintf (const char *format,...)
 
ImageData load_image_rgba (const ImageLoader &image_loader, const char *path, size_t *out_width, size_t *out_height)
 
bool write_tga (const char *path, size_t width, size_t height, const void *rgba_ptr, bool include_alpha)
 
std::vector< uint8_t > encode_tga (size_t width, size_t height, const void *rgba_ptr, bool include_alpha)
 As above, but returns the tga in memory.
 
template<typename Func , typename... Args>
bool for_each_tuple (std::tuple< Args... > &tup, Func &&func)
 
template<typename Func , typename... Args>
bool for_each_tuple (const std::tuple< Args... > &tup, Func &&func)
 
Wav parse_wav (const void *wav_data, size_t size_bytes)
 
std::vector< std::string > word_wrap (const std::string &text, float max_width, const CalcWidth &calc_width)
 
void unit_test_word_wrap ()
 

Detailed Description

Coroutine-ish feature implemented using a thread. Useful for implementing a script of some sort where a state-machine would be cumbersome. The coroutine (inner) thread is executed only when the owning (outer) thread is paused, and vice versa.

The coroutine has helper functions for waiting for a certain amount of time etc. To keep track of the time, a time delta must be supplied when polling a coroutine. This allows the library user to for instance slow down time by supplying smaller time deltas then the wall clock time.

Example usage can be found in examples/ folder.

Function Documentation

std::vector<float> emilib::marching_squares ( size_t  width,
size_t  height,
const float *  iso 
)

Approximate the iso-surface at threshold = 0. iso is assumed row-major, width * height, with positive values meaning "outside". Returns a bunch of line segments as x0, y0, x1, y1. In a system where (0,0) is top left, the returned line segments will be in clock-wise order.