Files
vb01/util.h

38 lines
1.0 KiB
C++
Executable File

#ifndef UTIL_H
#define UTIL_H
#include <chrono>
#include <cmath>
#include <string>
#include <vector>
#include "vector.h"
namespace vb01{
typedef char s8;
typedef short s16;
typedef int s32;
typedef long long s64;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
static const float PI = 4 * atan(1);
bool rectInter(Vector2, Vector2, Vector2, Vector2[]);
bool segmInter(Vector2[], Vector2[]);
bool rectanglesIntersect(Vector2, Vector2, Vector2, Vector2, Vector2, Vector2, Vector2, Vector2);
void readFile(std::string, std::vector<std::string>&, int = 0, int = -1);
void getLineData(std::string, std::string[], int, int = 0);
int findNthOccurence(std::string&, std::string, int, bool = true);
int getCharId(std::string, char, bool = false);
std::wstring stringToWstring(std::string str);
std::string wstringToString(std::wstring wstr);
Vector2 getCursorPos();
inline s64 getTime(){return s64(std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1));}
}
#endif