summaryrefslogtreecommitdiff
path: root/indra/newview/lljoystickbutton.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-10-17 16:56:21 +0300
committerGitHub <noreply@github.com>2024-10-17 16:56:21 +0300
commit0ef7a9b39cf72da1211039ab22bdf8f9f6a2c984 (patch)
tree6f51ef179497265b5bff2a355471ae5dc9643ad2 /indra/newview/lljoystickbutton.cpp
parent9e24b300d02e5627ea0d304d412cb683ec2de3a4 (diff)
parentd3d349ae0f17a72481f30b9354b9367b1cd3b639 (diff)
Merge pull request #2856 from secondlife/marchcat/c-develop
Develop → Maint C sync
Diffstat (limited to 'indra/newview/lljoystickbutton.cpp')
-rw-r--r--indra/newview/lljoystickbutton.cpp82
1 files changed, 47 insertions, 35 deletions
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 70a8020d78..10a1cd6b71 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -79,7 +79,7 @@ LLJoystick::LLJoystick(const LLJoystick::Params& p)
mVertSlopFar(0),
mHorizSlopNear(0),
mHorizSlopFar(0),
- mHeldDown(FALSE),
+ mHeldDown(false),
mHeldDownTimer(),
mInitialQuadrant(p.quadrant)
{
@@ -160,7 +160,7 @@ bool LLJoystick::pointInCenterDot(S32 x, S32 y, S32 radius) const
return in_center_circle;
}
-BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
{
//LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL;
bool handles = false;
@@ -177,14 +177,14 @@ BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
}
-BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
{
// LL_INFOS() << "joystick mouse up " << x << ", " << y << LL_ENDL;
if( hasMouseCapture() )
{
mLastMouse.set(x, y);
- mHeldDown = FALSE;
+ mHeldDown = false;
onMouseUp();
}
@@ -192,7 +192,7 @@ BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
}
-BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask)
+bool LLJoystick::handleHover(S32 x, S32 y, MASK mask)
{
if( hasMouseCapture() )
{
@@ -220,7 +220,7 @@ void LLJoystick::onBtnHeldDown(void *userdata)
LLJoystick *self = (LLJoystick *)userdata;
if (self)
{
- self->mHeldDown = TRUE;
+ self->mHeldDown = true;
self->onHeldDown();
}
}
@@ -419,11 +419,11 @@ void LLJoystickAgentSlide::onHeldDown()
LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Params& p)
: LLJoystick(p),
- mInLeft( FALSE ),
- mInTop( FALSE ),
- mInRight( FALSE ),
- mInBottom( FALSE ),
- mInCenter( FALSE )
+ mInLeft( false ),
+ mInTop( false ),
+ mInRight( false ),
+ mInBottom( false ),
+ mInCenter( false )
{
mCenterImageName = "Cam_Rotate_Center";
}
@@ -444,9 +444,9 @@ void LLJoystickCameraRotate::updateSlop()
}
-BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gAgent.setMovementLocked(TRUE);
+ gAgent.setMovementLocked(true);
updateSlop();
// Set initial offset based on initial click location
@@ -461,7 +461,7 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
mInitialOffset.mX = 0;
mInitialOffset.mY = 0;
mInitialQuadrant = JQ_ORIGIN;
- mInCenter = TRUE;
+ mInCenter = true;
resetJoystickCamera();
}
@@ -497,18 +497,18 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
return LLJoystick::handleMouseDown(x, y, mask);
}
-BOOL LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLJoystickCameraRotate::handleMouseUp(S32 x, S32 y, MASK mask)
{
- gAgent.setMovementLocked(FALSE);
- mInCenter = FALSE;
+ gAgent.setMovementLocked(false);
+ mInCenter = false;
return LLJoystick::handleMouseUp(x, y, mask);
}
-BOOL LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask)
+bool LLJoystickCameraRotate::handleHover(S32 x, S32 y, MASK mask)
{
if (!pointInCenterDot(x, y, CENTER_DOT_RADIUS))
{
- mInCenter = FALSE;
+ mInCenter = false;
}
return LLJoystick::handleHover(x, y, mask);
@@ -568,7 +568,7 @@ F32 LLJoystickCameraRotate::getOrbitRate()
// Only used for drawing
-void LLJoystickCameraRotate::setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom )
+void LLJoystickCameraRotate::setToggleState( bool left, bool top, bool right, bool bottom )
{
mInLeft = left;
mInTop = top;
@@ -637,18 +637,24 @@ void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 r
gGL.color4fv(UI_VERTEX_COLOR.mV);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
- gGL.vertex2i(width, height );
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
+
+ gGL.texCoord2fv(uv[(rotations + 1) % 4]);
+ gGL.vertex2i(0, height);
- gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
- gGL.vertex2i(0, height );
+ gGL.texCoord2fv(uv[(rotations + 2) % 4]);
+ gGL.vertex2i(0, 0);
+
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
- gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
+ gGL.texCoord2fv(uv[(rotations + 2) % 4]);
gGL.vertex2i(0, 0);
- gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
+ gGL.texCoord2fv(uv[(rotations + 3) % 4]);
gGL.vertex2i(width, 0);
}
gGL.end();
@@ -732,12 +738,12 @@ LLJoystickQuaternion::LLJoystickQuaternion(const LLJoystickQuaternion::Params &p
{
for (int i = 0; i < 3; ++i)
{
- mLfRtAxis.mV[i] = (mXAxisIndex == i) ? 1.0 : 0.0;
- mUpDnAxis.mV[i] = (mYAxisIndex == i) ? 1.0 : 0.0;
+ mLfRtAxis.mV[i] = (mXAxisIndex == i) ? 1.0f : 0.0f;
+ mUpDnAxis.mV[i] = (mYAxisIndex == i) ? 1.0f : 0.0f;
}
}
-void LLJoystickQuaternion::setToggleState(BOOL left, BOOL top, BOOL right, BOOL bottom)
+void LLJoystickQuaternion::setToggleState(bool left, bool top, bool right, bool bottom)
{
mInLeft = left;
mInTop = top;
@@ -745,7 +751,7 @@ void LLJoystickQuaternion::setToggleState(BOOL left, BOOL top, BOOL right, BOOL
mInBottom = bottom;
}
-BOOL LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask)
{
updateSlop();
@@ -788,7 +794,7 @@ BOOL LLJoystickQuaternion::handleMouseDown(S32 x, S32 y, MASK mask)
return LLJoystick::handleMouseDown(x, y, mask);
}
-BOOL LLJoystickQuaternion::handleMouseUp(S32 x, S32 y, MASK mask)
+bool LLJoystickQuaternion::handleMouseUp(S32 x, S32 y, MASK mask)
{
return LLJoystick::handleMouseUp(x, y, mask);
}
@@ -864,8 +870,8 @@ void LLJoystickQuaternion::draw()
LLVector3 draw_point = mVectorZero * mRotation;
S32 halfwidth = getRect().getWidth() / 2;
S32 halfheight = getRect().getHeight() / 2;
- draw_point.mV[mXAxisIndex] = (draw_point.mV[mXAxisIndex] + 1.0) * halfwidth;
- draw_point.mV[mYAxisIndex] = (draw_point.mV[mYAxisIndex] + 1.0) * halfheight;
+ draw_point.mV[mXAxisIndex] = (draw_point.mV[mXAxisIndex] + 1.0f) * halfwidth;
+ draw_point.mV[mYAxisIndex] = (draw_point.mV[mYAxisIndex] + 1.0f) * halfheight;
gl_circle_2d(draw_point.mV[mXAxisIndex], draw_point.mV[mYAxisIndex], 4, 8,
draw_point.mV[mZAxisIndex] >= 0.f);
@@ -909,7 +915,7 @@ void LLJoystickQuaternion::drawRotatedImage(LLPointer<LLUIImage> image, S32 rota
gGL.color4fv(UI_VERTEX_COLOR.mV);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2fv(uv[(rotations + 0) % 4]);
gGL.vertex2i(width, height);
@@ -920,6 +926,12 @@ void LLJoystickQuaternion::drawRotatedImage(LLPointer<LLUIImage> image, S32 rota
gGL.texCoord2fv(uv[(rotations + 2) % 4]);
gGL.vertex2i(0, 0);
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
+
+ gGL.texCoord2fv(uv[(rotations + 1) % 4]);
+ gGL.vertex2i(0, height);
+
gGL.texCoord2fv(uv[(rotations + 3) % 4]);
gGL.vertex2i(width, 0);
}