void CGUIInputText::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); if(!mEnabled) return; SDL_Surface *blitsfc = gVideoDriver.getBlitSurface(); if( mReleased ) { drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00CFCFCF ); } else if( mPressed ) { drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00DFDFDF ); } else if( mHovered ) { drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00EFEFEF ); } else { drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00FFFFFF ); } // Now lets draw the text of the list control GsFont &Font = gGraphics.getFont(mFontID); Font.drawFontCentered( blitsfc, getInputString(), lRect.x, lRect.w, lRect.y, lRect.h,false ); }
void NumberControl::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); GsWeakSurface blitsfc(gVideoDriver.getBlitSurface()); if(!mEnabled) { mTextDisabledSfc.blitTo(blitsfc, lRect); } else { if(mHovered) { if(mDecSel) mTextLightSfcL.blitTo(blitsfc, lRect); else if(mIncSel) mTextLightSfcR.blitTo(blitsfc, lRect); else mTextLightSfc.blitTo(blitsfc, lRect); } else // Button is not hovered { mTextDarkSfc.blitTo(blitsfc, lRect); } } drawBlinker(lRect); }
void CGUINumberControl::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); GsRect<Uint16> lRect(displayRect); GsWeakSurface blitsfc(gVideoDriver.getBlitSurface()); if( mReleased ) { blitsfc.drawRect( lRect, 1, 0x00BBBBBB, 0x00CFCFCF ); } else if( mPressed ) { blitsfc.drawRect( lRect, 1, 0x00BBBBBB, 0x00DFDFDF ); } else if( mHovered ) { blitsfc.drawRect( lRect, 1, 0x00BBBBBB, 0x00EFEFEF ); } else { blitsfc.drawRect( lRect, 1, 0x00BBBBBB, 0x00FFFFFF ); } // Now lets draw the text of the list control GsFont &Font = gGraphics.getFont(mFontID); Font.drawFontCentered( blitsfc, mText, lRect, false ); }
void CGUIBitmap::processRender(const GsRect<float> &RectDispCoordFloat) { if(!mScaledBitmapPtr) { return; } if(mScaledBitmapPtr->empty()) { return; } // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); GsRect<Uint16> lRect = displayRect.SDLRect(); if( mScaledBitmapPtr->width() != lRect.w || mScaledBitmapPtr->height() != lRect.h ) { // copy the bitmap mScaledBitmapPtr.reset(new GsBitmap); *mScaledBitmapPtr = *mpBitmap; lRect.x = 0; lRect.y = 0; mScaledBitmapPtr->scaleTo(lRect); } else { mScaledBitmapPtr->draw( lRect.x, lRect.y ); } }
void NumberControl::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); GsWeakSurface blitsfc(gVideoDriver.getBlitSurface()); // Now lets draw the text of the list control GsFont &Font = gGraphics.getFont(mFontID); Font.drawFont( blitsfc, mText, lRect.x+24, lRect.y, false ); Font.drawFont( blitsfc, ":", lRect.x+24+mText.size()*8, lRect.y, false ); if(mSlider) { gGraphics.getFont(2).drawFont( blitsfc, sliderStr(), lRect.x+16+(mText.size()+2)*8, lRect.y, false ); } else { std::string text = (mDecSel) ? "\025" : " "; text += itoa(mValue); if(mIncSel) text += static_cast<char>(17); else text += " "; Font.drawFont( blitsfc, text, lRect.x+24+(mText.size()+2)*8, lRect.y, false ); } drawTwirl(lRect); }
void GsScrollbar::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); drawScrollBar(lRect); }
void Switch::processRender(const GsRect<float> &RectDispCoordFloat) { if(mStyle == Style::GALAXY) { ComboSelection::processRender(RectDispCoordFloat); } else if(mStyle == Style::VORTICON) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); drawVorticonStyle(lRect); } else { GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); drawNoStyle(lRect); } }
void CGUISwitch::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); /* SDL_Rect lRect = displayRect.SDLRect(); if(gpBehaviorEngine->getEngine() == ENGINE_VORTICON) { drawVorticonStyle(lRect); } else { (this->*drawButton)(lRect); } */ }
void InputText::processRender(const GsRect<float> &RectDispCoordFloat) { if(!mEnabled) return; // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); SDL_Surface *blitsfc = gVideoDriver.getBlitSurface(); // Now lets draw the text of the list control GsFont &Font = gGraphics.getFont(mFontID); Font.drawFont( blitsfc, getInputString(), lRect.x+24, lRect.y, false ); drawTwirl(lRect); }
void GalaxyButton::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); GsWeakSurface blitsfc( gVideoDriver.getBlitSurface() ); if(!mEnabled) { mTextDisabledSfc.blitTo(blitsfc, lRect); } else { drawEnabledButton(blitsfc, lRect, mHovered); } drawBlinker(lRect); }
void BorderedButton::processRender(const GsRect<float> &RectDispCoordFloat) { // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); GsWeakSurface blitsfc( gVideoDriver.getBlitSurface() ); Uint32 newcolor; if(!mEnabled) newcolor = blitsfc.mapRGB(123, 150, 123); else if(mHovered || mPressed) newcolor = blitsfc.mapRGB(84, 234, 84); else newcolor = blitsfc.mapRGB(38, 134, 38); blitsfc.drawFrameRect( lRect, 1, newcolor); lRect.y +=2; lRect.x +=2; if(!mEnabled) { mTextDisabledSfc.blitTo(blitsfc, lRect); } else { if(mHovered) { drawEnabledButton(blitsfc, lRect, true); } else { drawEnabledButton(blitsfc, lRect, false); } } }
void CGUIBitmap::processRender(const GsRect<float> &RectDispCoordFloat) { if(mScaledBitmap.empty()) return; // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); GsRect<Uint16> lRect = displayRect.SDLRect(); if( mScaledBitmap.getWidth() != lRect.w || mScaledBitmap.getHeight() != lRect.h ) { mScaledBitmap = GsBitmap( *mpBitmap.get() ); lRect.x = 0; lRect.y = 0; mScaledBitmap.scaleTo(lRect); } else { mScaledBitmap.draw( lRect.x, lRect.y ); } }
void CGUITextSelectionList::processRender(const GsRect<float> &RectDispCoordFloat) { // Blit the List surface SDL_Surface *Blitsurface = gVideoDriver.getBlitSurface(); // Transform to the display coordinates GsRect<float> displayRect = mRect; displayRect.transform(RectDispCoordFloat); SDL_Rect lRect = displayRect.SDLRect(); SDL_FillRect(Blitsurface, &lRect, 0xFFFFFFFF); // Now lets draw the text of the list control GsFont &Font = gGraphics.getFont(mFontID); // Move 16 Pixel so we have space for the cursor/twirl to show the selection const int sepHeight = Font.getPixelTextHeight()+2; const int xpos = lRect.x+16+1; const int ypos = lRect.y+10; unsigned int textlimitWidth = (lRect.w-16)/8; mScrollbar.mLastToShow = (lRect.h/sepHeight)-1; lRect.h = 10; lRect.x += 12; lRect.w -= 12; std::string trimmedText; std::list<std::string> :: iterator it = mItemList.begin(); for(int i=0 ; i<mScrollbar.scrollPos() ; it++, i++); for ( int line = 0; it != mItemList.end() && line<mScrollbar.mLastToShow ; it++, line++ ) { if(mPressedSelection == int(line) + mScrollbar.scrollPos() ) { lRect.y = ypos+(line*10)-1; SDL_FillRect(Blitsurface, &lRect, 0xFFA5A5F1); } else if(mReleasedSelection == int(line) + mScrollbar.scrollPos() ) { lRect.y = ypos+(line*10)-1; if(mSelected) SDL_FillRect(Blitsurface, &lRect, 0xFFB5B5F1); else SDL_FillRect(Blitsurface, &lRect, 0xFFC5C5C5); } else if(mHoverSelection == int(line) + mScrollbar.scrollPos() ) { lRect.y = ypos+(line*sepHeight)-1; SDL_FillRect(Blitsurface, &lRect, 0xFFE5E5F1); } trimmedText = *it; if(trimmedText.size() > textlimitWidth) trimmedText = trimmedText.substr(0, textlimitWidth); Font.drawFont(Blitsurface, trimmedText, xpos, ypos+(line*10), false); } mScrollbar.mMaxScrollAmt = mItemList.size()-mScrollbar.lastToShow(); // Do we need a scrollbar? if(mScrollbar.mMaxScrollAmt>0) { mScrollbar.processRender(displayRect); //drawScrollBar(displayRect.SDLRect()); } }