C

Qt Quick Ultralite instrument_cluster Example

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "instrument_cluster.h"
#include "simulator.h"

#include <qul/application.h>
#include <qul/qul.h>

int main()
{
    Qul::initHardware();
    Qul::initPlatform();
    Qul::Application app;
    static instrument_cluster item;
    app.setRootItem(&item);

    Simulator simulator;

    while (true) {
        uint64_t timestamp = Qul::Platform::getPlatformInstance()->currentTimestamp();
        static uint64_t previousUpdate = 0;
        const uint64_t updatePeriod = 10;

        if (timestamp > previousUpdate + updatePeriod) {
            simulator.tick(timestamp - previousUpdate);

            app.update();
            previousUpdate = timestamp;
        }
    }
}