mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
cleanup, don't compress rcc file to fix corruption
This commit is contained in:
parent
3f762c7900
commit
4bef033d6f
15 changed files with 86 additions and 91 deletions
BIN
.gradle/4.6/fileChanges/last-build.bin
Normal file
BIN
.gradle/4.6/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/4.6/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/4.6/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
|
@ -53,7 +53,7 @@ Enter the repository `android` directory
|
||||||
|
|
||||||
Execute a gradle pre-build setup. This step should only need to be done once
|
Execute a gradle pre-build setup. This step should only need to be done once
|
||||||
|
|
||||||
`gradle setupDepedencies`
|
`gradle setupDependencies`
|
||||||
|
|
||||||
|
|
||||||
# Building & Running
|
# Building & Running
|
||||||
|
|
|
@ -23,12 +23,22 @@ set(RESOURCES_QRC ${CMAKE_CURRENT_BINARY_DIR}/resources.qrc)
|
||||||
set(RESOURCES_RCC ${CMAKE_CURRENT_SOURCE_DIR}/compiledResources/resources.rcc)
|
set(RESOURCES_RCC ${CMAKE_CURRENT_SOURCE_DIR}/compiledResources/resources.rcc)
|
||||||
generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources CUSTOM_PATHS ${CUSTOM_INTERFACE_QRC_PATHS} GLOBS *)
|
generate_qrc(OUTPUT ${RESOURCES_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources CUSTOM_PATHS ${CUSTOM_INTERFACE_QRC_PATHS} GLOBS *)
|
||||||
|
|
||||||
add_custom_command(
|
if (ANDROID)
|
||||||
|
# on Android, don't compress the rcc binary
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${RESOURCES_RCC}
|
||||||
|
DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS}
|
||||||
|
COMMAND "${QT_DIR}/bin/rcc"
|
||||||
|
ARGS ${RESOURCES_QRC} -no-compress -binary -o ${RESOURCES_RCC}
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_custom_command(
|
||||||
OUTPUT ${RESOURCES_RCC}
|
OUTPUT ${RESOURCES_RCC}
|
||||||
DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS}
|
DEPENDS ${RESOURCES_QRC} ${GENERATE_QRC_DEPENDS}
|
||||||
COMMAND "${QT_DIR}/bin/rcc"
|
COMMAND "${QT_DIR}/bin/rcc"
|
||||||
ARGS ${RESOURCES_QRC} -binary -o ${RESOURCES_RCC}
|
ARGS ${RESOURCES_QRC} -binary -o ${RESOURCES_RCC}
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC})
|
list(APPEND GENERATE_QRC_DEPENDS ${RESOURCES_RCC})
|
||||||
add_custom_target(resources ALL DEPENDS ${GENERATE_QRC_DEPENDS})
|
add_custom_target(resources ALL DEPENDS ${GENERATE_QRC_DEPENDS})
|
||||||
|
|
|
@ -76,33 +76,33 @@ Item {
|
||||||
HifiStyles.RalewayRegular {
|
HifiStyles.RalewayRegular {
|
||||||
id: notice
|
id: notice
|
||||||
text: "YOUR LOCATION"
|
text: "YOUR LOCATION"
|
||||||
font.pixelSize: (hifi.fonts.pixelSize * 2.15)*(android.dimen.atLeast1440p?1:.75);
|
font.pixelSize: (hifi.fonts.pixelSize * 2.15) * (android.dimen.atLeast1440p ? 1 : .75);
|
||||||
color: "#2CD7FF"
|
color: "#2CD7FF"
|
||||||
anchors {
|
anchors {
|
||||||
bottom: addressBackground.top
|
bottom: addressBackground.top
|
||||||
bottomMargin: android.dimen.atLeast1440p?45:34
|
bottomMargin: android.dimen.atLeast1440p ? 45 : 34
|
||||||
left: addressBackground.left
|
left: addressBackground.left
|
||||||
leftMargin: android.dimen.atLeast1440p?60:45
|
leftMargin: android.dimen.atLeast1440p ? 60 : 45
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
property int inputAreaHeight: android.dimen.atLeast1440p?210:156
|
property int inputAreaHeight: android.dimen.atLeast1440p ? 210 : 156
|
||||||
property int inputAreaStep: (height - inputAreaHeight) / 2
|
property int inputAreaStep: (height - inputAreaHeight) / 2
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: homeButton
|
id: homeButton
|
||||||
y: android.dimen.atLeast1440p?280:210
|
y: android.dimen.atLeast1440p ? 280 : 210
|
||||||
imageURL: "../../icons/home.svg"
|
imageURL: "../../icons/home.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
addressBarDialog.loadHome();
|
addressBarDialog.loadHome();
|
||||||
bar.shown = false;
|
bar.shown = false;
|
||||||
}
|
}
|
||||||
anchors {
|
anchors {
|
||||||
leftMargin: android.dimen.atLeast1440p?75:56
|
leftMargin: android.dimen.atLeast1440p ? 75 : 56
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
size: android.dimen.atLeast1440p?150:150//112
|
size: android.dimen.atLeast1440p ? 150 : 150//112
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
|
@ -111,10 +111,10 @@ Item {
|
||||||
onClicked: addressBarDialog.loadBack();
|
onClicked: addressBarDialog.loadBack();
|
||||||
anchors {
|
anchors {
|
||||||
left: homeButton.right
|
left: homeButton.right
|
||||||
leftMargin: android.dimen.atLeast1440p?70:52
|
leftMargin: android.dimen.atLeast1440p ? 70 : 52
|
||||||
verticalCenter: homeButton.verticalCenter
|
verticalCenter: homeButton.verticalCenter
|
||||||
}
|
}
|
||||||
size: android.dimen.atLeast1440p?150:150
|
size: android.dimen.atLeast1440p ? 150 : 150
|
||||||
}
|
}
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: forwardArrow;
|
id: forwardArrow;
|
||||||
|
@ -122,10 +122,10 @@ Item {
|
||||||
onClicked: addressBarDialog.loadForward();
|
onClicked: addressBarDialog.loadForward();
|
||||||
anchors {
|
anchors {
|
||||||
left: backArrow.right
|
left: backArrow.right
|
||||||
leftMargin: android.dimen.atLeast1440p?60:45
|
leftMargin: android.dimen.atLeast1440p ? 60 : 45
|
||||||
verticalCenter: homeButton.verticalCenter
|
verticalCenter: homeButton.verticalCenter
|
||||||
}
|
}
|
||||||
size: android.dimen.atLeast1440p?150:150
|
size: android.dimen.atLeast1440p ? 150 : 150
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiStyles.FiraSansRegular {
|
HifiStyles.FiraSansRegular {
|
||||||
|
@ -140,25 +140,22 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: addressBackground
|
id: addressBackground
|
||||||
x: android.dimen.atLeast1440p?780:585
|
x: android.dimen.atLeast1440p ? 780 : 585
|
||||||
y: android.dimen.atLeast1440p?280:235 // tweaking by hand
|
y: android.dimen.atLeast1440p ? 280 : 235 // tweaking by hand
|
||||||
width: android.dimen.atLeast1440p?1270:952
|
width: android.dimen.atLeast1440p ? 1270 : 952
|
||||||
height: android.dimen.atLeast1440p?150:112
|
height: android.dimen.atLeast1440p ? 150 : 112
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
}
|
}
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
id: addressLine
|
id: addressLine
|
||||||
focus: true
|
focus: true
|
||||||
x: android.dimen.atLeast1440p?870:652
|
x: android.dimen.atLeast1440p ? 870 : 652
|
||||||
y: android.dimen.atLeast1440p?300:245 // tweaking by hand
|
y: android.dimen.atLeast1440p ? 300 : 245 // tweaking by hand
|
||||||
width: android.dimen.atLeast1440p?1200:900
|
width: android.dimen.atLeast1440p ? 1200 : 900
|
||||||
height: android.dimen.atLeast1440p?120:90
|
height: android.dimen.atLeast1440p ? 120 : 90
|
||||||
inputMethodHints: Qt.ImhNoPredictiveText
|
inputMethodHints: Qt.ImhNoPredictiveText
|
||||||
//helperText: "Hint is here"
|
//helperText: "Hint is here"
|
||||||
anchors {
|
|
||||||
//verticalCenter: addressBackground.verticalCenter
|
|
||||||
}
|
|
||||||
font.pixelSize: hifi.fonts.pixelSize * 3.75
|
font.pixelSize: hifi.fonts.pixelSize * 3.75
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
//filterChoicesByText();
|
//filterChoicesByText();
|
||||||
|
|
|
@ -26,13 +26,13 @@ ColumnLayout {
|
||||||
property string methodName: "";
|
property string methodName: "";
|
||||||
property string actionText: "";
|
property string actionText: "";
|
||||||
|
|
||||||
spacing: 4*3
|
spacing: 4 * 3
|
||||||
signal sendToParentQml(var message);
|
signal sendToParentQml(var message);
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: itemImage
|
id: itemImage
|
||||||
Layout.preferredWidth: 250*3
|
Layout.preferredWidth: 250 * 3
|
||||||
Layout.preferredHeight: 140*3
|
Layout.preferredHeight: 140 * 3
|
||||||
source: thumbnailUrl
|
source: thumbnailUrl
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
@ -81,7 +81,7 @@ ColumnLayout {
|
||||||
HifiControlsUit.ImageButton {
|
HifiControlsUit.ImageButton {
|
||||||
width: 140*3
|
width: 140*3
|
||||||
height: 35*3
|
height: 35*3
|
||||||
text: type=="extra"? actionText: "CHOOSE"
|
text: type=="extra" ? actionText: "CHOOSE"
|
||||||
source: "../../../../icons/button.svg"
|
source: "../../../../icons/button.svg"
|
||||||
hoverSource: "../../../../icons/button-a.svg"
|
hoverSource: "../../../../icons/button-a.svg"
|
||||||
fontSize: 18*3
|
fontSize: 18*3
|
||||||
|
@ -102,8 +102,8 @@ ColumnLayout {
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: tickImage
|
id: tickImage
|
||||||
width: 35*3
|
width: 35 * 3
|
||||||
height: 35*3
|
height: 35 * 3
|
||||||
source: "../../../icons/tick.svg"
|
source: "../../../icons/tick.svg"
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: itemName.horizontalCenter
|
horizontalCenter: itemName.horizontalCenter
|
||||||
|
|
|
@ -22,26 +22,26 @@ Item {
|
||||||
Item {
|
Item {
|
||||||
id: dimen
|
id: dimen
|
||||||
readonly property bool atLeast1440p: Screen.width >= 2560 && Screen.height >= 1440
|
readonly property bool atLeast1440p: Screen.width >= 2560 && Screen.height >= 1440
|
||||||
readonly property real windowLessWidth: atLeast1440p?378:284
|
readonly property real windowLessWidth: atLeast1440p ? 378 : 284
|
||||||
readonly property real windowLessHeight: atLeast1440p?192:144
|
readonly property real windowLessHeight: atLeast1440p ? 192 : 144
|
||||||
|
|
||||||
readonly property real windowZ: 100
|
readonly property real windowZ: 100
|
||||||
|
|
||||||
readonly property real headerHeight: atLeast1440p?276:207
|
readonly property real headerHeight: atLeast1440p ? 276 : 207
|
||||||
|
|
||||||
readonly property real headerIconPosX: atLeast1440p?90:67
|
readonly property real headerIconPosX: atLeast1440p ? 90 : 67
|
||||||
readonly property real headerIconPosY: atLeast1440p?108:81
|
readonly property real headerIconPosY: atLeast1440p ? 108 : 81
|
||||||
readonly property real headerIconWidth: atLeast1440p?111:83
|
readonly property real headerIconWidth: atLeast1440p ? 111 : 83
|
||||||
readonly property real headerIconHeight: atLeast1440p?111:83
|
readonly property real headerIconHeight: atLeast1440p ? 111 : 83
|
||||||
readonly property real headerIconTitleDistance: atLeast1440p?151:113
|
readonly property real headerIconTitleDistance: atLeast1440p ? 151 : 113
|
||||||
|
|
||||||
readonly property real headerHideWidth: atLeast1440p?150:112
|
readonly property real headerHideWidth: atLeast1440p ? 150 : 112
|
||||||
readonly property real headerHideHeight: atLeast1440p?150:112
|
readonly property real headerHideHeight: atLeast1440p ? 150 : 112
|
||||||
readonly property real headerHideRightMargin: atLeast1440p?110:82
|
readonly property real headerHideRightMargin: atLeast1440p ? 110 : 82
|
||||||
readonly property real headerHideTopMargin: atLeast1440p?90:67
|
readonly property real headerHideTopMargin: atLeast1440p ? 90 : 67
|
||||||
readonly property real headerHideIconWidth: atLeast1440p?70:52
|
readonly property real headerHideIconWidth: atLeast1440p ? 70 : 52
|
||||||
readonly property real headerHideIconHeight: atLeast1440p?45:33
|
readonly property real headerHideIconHeight: atLeast1440p ? 45 : 33
|
||||||
readonly property real headerHideTextTopMargin: atLeast1440p?36:27
|
readonly property real headerHideTextTopMargin: atLeast1440p ? 36 : 27
|
||||||
|
|
||||||
readonly property real botomHudWidth: 366
|
readonly property real botomHudWidth: 366
|
||||||
readonly property real botomHudHeight: 180
|
readonly property real botomHudHeight: 180
|
||||||
|
|
|
@ -1998,20 +1998,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));
|
connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));
|
||||||
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
||||||
|
|
||||||
{
|
|
||||||
PROFILE_RANGE(render, "Process Default Skybox");
|
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
|
||||||
|
|
||||||
QFileSelector fileSelector;
|
|
||||||
fileSelector.setExtraSelectors(FileUtils::getFileSelectors());
|
|
||||||
auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx");
|
|
||||||
|
|
||||||
_defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString());
|
|
||||||
_defaultSkyboxAmbientTexture = _defaultSkyboxTexture;
|
|
||||||
|
|
||||||
_defaultSkybox->setCubemap(_defaultSkyboxTexture);
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTreeRenderer::setEntitiesShouldFadeFunction([this]() {
|
EntityTreeRenderer::setEntitiesShouldFadeFunction([this]() {
|
||||||
SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);
|
SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);
|
||||||
return entityServerNode && !isPhysicsEnabled();
|
return entityServerNode && !isPhysicsEnabled();
|
||||||
|
@ -2461,7 +2447,6 @@ void Application::initializeGL() {
|
||||||
DeadlockWatchdogThread::withPause([&] {
|
DeadlockWatchdogThread::withPause([&] {
|
||||||
// Set up the render engine
|
// Set up the render engine
|
||||||
render::CullFunctor cullFunctor = LODManager::shouldRender;
|
render::CullFunctor cullFunctor = LODManager::shouldRender;
|
||||||
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
|
||||||
_renderEngine->addJob<UpdateSceneTask>("UpdateScene");
|
_renderEngine->addJob<UpdateSceneTask>("UpdateScene");
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef Q_OS_ANDROID
|
||||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
|
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
|
||||||
|
|
|
@ -272,10 +272,6 @@ public:
|
||||||
|
|
||||||
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
|
void shareSnapshot(const QString& filename, const QUrl& href = QUrl(""));
|
||||||
|
|
||||||
graphics::SkyboxPointer getDefaultSkybox() const { return _defaultSkybox; }
|
|
||||||
gpu::TexturePointer getDefaultSkyboxTexture() const { return _defaultSkyboxTexture; }
|
|
||||||
gpu::TexturePointer getDefaultSkyboxAmbientTexture() const { return _defaultSkyboxAmbientTexture; }
|
|
||||||
|
|
||||||
OverlayID getTabletScreenID() const;
|
OverlayID getTabletScreenID() const;
|
||||||
OverlayID getTabletHomeButtonID() const;
|
OverlayID getTabletHomeButtonID() const;
|
||||||
QUuid getTabletFrameID() const; // may be an entity or an overlay
|
QUuid getTabletFrameID() const; // may be an entity or an overlay
|
||||||
|
@ -678,10 +674,6 @@ private:
|
||||||
|
|
||||||
ConnectionMonitor _connectionMonitor;
|
ConnectionMonitor _connectionMonitor;
|
||||||
|
|
||||||
graphics::SkyboxPointer _defaultSkybox { new ProceduralSkybox() } ;
|
|
||||||
gpu::TexturePointer _defaultSkyboxTexture;
|
|
||||||
gpu::TexturePointer _defaultSkyboxAmbientTexture;
|
|
||||||
|
|
||||||
QTimer _addAssetToWorldResizeTimer;
|
QTimer _addAssetToWorldResizeTimer;
|
||||||
QHash<QUuid, int> _addAssetToWorldResizeList;
|
QHash<QUuid, int> _addAssetToWorldResizeList;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() {
|
||||||
auto iconPath = PathUtils::resourcesPath() + "images/analog_stick.png";
|
auto iconPath = PathUtils::resourcesPath() + "images/analog_stick.png";
|
||||||
auto image = QImage(iconPath);
|
auto image = QImage(iconPath);
|
||||||
qreal dpi = getFullscreenTarget()->physicalDotsPerInch();
|
qreal dpi = getFullscreenTarget()->physicalDotsPerInch();
|
||||||
_virtualPadPixelSize = dpi * 512 / 534; // 534 dpi for Pixel XL and Mate 9 Pro
|
_virtualPadPixelSize = dpi * VirtualPad::Manager::PIXEL_SIZE / VirtualPad::Manager::DPI;
|
||||||
|
|
||||||
if (image.format() != QImage::Format_ARGB32) {
|
if (image.format() != QImage::Format_ARGB32) {
|
||||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
glm::vec2 getReticleMaximumPosition() const;
|
glm::vec2 getReticleMaximumPosition() const;
|
||||||
|
|
||||||
glm::mat4 getReticleTransform(const glm::mat4& eyePose = glm::mat4(), const glm::vec3& headPosition = glm::vec3()) const;
|
glm::mat4 getReticleTransform(const glm::mat4& eyePose = glm::mat4(), const glm::vec3& headPosition = glm::vec3()) const;
|
||||||
glm::mat4 getPoint2DTransform(const glm::vec2& point = glm::vec2(), float sizeX = 512.0f, float sizeY = 512.0f) const;
|
glm::mat4 getPoint2DTransform(const glm::vec2& point, float sizeX , float sizeY) const;
|
||||||
|
|
||||||
ReticleInterface* getReticleInterface() { return _reticleInterface; }
|
ReticleInterface* getReticleInterface() { return _reticleInterface; }
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ void TouchscreenVirtualPadDevice::init() {
|
||||||
_screenDPIProvided = eventScreen->physicalDotsPerInch();
|
_screenDPIProvided = eventScreen->physicalDotsPerInch();
|
||||||
_screenDPI = eventScreen->physicalDotsPerInch();
|
_screenDPI = eventScreen->physicalDotsPerInch();
|
||||||
|
|
||||||
_fixedRadius = _screenDPI * 256 / 534;
|
_fixedRadius = _screenDPI * 0.5f * VirtualPad::Manager::PIXEL_SIZE / VirtualPad::Manager::DPI;
|
||||||
_fixedRadiusForCalc = _fixedRadius - _screenDPI * 105 / 534; // 105 is the radius of the stick circle
|
_fixedRadiusForCalc = _fixedRadius - _screenDPI * VirtualPad::Manager::STICK_RADIUS / VirtualPad::Manager::DPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& virtualPadManager = VirtualPad::Manager::instance();
|
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||||
|
@ -69,7 +69,7 @@ void TouchscreenVirtualPadDevice::setupFixedCenter(VirtualPad::Manager& virtualP
|
||||||
if (_extraBottomMargin == virtualPadManager.extraBottomMargin() && !force) return; // Our only criteria to decide a center change is the bottom margin
|
if (_extraBottomMargin == virtualPadManager.extraBottomMargin() && !force) return; // Our only criteria to decide a center change is the bottom margin
|
||||||
|
|
||||||
_extraBottomMargin = virtualPadManager.extraBottomMargin();
|
_extraBottomMargin = virtualPadManager.extraBottomMargin();
|
||||||
float margin = _screenDPI * 59 / 534; // 59px is for our 'base' of 534dpi (Pixel XL or Huawei Mate 9 Pro)
|
float margin = _screenDPI * VirtualPad::Manager::BASE_MARGIN / VirtualPad::Manager::DPI;
|
||||||
QScreen* eventScreen = qApp->primaryScreen(); // do not call every time
|
QScreen* eventScreen = qApp->primaryScreen(); // do not call every time
|
||||||
_fixedCenterPosition = glm::vec2( _fixedRadius + margin, eventScreen->size().height() - margin - _fixedRadius - _extraBottomMargin);
|
_fixedCenterPosition = glm::vec2( _fixedRadius + margin, eventScreen->size().height() - margin - _fixedRadius - _extraBottomMargin);
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ float clip(float n, float lower, float upper) {
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::vec2 origin, glm::vec2 touchPoint) {
|
glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::vec2 origin, glm::vec2 touchPoint) {
|
||||||
float deltaX = touchPoint.x-origin.x;
|
float deltaX = touchPoint.x - origin.x;
|
||||||
float deltaY = touchPoint.y-origin.y;
|
float deltaY = touchPoint.y - origin.y;
|
||||||
|
|
||||||
float distance = sqrt(pow(deltaX,2)+pow(deltaY,2));
|
float distance = sqrt(pow(deltaX, 2) + pow(deltaY, 2));
|
||||||
|
|
||||||
// First case, inside the boundaires, just use the distance
|
// First case, inside the boundaires, just use the distance
|
||||||
if (distance <= radius) {
|
if (distance <= radius) {
|
||||||
|
@ -99,18 +99,18 @@ glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::v
|
||||||
|
|
||||||
// Third case, calculate point in circumference
|
// Third case, calculate point in circumference
|
||||||
// line formula
|
// line formula
|
||||||
float m = deltaY/deltaX;
|
float m = deltaY / deltaX;
|
||||||
float b = touchPoint.y - m * touchPoint.x;
|
float b = touchPoint.y - m * touchPoint.x;
|
||||||
|
|
||||||
// quadtratic coefs of circumference and line intersection
|
// quadtratic coefs of circumference and line intersection
|
||||||
float qa = pow(m,2)+1;
|
float qa = powf(m, 2.0f) + 1.0f;
|
||||||
float qb = 2 * ( m * b - origin.x - origin.y * m );
|
float qb = 2.0f * ( m * b - origin.x - origin.y * m);
|
||||||
float qc = powf(origin.x, 2) - powf(radius,2) + b * b - 2 * b * origin.y + powf(origin.y, 2);
|
float qc = powf(origin.x, 2.0f) - powf(radius, 2.0f) + b * b - 2.0f * b * origin.y + powf(origin.y, 2.0f);
|
||||||
|
|
||||||
float discr = qb * qb - 4 * qa * qc;
|
float discr = qb * qb - 4.0f * qa * qc;
|
||||||
float discrSign = deltaX>0?1.0:-1.0;
|
float discrSign = deltaX > 0.0f ? 1.0f : - 1.0f;
|
||||||
|
|
||||||
float finalX = (- qb + discrSign * sqrtf(discr)) / (2 * qa);
|
float finalX = (-qb + discrSign * sqrtf(discr)) / (2.0f * qa);
|
||||||
float finalY = m * finalX + b;
|
float finalY = m * finalX + b;
|
||||||
|
|
||||||
return vec2(finalX, finalY);
|
return vec2(finalX, finalY);
|
||||||
|
|
|
@ -34,6 +34,11 @@ namespace VirtualPad {
|
||||||
return _currentTouch;
|
return _currentTouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float Manager::DPI = 534.0f;
|
||||||
|
const float Manager::PIXEL_SIZE = 512.0f;
|
||||||
|
const float Manager::STICK_RADIUS = 105.0f;
|
||||||
|
const float Manager::BASE_MARGIN = 59.0f;
|
||||||
|
|
||||||
Manager::Manager() {
|
Manager::Manager() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,12 @@ namespace VirtualPad {
|
||||||
void hide(bool hide);
|
void hide(bool hide);
|
||||||
int extraBottomMargin();
|
int extraBottomMargin();
|
||||||
void setExtraBottomMargin(int margin);
|
void setExtraBottomMargin(int margin);
|
||||||
|
|
||||||
|
static const float DPI;
|
||||||
|
static const float PIXEL_SIZE;
|
||||||
|
static const float STICK_RADIUS;
|
||||||
|
static const float BASE_MARGIN;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Instance _leftVPadInstance;
|
Instance _leftVPadInstance;
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
|
Loading…
Reference in a new issue