text rendering + food couter, minor fixes

This commit is contained in:
programsnail 2024-07-26 20:25:52 +03:00
parent 421574ab40
commit 0d30ca5575
8 changed files with 216 additions and 17 deletions

View file

@ -56,6 +56,15 @@ template <typename T> inline Vec<T> to_world_coord(Vec<T> pos) {
};
}
inline int rand_to(int x) {
if (std::abs(x) <= 1) {
return 0;
}
bool is_negative = x < 0;
return (is_negative ? -1 : 1) + rand() % std::abs(x);
}
} // namespace utils
namespace color {