diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lljoystickbutton.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lljoystickbutton.cpp | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/linden/indra/newview/lljoystickbutton.cpp b/linden/indra/newview/lljoystickbutton.cpp index dddbea8..b429ed2 100644 --- a/linden/indra/newview/lljoystickbutton.cpp +++ b/linden/indra/newview/lljoystickbutton.cpp | |||
@@ -36,6 +36,7 @@ | |||
36 | // Library includes | 36 | // Library includes |
37 | #include "llcoord.h" | 37 | #include "llcoord.h" |
38 | #include "indra_constants.h" | 38 | #include "indra_constants.h" |
39 | #include "llglimmediate.h" | ||
39 | 40 | ||
40 | // Project includes | 41 | // Project includes |
41 | #include "llui.h" | 42 | #include "llui.h" |
@@ -72,18 +73,18 @@ LLJoystick::LLJoystick( | |||
72 | mHeldDown(FALSE), | 73 | mHeldDown(FALSE), |
73 | mHeldDownTimer() | 74 | mHeldDownTimer() |
74 | { | 75 | { |
75 | mHeldDownCallback = &LLJoystick::onHeldDown; | 76 | setHeldDownCallback(&LLJoystick::onHeldDown); |
76 | mCallbackUserData = this; | 77 | setCallbackUserData(this); |
77 | } | 78 | } |
78 | 79 | ||
79 | 80 | ||
80 | void LLJoystick::updateSlop() | 81 | void LLJoystick::updateSlop() |
81 | { | 82 | { |
82 | mVertSlopNear = mRect.getHeight(); | 83 | mVertSlopNear = getRect().getHeight(); |
83 | mVertSlopFar = mRect.getHeight() * 2; | 84 | mVertSlopFar = getRect().getHeight() * 2; |
84 | 85 | ||
85 | mHorizSlopNear = mRect.getWidth(); | 86 | mHorizSlopNear = getRect().getWidth(); |
86 | mHorizSlopFar = mRect.getWidth() * 2; | 87 | mHorizSlopFar = getRect().getWidth() * 2; |
87 | 88 | ||
88 | // Compute initial mouse offset based on initial quadrant. | 89 | // Compute initial mouse offset based on initial quadrant. |
89 | // Place the mouse evenly between the near and far zones. | 90 | // Place the mouse evenly between the near and far zones. |
@@ -163,7 +164,7 @@ F32 LLJoystick::getElapsedHeldDownTime() | |||
163 | { | 164 | { |
164 | if( mHeldDown ) | 165 | if( mHeldDown ) |
165 | { | 166 | { |
166 | return mMouseDownTimer.getElapsedTimeF32(); | 167 | return getHeldDownTime(); |
167 | } | 168 | } |
168 | else | 169 | else |
169 | { | 170 | { |
@@ -244,13 +245,13 @@ LLXMLNodePtr LLJoystick::getXML(bool save_children) const | |||
244 | { | 245 | { |
245 | LLXMLNodePtr node = LLUICtrl::getXML(); | 246 | LLXMLNodePtr node = LLUICtrl::getXML(); |
246 | 247 | ||
247 | node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); | 248 | node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign())); |
248 | node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); | 249 | node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); |
249 | 250 | ||
250 | addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,"image_unselected"); | 251 | addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),"image_unselected"); |
251 | addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,"image_selected"); | 252 | addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),"image_selected"); |
252 | 253 | ||
253 | node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); | 254 | node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage()); |
254 | 255 | ||
255 | return node; | 256 | return node; |
256 | } | 257 | } |
@@ -504,8 +505,8 @@ BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask) | |||
504 | updateSlop(); | 505 | updateSlop(); |
505 | 506 | ||
506 | // Set initial offset based on initial click location | 507 | // Set initial offset based on initial click location |
507 | S32 horiz_center = mRect.getWidth() / 2; | 508 | S32 horiz_center = getRect().getWidth() / 2; |
508 | S32 vert_center = mRect.getHeight() / 2; | 509 | S32 vert_center = getRect().getHeight() / 2; |
509 | 510 | ||
510 | S32 dx = x - horiz_center; | 511 | S32 dx = x - horiz_center; |
511 | S32 dy = y - vert_center; | 512 | S32 dy = y - vert_center; |
@@ -607,26 +608,26 @@ void LLJoystickCameraRotate::draw() | |||
607 | { | 608 | { |
608 | LLGLSUIDefault gls_ui; | 609 | LLGLSUIDefault gls_ui; |
609 | 610 | ||
610 | mImageUnselected->draw( 0, 0 ); | 611 | getImageUnselected()->draw( 0, 0 ); |
611 | 612 | ||
612 | if( mInTop ) | 613 | if( mInTop ) |
613 | { | 614 | { |
614 | drawRotatedImage( mImageSelected->getImage(), 0 ); | 615 | drawRotatedImage( getImageSelected()->getImage(), 0 ); |
615 | } | 616 | } |
616 | 617 | ||
617 | if( mInRight ) | 618 | if( mInRight ) |
618 | { | 619 | { |
619 | drawRotatedImage( mImageSelected->getImage(), 1 ); | 620 | drawRotatedImage( getImageSelected()->getImage(), 1 ); |
620 | } | 621 | } |
621 | 622 | ||
622 | if( mInBottom ) | 623 | if( mInBottom ) |
623 | { | 624 | { |
624 | drawRotatedImage( mImageSelected->getImage(), 2 ); | 625 | drawRotatedImage( getImageSelected()->getImage(), 2 ); |
625 | } | 626 | } |
626 | 627 | ||
627 | if( mInLeft ) | 628 | if( mInLeft ) |
628 | { | 629 | { |
629 | drawRotatedImage( mImageSelected->getImage(), 3 ); | 630 | drawRotatedImage( getImageSelected()->getImage(), 3 ); |
630 | } | 631 | } |
631 | 632 | ||
632 | if (sDebugRects) | 633 | if (sDebugRects) |
@@ -637,7 +638,7 @@ void LLJoystickCameraRotate::draw() | |||
637 | } | 638 | } |
638 | 639 | ||
639 | // Draws image rotated by multiples of 90 degrees | 640 | // Draws image rotated by multiples of 90 degrees |
640 | void LLJoystickCameraRotate::drawRotatedImage( LLImageGL* image, S32 rotations ) | 641 | void LLJoystickCameraRotate::drawRotatedImage( const LLImageGL* image, S32 rotations ) |
641 | { | 642 | { |
642 | S32 width = image->getWidth(); | 643 | S32 width = image->getWidth(); |
643 | S32 height = image->getHeight(); | 644 | S32 height = image->getHeight(); |
@@ -652,23 +653,23 @@ void LLJoystickCameraRotate::drawRotatedImage( LLImageGL* image, S32 rotations ) | |||
652 | 653 | ||
653 | image->bind(); | 654 | image->bind(); |
654 | 655 | ||
655 | glColor4fv(UI_VERTEX_COLOR.mV); | 656 | gGL.color4fv(UI_VERTEX_COLOR.mV); |
656 | 657 | ||
657 | glBegin(GL_QUADS); | 658 | gGL.begin(GL_QUADS); |
658 | { | 659 | { |
659 | glTexCoord2fv( uv[ (rotations + 0) % 4]); | 660 | gGL.texCoord2fv( uv[ (rotations + 0) % 4]); |
660 | glVertex2i(width, height ); | 661 | gGL.vertex2i(width, height ); |
661 | 662 | ||
662 | glTexCoord2fv( uv[ (rotations + 1) % 4]); | 663 | gGL.texCoord2fv( uv[ (rotations + 1) % 4]); |
663 | glVertex2i(0, height ); | 664 | gGL.vertex2i(0, height ); |
664 | 665 | ||
665 | glTexCoord2fv( uv[ (rotations + 2) % 4]); | 666 | gGL.texCoord2fv( uv[ (rotations + 2) % 4]); |
666 | glVertex2i(0, 0); | 667 | gGL.vertex2i(0, 0); |
667 | 668 | ||
668 | glTexCoord2fv( uv[ (rotations + 3) % 4]); | 669 | gGL.texCoord2fv( uv[ (rotations + 3) % 4]); |
669 | glVertex2i(width, 0); | 670 | gGL.vertex2i(width, 0); |
670 | } | 671 | } |
671 | glEnd(); | 672 | gGL.end(); |
672 | } | 673 | } |
673 | 674 | ||
674 | 675 | ||
@@ -732,7 +733,7 @@ BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask) | |||
732 | 733 | ||
733 | if( handled ) | 734 | if( handled ) |
734 | { | 735 | { |
735 | if (mFirstMouse.mY > mRect.getHeight() / 2) | 736 | if (mFirstMouse.mY > getRect().getHeight() / 2) |
736 | { | 737 | { |
737 | mInitialQuadrant = JQ_UP; | 738 | mInitialQuadrant = JQ_UP; |
738 | } | 739 | } |
@@ -801,7 +802,7 @@ void LLJoystickCameraZoom::draw() | |||
801 | } | 802 | } |
802 | else | 803 | else |
803 | { | 804 | { |
804 | mImageUnselected->draw( 0, 0 ); | 805 | getImageUnselected()->draw( 0, 0 ); |
805 | } | 806 | } |
806 | 807 | ||
807 | if (sDebugRects) | 808 | if (sDebugRects) |
@@ -813,11 +814,11 @@ void LLJoystickCameraZoom::draw() | |||
813 | 814 | ||
814 | void LLJoystickCameraZoom::updateSlop() | 815 | void LLJoystickCameraZoom::updateSlop() |
815 | { | 816 | { |
816 | mVertSlopNear = mRect.getHeight() / 4; | 817 | mVertSlopNear = getRect().getHeight() / 4; |
817 | mVertSlopFar = mRect.getHeight() / 2; | 818 | mVertSlopFar = getRect().getHeight() / 2; |
818 | 819 | ||
819 | mHorizSlopNear = mRect.getWidth() / 4; | 820 | mHorizSlopNear = getRect().getWidth() / 4; |
820 | mHorizSlopFar = mRect.getWidth() / 2; | 821 | mHorizSlopFar = getRect().getWidth() / 2; |
821 | 822 | ||
822 | // Compute initial mouse offset based on initial quadrant. | 823 | // Compute initial mouse offset based on initial quadrant. |
823 | // Place the mouse evenly between the near and far zones. | 824 | // Place the mouse evenly between the near and far zones. |