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
10QT_BEGIN_NAMESPACE
11
12namespace Qt3DCore {
13
14class QTickClockServicePrivate : public QAbstractFrameAdvanceServicePrivate
15{
16public:
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*/
34QTickClockService::QTickClockService()
35 : QAbstractFrameAdvanceService(*new QTickClockServicePrivate())
36{
37}
38
39QTickClockService::~QTickClockService()
40{
41}
42
43qint64 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 */
52void QTickClockService::start()
53{
54 Q_D(QTickClockService);
55 d->m_clock.start();
56}
57
58void QTickClockService::stop()
59{
60}
61
62} // Qt3D
63
64QT_END_NAMESPACE
65
66#include "moc_qtickclockservice_p.cpp"
67

source code of qt3d/src/core/services/qtickclockservice.cpp