28 struct SDL_KeyboardEvent;
33 template <
typename T=
int>
49 std::string
ToString()
const {
return "{" + std::to_string(width) +
", " + std::to_string(height) +
" }"; }
65 std::string
ToString()
const {
return "{" + std::to_string(x) +
", " + std::to_string(y) +
" }"; }
111 if(a_.
x <= b_.
x && a_.
y <= b_.
y) {a = a_; b = b_;}
112 else if(a_.
x >= b_.
x && a_.
y >= b_.
y) {a = b_; b = a_;}
113 else if(a_.
x <= b_.
x && a_.
y >= b_.
y) {a = {a_.
x,b_.
y}; b = {b_.
x,a_.
y};}
114 else if(a_.
x >= b_.
x && a_.
y <= b_.
y) {a = {b_.
x,a_.
y}; b = {a_.
x,b_.
y};}
128 return a.
x >= other.
a.
x && a.
y >= other.
a.
y && b.
x <= other.
b.
x && b.
y <= other.
b.
y;
132 template <
typename T>
134 return IsInside(r.
a, r.
Size());
170 KeyData(
const SDL_KeyboardEvent&);
219 static void Wait(
int ms);
221 static void WaitOS(
int ms);
225 static std::string
GetDir(std::string);
260 static std::vector<std::string>
SplitString(std::string str, std::string delimiter);
262 static std::string
JoinString(std::vector<std::string> str, std::string c);
264 static void Replace(std::string& str,
const std::string& from,
const std::string& to);
266 static std::string
Trim(std::string);
274 static float mtof(
float m);
289 #endif //UTILITIES_HPP
Definition: Utilities.hpp:166
Point2D_< T > & operator-=(const Point2D_< T > &other)
Definition: Utilities.hpp:74
Rect MoveOffset(Point2D p) const
Definition: Utilities.hpp:123
KeyData(const SDL_KeyboardEvent &)
unsigned char velocity
Definition: Utilities.hpp:208
static std::string ConvertOSpathToUniPath(const std::string &ospath)
VertAlignment
Definition: Utilities.hpp:149
Definition: Utilities.hpp:145
Definition: Utilities.hpp:214
static std::vector< std::string > SplitString(std::string str, std::string delimiter)
static std::string GetCurrentDir()
Definition: Utilities.hpp:139
static void CopyToClipboard(std::string)
Definition: Utilities.hpp:104
static const char OSDirSeparator
Definition: Utilities.hpp:232
Definition: Utilities.hpp:281
bool ctrl
Definition: Utilities.hpp:178
static void WaitOS(int ms)
std::string symbol
Definition: Utilities.hpp:182
LocaleDecPoint()
Definition: Utilities.hpp:282
static std::string GetDir(std::string)
Point2D_< int > Point2D
Definition: Utilities.hpp:35
Size2D operator+(const Size2D &other) const
Definition: Utilities.hpp:50
std::string ToString() const
Definition: Utilities.hpp:49
~LocaleDecPoint()
Definition: Utilities.hpp:283
static std::string FindSCLang()
int height
Definition: Utilities.hpp:46
unsigned char channel
Definition: Utilities.hpp:206
bool operator==(const Size2D &other) const
Definition: Utilities.hpp:47
Point2D_< T > operator-() const
Definition: Utilities.hpp:68
Definition: Utilities.hpp:150
MouseButton
Definition: Utilities.hpp:190
Definition: Utilities.hpp:164
Definition: Utilities.hpp:147
Rect(Point2D a_, Point2D b_)
Definition: Utilities.hpp:110
Rect(Point2D a_, Size2D s)
Definition: Utilities.hpp:116
bool operator==(const Point2D_< T > &other) const
Definition: Utilities.hpp:63
static void NumericLocaleSetUniversal()
Point2D_< T > operator/(const T &t) const
Definition: Utilities.hpp:69
Definition: Utilities.hpp:165
static const std::string OSLibSuffix
Definition: Utilities.hpp:235
static const std::string OSSCLangBinName
Definition: Utilities.hpp:237
unsigned char number
Definition: Utilities.hpp:207
static std::string Trim(std::string)
static std::string PrettyFloat(float val)
bool Fits(const Size2D &other) const
Definition: Utilities.hpp:43
bool shift
Definition: Utilities.hpp:178
Rect()
Definition: Utilities.hpp:107
Type
Definition: Utilities.hpp:200
Direction
Definition: Utilities.hpp:138
bool operator!=(const Point2D_< T > &other) const
Definition: Utilities.hpp:64
Point2D_(const Point2D_< Q > &other)
Definition: Utilities.hpp:61
Point2D_< T > operator-(const Size2D &other) const
Definition: Utilities.hpp:72
Definition: Utilities.hpp:34
static std::string JoinString(std::vector< std::string > str, std::string c)
int width
Definition: Utilities.hpp:46
Size2D(int w=0, int h=0)
Definition: Utilities.hpp:41
static void Replace(std::string &str, const std::string &from, const std::string &to)
Definition: Utilities.hpp:168
T x
Definition: Utilities.hpp:62
Size2D operator/(const int &i) const
Definition: Utilities.hpp:52
unsigned char value
Definition: Utilities.hpp:209
Size2D operator-(const Size2D &other) const
Definition: Utilities.hpp:51
static float mtof(float m)
Definition: Utilities.hpp:165
Definition: Alertable.hpp:26
bool IsInside(Point2D_< T > r, Size2D s) const
Definition: Utilities.hpp:76
Definition: Utilities.hpp:164
bool IsFullyInside(const Rect &other)
Definition: Utilities.hpp:127
KeyType type
Definition: Utilities.hpp:180
bool pressed
Definition: Utilities.hpp:174
Point2D_< float > operator/(const Point2D_< int > &a, const float &t)
Definition: Utilities.hpp:99
bool IsPrintable() const
Definition: Utilities.hpp:184
Point2D_< T > operator+(const Point2D_< T > &other) const
Definition: Utilities.hpp:66
static Point2D Align(HorizAlignment, VertAlignment, Size2D inner, Size2D outer)
Definition: Utilities.hpp:151
Definition: Utilities.hpp:167
Point2D_< T > operator*(const T &t, const Point2D_< T > &a)
Definition: Utilities.hpp:85
Definition: Utilities.hpp:142
static float Distance(Point2D_< T > a, Point2D_< T > b)
Definition: Utilities.hpp:80
Definition: Utilities.hpp:164
static bool GetFileExists(std::string path)
Point2D_< T > & operator+=(const Point2D_< T > &other)
Definition: Utilities.hpp:73
Point2D a
Definition: Utilities.hpp:105
std::string ToString() const
Definition: Utilities.hpp:65
Point2D Center() const
Definition: Utilities.hpp:125
Size2D Size() const
Definition: Utilities.hpp:118
static std::string TrimAllLines(std::string)
Definition: Utilities.hpp:140
Definition: Utilities.hpp:163
Point2D_< T > operator-(const Point2D_< T > &other) const
Definition: Utilities.hpp:67
T y
Definition: Utilities.hpp:62
static std::string ConvertUnipathToOSPath(const std::string &unipath)
Definition: Utilities.hpp:141
Point2D ToPoint() const
Definition: Utilities.hpp:82
Definition: Utilities.hpp:146
bool IsTrig() const
Definition: Utilities.hpp:186
bool repeat
Definition: Utilities.hpp:176
Definition: Utilities.hpp:167
Definition: Utilities.hpp:199
Point2D_< T > operator*(const T &t) const
Definition: Utilities.hpp:70
Point2D_(T x_=0, T y_=0)
Definition: Utilities.hpp:59
HorizAlignment
Definition: Utilities.hpp:144
bool operator!=(const Size2D &other) const
Definition: Utilities.hpp:48
static std::string GetFilename(std::string)
KeyType
Definition: Utilities.hpp:162
Definition: Utilities.hpp:167
Definition: Utilities.hpp:152
bool IsEmpty() const
Definition: Utilities.hpp:45
bool alt
Definition: Utilities.hpp:178
Point2D_< T > operator+(const Size2D &other) const
Definition: Utilities.hpp:71
Definition: Utilities.hpp:157
static void NumericLocaleRestoreUserCustom()
Type type
Definition: Utilities.hpp:205
Point2D b
Definition: Utilities.hpp:106
Definition: Utilities.hpp:40
Definition: Utilities.hpp:164