C
Qt Quick Ultralite Motorcycle Cluster Demo
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
pragma Singleton
import QtQuick
// Just a proxy for C++ code to provide additional APIs
QtObject {
id: mathapi
function random() : real {
return Math.random();
}
function sqrt(val: real) : real {
return Math.sqrt(val);
}
function xorFunction(A: bool, B: bool) : bool {
return (A && !B) || (!A && B);
}
function clamp(value: real, bottom: real, top: real) : real{
return Math.min(Math.max(value, bottom), top);
}
}