mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
Fix warnings regarding float to double conversion
This commit is contained in:
parent
76e4a5bef2
commit
c091bc0bb3
2 changed files with 8 additions and 8 deletions
|
@ -68,7 +68,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();
|
||||||
qreal margin = _screenDPI * 59 / 534; // 59px is for our 'base' of 534dpi (Pixel XL or Huawei Mate 9 Pro)
|
float margin = _screenDPI * 59 / 534; // 59px is for our 'base' of 534dpi (Pixel XL or Huawei Mate 9 Pro)
|
||||||
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);
|
||||||
|
|
||||||
|
@ -104,12 +104,12 @@ glm::vec2 TouchscreenVirtualPadDevice::clippedPointInCircle(float radius, glm::v
|
||||||
// quadtratic coefs of circumference and line intersection
|
// quadtratic coefs of circumference and line intersection
|
||||||
float qa = pow(m,2)+1;
|
float qa = pow(m,2)+1;
|
||||||
float qb = 2 * ( m * b - origin.x - origin.y * m );
|
float qb = 2 * ( m * b - origin.x - origin.y * m );
|
||||||
float qc = pow(origin.x, 2) - pow(radius,2) + b * b - 2 * b * origin.y + pow(origin.y, 2);
|
float qc = powf(origin.x, 2) - powf(radius,2) + b * b - 2 * b * origin.y + powf(origin.y, 2);
|
||||||
|
|
||||||
float discr = qb * qb - 4 * qa * qc;
|
float discr = qb * qb - 4 * qa * qc;
|
||||||
float discrSign = deltaX>0?1.0:-1.0;
|
float discrSign = deltaX>0?1.0:-1.0;
|
||||||
|
|
||||||
float finalX = (- qb + discrSign * sqrt(discr)) / (2 * qa);
|
float finalX = (- qb + discrSign * sqrtf(discr)) / (2 * qa);
|
||||||
float finalY = m * finalX + b;
|
float finalY = m * finalX + b;
|
||||||
|
|
||||||
return vec2(finalX, finalY);
|
return vec2(finalX, finalY);
|
||||||
|
|
|
@ -62,9 +62,9 @@ public:
|
||||||
const std::shared_ptr<InputDevice>& getInputDevice() const { return _inputDevice; }
|
const std::shared_ptr<InputDevice>& getInputDevice() const { return _inputDevice; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
qreal _lastPinchScale;
|
float _lastPinchScale;
|
||||||
qreal _pinchScale;
|
float _pinchScale;
|
||||||
qreal _screenDPI;
|
float _screenDPI;
|
||||||
glm::vec2 _screenDPIScale;
|
glm::vec2 _screenDPIScale;
|
||||||
bool _validTouchLeft;
|
bool _validTouchLeft;
|
||||||
glm::vec2 _firstTouchLeftPoint;
|
glm::vec2 _firstTouchLeftPoint;
|
||||||
|
@ -78,8 +78,8 @@ protected:
|
||||||
|
|
||||||
bool _fixedPosition;
|
bool _fixedPosition;
|
||||||
glm::vec2 _fixedCenterPosition;
|
glm::vec2 _fixedCenterPosition;
|
||||||
qreal _fixedRadius;
|
float _fixedRadius;
|
||||||
qreal _fixedRadiusForCalc;
|
float _fixedRadiusForCalc;
|
||||||
int _extraBottomMargin {0};
|
int _extraBottomMargin {0};
|
||||||
|
|
||||||
void touchLeftBegin(glm::vec2 touchPoint);
|
void touchLeftBegin(glm::vec2 touchPoint);
|
||||||
|
|
Loading…
Reference in a new issue