sf::Color cast_ray(float x, float y, float angle, int max_dist) {
float x_pos = x;
float y_pos = y;
float x_step = sin(angle);
float y_step = cos(angle);
for (int i = 0; i < max_dist; i++) {
x_pos += x_step;
y_pos += y_step;
int x_ = x_pos / x_step;
int y_ = y_pos / y_step;
//printf("%f %f\n", x_pos, y_pos);
try{
if (map[x_][y_] == 1) {
return sf::Color(255, 255, 255);
}
} catch(std::exception ex){
}
}
return sf::Color(0, 0, 0, 0);
}