C

Qt Quick Ultralite swipegame Demo

/****************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
pragma singleton; import QtQuick 2.0 Item { property int appSize: 390 readonly property color colorAppBackground: "black" readonly property color colorPageBackground: "#1b1d1e" readonly property color colorLines: "#464747" readonly property color colorHighlight: "#ef7427" readonly property color colorText: "#ffffff" readonly property color colorButtonBackground: "#363738" readonly property color colorLightText: "#6c604e" readonly property color colorArrowBackground: "#404141" readonly property color colorWarning: "#ef2727" // used for frames, lines and similar structures readonly property int lineSize: Math.max(appSize * 0.01, 2) readonly property int marginDefault: appSize * 0.08 readonly property int marginBig: appSize * 0.15 readonly property int buttonHeight: appSize * 0.15 readonly property int buttonTextMargins: buttonHeight * 0.2 readonly property int buttonRadius: 4 readonly property int listSpacing: appSize * 0.05 readonly property int swipeAreaSizeDefault: appSize * 0.18 readonly property int swipeAreaSizeSmall: appSize * 0.12 readonly property int swipeThreshold: appSize * 0.2 // min distance of position to center for a touch to be taken into account readonly property int swipeCircleMinDistance: appSize * 0.25 // how many degrees a circular swipe must cover to trigger. // swipe angle calculations will fail if the threshold nears 180. readonly property int swipeArcThreshold: 60 readonly property int animationDuration: 400 readonly property int gameStartDelay: 5000 readonly property Text textSmall: Text { font: appSize < 300 ? fontSmall1.font : fontMedium1.font } readonly property Text textDefault: Text { font: appSize < 300 ? fontSmall2.font : fontMedium2.font } readonly property Text textBig: Text { font: appSize < 300 ? fontSmall3.font : fontMedium3.font } // font sizes for smaller resolutions (272 pixel height like MIMXRT1064) Text { id: fontSmall1; font.pixelSize: 14; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } Text { id: fontSmall2; font.pixelSize: 28; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } Text { id: fontSmall3; font.pixelSize: 42; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } // font sizes for medium resolutions (390 pixel height like STM32L4R9I) Text { id: fontMedium1; font.pixelSize: 20; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } Text { id: fontMedium2; font.pixelSize: 40; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } Text { id: fontMedium3; font.pixelSize: 60; font.unicodeCoverage: [Font.UnicodeBlock_BasicLatin] } }