File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 6
6
namespace misc {
7
7
sf::Vector2f follow_eye_t::update (sf::Vector2f target) noexcept { return (dir = maths::normalize (target - pos)); }
8
8
void follow_eye_t::draw (drawer_t & drawer, bool blink) {
9
- shape_t <sf::CircleShape> circle (drawer);
10
- circle.radius = 40 .0f * scale;
11
- circle.outline = {sf::Color (0x221100ff ), 2 .0f };
12
- circle.position = pos;
13
- circle.draw ();
9
+ shape_t <sf::CircleShape> eye (drawer);
10
+ eye.radius = 40 .f * scale;
11
+ eye.position = pos;
14
12
if (!blink) {
15
- auto const radius = circle.radius * 0 .25f ;
16
- auto const offset = dir * (circle.radius - radius) * 0 .80f ; // 20% padding
17
- circle.radius = radius;
18
- circle.fill = sf::Color::Black;
19
- circle.outline .size = 0 .0f ;
20
- circle.position += offset;
21
- circle.draw ();
13
+ eye.outline = {sf::Color (0x221100ff ), 2 .0f };
14
+ eye.draw ();
15
+ // pupil
16
+ auto const offset = dir * (eye.radius * 0 .75f ) * 0 .80f ; // 20% padding
17
+ eye.radius *= 0 .3f ;
18
+ eye.fill = sf::Color::Black;
19
+ eye.outline = {sf::Color (0x221100ff ), 0 .5f };
20
+ eye.position += offset;
21
+ eye.draw ();
22
+ } else {
23
+ eye.scale = {1 .0f , 0 .1f };
24
+ eye.fill = sf::Color::Black;
25
+ eye.draw ();
22
26
}
23
27
}
24
28
} // namespace misc
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class clock_ticker_t {
81
81
82
82
struct {
83
83
pair_t <sec_t > interval = {sec_t {3 .0f }, sec_t {8 .0f }};
84
- sec_t duration = sec_t {0 .15f };
84
+ sec_t duration = sec_t {0 .1f };
85
85
86
86
sec_t next_blink_in{};
87
87
sec_t stop_blink_in{};
You can’t perform that action at this time.
0 commit comments