mirror of
https://github.com/ProgramSnail/snake_2024.git
synced 2025-12-17 19:58:44 +00:00
text rendering + food couter, minor fixes
This commit is contained in:
parent
421574ab40
commit
0d30ca5575
8 changed files with 216 additions and 17 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue