当前位置: 首页>>代码示例>>C++>>正文


C++ GsRect类代码示例

本文整理汇总了C++中GsRect的典型用法代码示例。如果您正苦于以下问题:C++ GsRect类的具体用法?C++ GsRect怎么用?C++ GsRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GsRect类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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 );
}
开发者ID:z33ky,项目名称:Commander-Genius,代码行数:35,代码来源:GsNumberControl.cpp

示例2: processRender

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);
}
开发者ID:z33ky,项目名称:Commander-Genius,代码行数:32,代码来源:NumberControl.cpp

示例3: processRender

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);

}
开发者ID:z33ky,项目名称:Commander-Genius,代码行数:34,代码来源:NumberControl.cpp

示例4: processPointingState

void CGUIControl::processPointingState(const GsRect<float> &rect)
{
    GsPointingState &pointingState = gPointDevice.mPointingState;

    const bool hasPoint = rect.HasPoint(pointingState.mPos);
    const bool bDown = (pointingState.mActionButton>0);

    mReleased = false;

    if(!bDown && mPressed)
    {
        mPressed = false;

        if(hasPoint)
        {
            mReleased = true;
        }
    }

    if(!bDown || mPressed)
    {
        mHovered = hasPoint;
    }

    if(mHovered && bDown)
    {
        mPressed = true;
    }
}
开发者ID:FromCrimsonToWool,项目名称:Commander-Genius,代码行数:29,代码来源:GsControl.cpp

示例5: processRender

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);
}
开发者ID:FromCrimsonToWool,项目名称:Commander-Genius,代码行数:19,代码来源:Inputtext.cpp

示例6: renderIntro

void CPassiveGalaxy::renderIntro()
{
    GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
    SDL_Rect gameResSDL = gameRes.SDLRect();

    const int logoPosX = (gameRes.w-mCurrentLogoBmp.getWidth())/2;

    SDL_Surface *blitSfc = gVideoDriver.getBlitSurface();
    SDL_FillRect( blitSfc, &gameResSDL, SDL_MapRGB(blitSfc->format, 0, 0, 0) );

    mCommanderTextSfc.draw(mCommanderTextPos.x, mCommanderTextPos.y);
    mKeenTextSfc.draw(mKeenTextPos.x, mKeenTextPos.y);

    if(mTerminatorLogoNum < 4)
    {
        mCurrentLogoBmp.draw(logoPosX, mLogoPosY);
    }

}
开发者ID:roman-murashov,项目名称:Commander-Genius,代码行数:19,代码来源:CPassive.cpp

示例7: processRender

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 );
    }
}
开发者ID:FromCrimsonToWool,项目名称:Commander-Genius,代码行数:22,代码来源:GsBitmap.cpp

示例8: scaleTo

bool GsBitmap::scaleTo(const GsRect<Uint16> &destRes)
{
    SDL_Rect newRect = destRes.SDLRect();

    // Need to do that, otherwise it won't work.
    optimizeSurface();

    if(newRect.w == mpBitmapSurface->w &&
       newRect.h == mpBitmapSurface->h)
        return true;


    std::shared_ptr<SDL_Surface> newSfc;

    auto bmpSfc = mpBitmapSurface.get();
    auto bmpFormat = bmpSfc->format;

    newSfc.reset( SDL_CreateRGBSurface(bmpSfc->flags,
                                       newRect.w, newRect.h,
                                       bmpFormat->BitsPerPixel,
                                       bmpFormat->Rmask,
                                       bmpFormat->Gmask,
                                       bmpFormat->Bmask,
                                       bmpFormat->Amask ),
                    &SDL_FreeSurface );

    if(!newSfc)
      return false;

#if SDL_VERSION_ATLEAST(2, 0, 0)

    SDL_BlendMode blendMode;

    SDL_GetSurfaceBlendMode(bmpSfc, &blendMode);
    SDL_SetSurfaceBlendMode(newSfc.get(), blendMode);

#endif

    CVidConfig &vidConf = gVideoDriver.getVidConfig();


    blitScaled(bmpSfc,
               bmpSfc->clip_rect,
               newSfc.get(),
               newRect,
               vidConf.m_ScaleXFilter);

    mpBitmapSurface = newSfc;

    return true;
}
开发者ID:carstene1ns,项目名称:Commander-Genius,代码行数:51,代码来源:GsBitmap.cpp

示例9: SDL_FillRect

void CPassiveGalaxy::renderIntroZoom()
{
    SDL_Rect dstRect, srGsRect;
    srGsRect.x = srGsRect.y = 0;

    if(mZoomSfcPos.x < 16)
    {
        srGsRect.x -= mZoomSfcPos.x;
    }

    if(mZoomSfcPos.y > 8)
    {
        srGsRect.y -= mZoomSfcPos.y;
    }

    SDL_Surface *zoomSfc = mpZoomSurface.get();

    // Here we define the Rects to zoom
    srGsRect.w = zoomSfc->w;
    srGsRect.h = zoomSfc->h;


    dstRect.x = mZoomSfcPos.x;
    dstRect.y = mZoomSfcPos.y;
    dstRect.w = mZoomSfcZoom.x;
    dstRect.h = mZoomSfcZoom.y;

    GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
    SDL_Rect gameResSDL = gameRes.SDLRect();

    SDL_Surface *blitSfc = gVideoDriver.getBlitSurface();
    SDL_FillRect( blitSfc, &gameResSDL, SDL_MapRGB(blitSfc->format, 0, 0, 0) );

    CVidConfig &vidConf = gVideoDriver.getVidConfig();

    blitScaled( zoomSfc, srGsRect, blitSfc, dstRect, vidConf.m_ScaleXFilter );
}
开发者ID:roman-murashov,项目名称:Commander-Genius,代码行数:37,代码来源:CPassive.cpp

示例10: scaleTo

bool GsSurface::scaleTo(const GsRect<Uint16> &scaledRect, const filterOptionType filter)
{
    SDL_Rect newRect = scaledRect.SDLRect();

    if(newRect.w == mpSurface->w && newRect.h == mpSurface->h)
        return true;


    // Need to do that, otherwise it won't work ???
    //optimizeSurface();

    auto sfcFormat = mpSurface->format;

    SDL_Surface *newSfc =
            SDL_CreateRGBSurface(mpSurface->flags,
                                 newRect.w, newRect.h,
                                 sfcFormat->BitsPerPixel,
                                 sfcFormat->Rmask,
                                 sfcFormat->Gmask,
                                 sfcFormat->Bmask,
                                 sfcFormat->Amask  );

    if(!newSfc)
      return false;

#if SDL_VERSION_ATLEAST(2, 0, 0)

    SDL_BlendMode blendMode;

    SDL_GetSurfaceBlendMode(mpSurface, &blendMode);
    SDL_SetSurfaceBlendMode(newSfc, blendMode);

#endif

    blitScaled(mpSurface,
               mpSurface->clip_rect,
               newSfc,
               newRect,
               filter);

    // Tear down old surface!
    SDL_FreeSurface(mpSurface);

    // And set the newly created and scaled one
    mpSurface = newSfc;

    return true;
}
开发者ID:akien-mga,项目名称:Commander-Genius,代码行数:48,代码来源:GsSurface.cpp

示例11: processRender

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());
    }

}
开发者ID:FromCrimsonToWool,项目名称:Commander-Genius,代码行数:71,代码来源:GsTextSelectionList.cpp


注:本文中的GsRect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。