From e3a66514d57ff4acf2f02df7d86bd2cf8be0e730 Mon Sep 17 00:00:00 2001 From: Reimar Date: Tue, 8 Dec 2015 11:31:35 +0100 Subject: initial commit --- util.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 util.h (limited to 'util.h') diff --git a/util.h b/util.h new file mode 100644 index 0000000..acabdcb --- /dev/null +++ b/util.h @@ -0,0 +1,39 @@ +#ifndef UTIL_H +#define UTIL_H + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +//splits at '\n' and ' ' +vector > splitString(string s); + +//rounds too a beatiful number +double round_beautiful(double d); + +void _tospace(string& s); +void spaceto_(string& s); + +SDL_Event relativate(const SDL_Event &e, SDL_Rect p); + +SDL_Surface* copyImage(SDL_Surface* s); + + +//loads a bitmap from file and converts it to screen properties +SDL_Surface* loadBMP(std::string filename); + +bool inRect(SDL_Rect r, double x, double y); + +string lltostr(const long long& l); +string dbltostr(const double& d, int dec); + +//returns true if the line intersects with the circle (or lies in it) +bool intersects(double radius, double startx, double starty, double endx, double endy); + +#endif -- cgit v1.2.3