summaryrefslogtreecommitdiff
path: root/util.h
blob: 4d33ba26ad71005f774e5ad419bccc49ba4b5f0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef UTIL_H
#define UTIL_H

#include <vector>
#include <iostream>
#include <math.h>
#include <sstream>
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_image.h>

using namespace std;

string get_data_path();
//splits at '\n' and ' '
vector<vector<string> > 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