Mercurial > malikania
comparison tests/libclient/animation/main.cpp @ 41:3645200f46bf
Misc: switch to Boost.Timer, closes #586
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 27 Nov 2016 20:50:38 +0100 |
parents | d4f5f7231b84 |
children | a47a4477f347 |
comparison
equal
deleted
inserted
replaced
40:1e206fdc7021 | 41:3645200f46bf |
---|---|
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 TEST_F(TestAnimation, draw) | 77 TEST_F(TestAnimation, draw) |
78 { | 78 { |
79 ElapsedTimer timer; | 79 boost::timer::cpu_timer timer; |
80 | 80 |
81 try { | 81 try { |
82 Animation animation = m_loader.loadAnimation("animations/margins.json"); | 82 Animation animation = m_loader.loadAnimation("animations/margins.json"); |
83 Animator animator(animation); | 83 Animator animator(animation); |
84 | 84 |
85 auto x = (400 / 2) - (animation.sprite().cell().width() / 2); | 85 auto x = (400 / 2) - (animation.sprite().cell().width() / 2); |
86 auto y = (400 / 2) - (animation.sprite().cell().height() / 2); | 86 auto y = (400 / 2) - (animation.sprite().cell().height() / 2); |
87 | 87 |
88 while (timer.elapsed() < 8000) { | 88 while (timer.elapsed().wall / 1000000LL < 8000) { |
89 window.clear(); | 89 window.clear(); |
90 animator.draw(window, Point(x, y)); | 90 animator.draw(window, Point(x, y)); |
91 animator.update(); | 91 animator.update(); |
92 window.present(); | 92 window.present(); |
93 } | 93 } |