-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapple.hpp
40 lines (29 loc) · 794 Bytes
/
apple.hpp
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
//
// Created by asuka on 13.03.2023.
//
# ifndef SNAKE_APPLE_HPP
# define SNAKE_APPLE_HPP
# include <random>
# include <glm/vec2.hpp>
namespace snake {
class Board;
class Apple {
public:
explicit Apple(Board& board);
~Apple() = default;
Apple(const Apple&) = delete;
Apple& operator=(const Apple&) = delete;
Apple(Apple&&) noexcept = delete;
Apple& operator=(Apple&&) noexcept = delete;
void update();
glm::ivec2 get_position() const;
private:
glm::ivec2 position_{};
std::random_device rd{};
std::mt19937 rng{rd()};
using dist_type = std::uniform_int_distribution<int>;
dist_type x_dist_;
dist_type y_dist_;
};
} // snake
# endif // SNAKE_APPLE_HPP