comparison tests/libclient/js-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 9af360f34c7d
children a47a4477f347
comparison
equal deleted inserted replaced
40:1e206fdc7021 41:3645200f46bf
19 #include <chrono> 19 #include <chrono>
20 #include <thread> 20 #include <thread>
21 21
22 #include <gtest/gtest.h> 22 #include <gtest/gtest.h>
23 23
24 #include <malikania/elapsed-timer.hpp>
25 #include <malikania/js-client-resources-loader.hpp> 24 #include <malikania/js-client-resources-loader.hpp>
26 #include <malikania/js-animation.hpp> 25 #include <malikania/js-animation.hpp>
27 #include <malikania/js-animator.hpp> 26 #include <malikania/js-animator.hpp>
28 #include <malikania/js-window.hpp> 27 #include <malikania/js-window.hpp>
29 #include <malikania/resources-locator.hpp> 28 #include <malikania/resources-locator.hpp>
62 ); 61 );
63 62
64 if (ret != 0) 63 if (ret != 0)
65 throw dukx_exception(m_ctx, -1); 64 throw dukx_exception(m_ctx, -1);
66 65
67 ElapsedTimer timer; 66 boost::timer::cpu_timer timer;
68 67
69 while (timer.elapsed() < 8000) { 68 while (timer.elapsed().wall / 1000000LL < 8000) {
70 auto ret = duk_peval_string(m_ctx, 69 auto ret = duk_peval_string(m_ctx,
71 "w.setDrawingColor('lightskyblue');" 70 "w.setDrawingColor('lightskyblue');"
72 "w.clear();" 71 "w.clear();"
73 "d.draw(w, { x: 320 - 16, y: 240 - 16 });" 72 "d.draw(w, { x: 320 - 16, y: 240 - 16 });"
74 "d.update();" 73 "d.update();"