1 | // Copyright (C) 2015 Paul Lemire |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qtickclockservice_p.h" |
5 | |
6 | #include <Qt3DCore/private/qabstractframeadvanceservice_p.h> |
7 | #include <Qt3DCore/private/qabstractframeadvanceservice_p_p.h> |
8 | #include <Qt3DCore/private/qtickclock_p.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | namespace Qt3DCore { |
13 | |
14 | class QTickClockServicePrivate : public QAbstractFrameAdvanceServicePrivate |
15 | { |
16 | public: |
17 | QTickClockServicePrivate() |
18 | : QAbstractFrameAdvanceServicePrivate(QStringLiteral("Default Frame Advance Service implementation")) |
19 | { |
20 | m_clock.setTickFrequency(60); |
21 | m_clock.start(); |
22 | } |
23 | |
24 | QTickClock m_clock; |
25 | }; |
26 | |
27 | /* !\internal |
28 | \class Qt3DCore::QTickClockService |
29 | \inmodule Qt3DCore |
30 | \brief Default QAbstractFrameAdvanceService implementation. |
31 | |
32 | This default QAbstractFrameAdvanceService implementation has a frequency of 60 Hz. |
33 | */ |
34 | QTickClockService::QTickClockService() |
35 | : QAbstractFrameAdvanceService(*new QTickClockServicePrivate()) |
36 | { |
37 | } |
38 | |
39 | QTickClockService::~QTickClockService() |
40 | { |
41 | } |
42 | |
43 | qint64 QTickClockService::waitForNextFrame() |
44 | { |
45 | Q_D(QTickClockService); |
46 | return d->m_clock.waitForNextTick(); |
47 | } |
48 | |
49 | /* |
50 | Starts the inner tick clock used by the service. |
51 | */ |
52 | void QTickClockService::start() |
53 | { |
54 | Q_D(QTickClockService); |
55 | d->m_clock.start(); |
56 | } |
57 | |
58 | void QTickClockService::stop() |
59 | { |
60 | } |
61 | |
62 | } // Qt3D |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #include "moc_qtickclockservice_p.cpp" |
67 |