Example #1
0
	void PretzelTextField::draw(){
		gl::pushMatrices(); {
			gl::translate(mOffset);
            
            if(bEditing){
				gl::color(mGlobal->P_HOVER_COLOR);
			}
			else if (bHover){
				gl::color(mGlobal->P_TAB_COLOR);
			}
			else{
				gl::color(mGlobal->P_BG_COLOR);
			}
			pretzel()->drawSolidRect(mTextFieldBounds);

			gl::color(mGlobal->P_HIGHLIGHT_COLOR);
			pretzel()->drawLine(mTextFieldBounds.getLowerLeft() + vec2(0, 1), mTextFieldBounds.getLowerRight() + vec2(0, 1));
            
            gl::color(mGlobal->P_OUTLINE_COLOR);
            pretzel()->drawStrokedRect(mTextFieldBounds);

            mGlobal->renderText(mLabelText, mBounds.getUpperLeft() + vec2(12, 5));
            mGlobal->renderText(*mVariable, mTextFieldBounds.getUpperLeft() + vec2(2, 0));
			
			// cursor line
			if (bEditing && (app::getElapsedSeconds() - (long)app::getElapsedSeconds()) < 0.5 ){
				float x = mTextFieldBounds.getUpperLeft().x + mInputSize.x + 4;
				gl::color(mGlobal->P_TEXT_COLOR);
				pretzel()->drawLine(vec2(x, mTextFieldBounds.y1 + 2), vec2(x, mTextFieldBounds.y2 - 2));
			}
		}gl::popMatrices();
	}
	void PretzelButton::draw(){
		gl::pushMatrices(); {
			gl::translate(mOffset);
            gl::color( mBgColor );
            pretzel()->drawSolidRect( mButtonBounds );

			gl::color(mGlobal->P_HIGHLIGHT_COLOR);
			pretzel()->drawLine(mButtonBounds.getUpperLeft() + vec2(0, 1), mButtonBounds.getUpperRight() + vec2(0, 1));

			gl::color(mGlobal->P_OUTLINE_COLOR);
			pretzel()->drawStrokedRect(mButtonBounds);
			mGlobal->renderTextCentered(mLabelText, vec2(mButtonBounds.getCenter().x, 5));
		}gl::popMatrices();
	}
Example #3
0
	void PretzelLabel::draw()
    {
		vec2 textSize = mGlobal->guiFont->measureString(mMessage);
		RectT<float> textRect(0, 0, textSize.x, textSize.y);
		textRect.y1 = 4;
		textRect.y2 = mBounds.getHeight()-1;
		textRect.x1 -= 5;
		textRect.x2 += 5;

		gl::pushMatrices(); {
			gl::translate(mOffset + scrollPaneOffset);

			// draw light background
			gl::color(mGlobal->P_TAB_COLOR);
            pretzel()->drawSolidRect(mBounds);

			gl::pushMatrices(); {
				gl::translate(15, 1);

				// draw dark background
				gl::color(mGlobal->P_BG_COLOR);
                pretzel()->drawSolidRect(textRect);

				// draw text
				mGlobal->renderText(mMessage, mBounds.getUpperLeft() + vec2(0, 4));
			}gl::popMatrices();

			// draw highlight line
			gl::translate(0, 1);
			gl::color(mGlobal->P_HIGHLIGHT_COLOR);
			gl::draw(mOutlinePath);

			gl::translate(0, -1);
			gl::color(mGlobal->P_OUTLINE_COLOR);
			gl::draw(mOutlinePath);


		}gl::popMatrices();
	}
	void PretzelToggle::draw() {
		gl::pushMatrices(); {
			gl::translate(mOffset + vec2(0,2));

			// draw box
			RectT<float> tmpRect = mCheckBoxRect;

			gl::color(mGlobal->P_SLIDER_COLOR);
			pretzel()->drawSolidRect(tmpRect);

			tmpRect.inflate(vec2(-2, -2));
			gl::color(mGlobal->P_BG_COLOR);
			pretzel()->drawSolidRect(tmpRect);

			// draw check
			if(*mValue){
				gl::color(ColorA(1, 1, 1, 1));
				gl::draw(mGlobal->mSkinTex, mSkinTexRect, mSkinDestRect);
			}
			mGlobal->renderText(mLabel, vec2(27, 1));

		}gl::popMatrices();
	}
 void PSliderT<T>::draw(){
     
     gl::pushMatrices();{
         gl::color(mGlobal->P_SLIDER_COLOR);
         pretzel()->drawLine(mSliderLeft, mSliderRight);
         
         gl::translate(0, mPosOffset);
         
         
         gl::color(ColorA(1, 1, 1, 1));
         gl::pushMatrices(); {
             gl::translate(mHandlePos);
             gl::draw(mGlobal->mSkinTex, mSkinTexRect, mSkinDestRect);
         }gl::popMatrices();
     }gl::popMatrices();
 }
	void PretzelColorPicker::draw()
    {
		gl::pushMatrices(); {
			gl::translate(mOffset + vec2(0,2));
            
            // TOP ------------------------------------------------------------
            
            gl::color(1,1,1,1);
            if( mArrowTex ){
                gl::pushMatrices();{
                    gl::translate( vec2(14, 8) );
                    gl::rotate( toRadians( mArrowRotation ) );
                    gl::translate( floor(mArrowTex->getWidth() * -0.5), floor(mArrowTex->getHeight() * -0.5) );
                    gl::draw( mArrowTex );
                }gl::popMatrices();
            }
            
            // checkered bg
            gl::draw(mCheckerPat, mColorPickRect.getUpperLeft() );
            
            // color
            if( bUseAlpha ){ gl::color( *mColorA ); }
            else { gl::color(*mColor); }
			pretzel()->drawSolidRect(mColorPickRect);
            
            // outline
            gl::color( mGlobal->P_OUTLINE_COLOR );
//            pretzel()->drawStrokedRect(mColorPickRect);

			mGlobal->renderText(mLabel, vec2(25, 1));
            
            // BOTTOM ------------------------------------------------------------
            if(bExpanded){
                gl::color( ColorA(1, 1, 1, 1 ) );
                
                gl::draw( mHueStrip, mHueStripRect );
                gl::drawLine( vec2(mHueStripRect.x1 - 3, mHueStripRect.y1 + mHueStripRect.getHeight() * mHueNorm),
                              vec2(mHueStripRect.x2 + 3, mHueStripRect.y1 + mHueStripRect.getHeight() * mHueNorm) );
                
                gl::draw(mBoxFbo->getColorTexture(), mColorSwatchRect);
                gl::draw(mCrosshairTex,
                         mColorSwatchRect.getUpperLeft() + (mCrosshairPos * mColorSwatchRect.getSize()) -
                         ( vec2(mCrosshairTex->getSize()) * 0.5f ) ); //* 0.5f
            }
            
		}gl::popMatrices();
	}