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


C++ GFXDrawUtil::drawRectFill方法代码示例

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


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

示例1: onRender

void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
{
   bool highlight = mMouseOver;

   ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;

   RectI renderRect( offset, getExtent() );
   if ( !highlight )
      renderRect.inset( 1, 1 );      

   GFXDrawUtil *drawer = GFX->getDrawUtil();
   drawer->clearBitmapModulation();

   // Draw background transparency grid texture...
   if ( mGrid.isValid() )
      drawer->drawBitmapStretch( mGrid, renderRect );

   // Draw swatch color as fill...
   if (!mUseSRGB)
      drawer->drawRectFill( renderRect, mSwatchColor.toGamma() );
   else
      drawer->drawRectFill(renderRect, mSwatchColor);

   // Draw any borders...
   drawer->drawRect( renderRect, borderColor );
}
开发者ID:J0linar,项目名称:Torque3D,代码行数:26,代码来源:guiSwatchButtonCtrl.cpp

示例2: _drawRiverControlNodes

void GuiRiverEditorCtrl::_drawRiverControlNodes( River *river, const ColorI &color )
{
   if ( !River::smShowSpline )
      return;

   RectI bounds = getBounds();

   GFXDrawUtil *drawer = GFX->getDrawUtil();

   bool isSelected = ( river == mSelRiver );
   bool isHighlighted = ( river == mHoverRiver );

   for ( U32 i = 0; i < river->mNodes.size(); i++ )
   {
      if ( false && isSelected && mSelNode == i  )
         continue;

      const Point3F &wpos = river->mNodes[i].point;

      Point3F spos;
      project( wpos, &spos );                  

      if ( spos.z > 1.0f )
         continue;

      Point2I posi;
      posi.x = spos.x;
      posi.y = spos.y;

      if ( !bounds.pointInRect( posi ) )
         continue;

      ColorI theColor = color;
      Point2I nodeHalfSize = mNodeHalfSize;

      if ( isHighlighted && mHoverNode == i )
      {
         //theColor = mHoverNodeColor;
         nodeHalfSize += Point2I(2,2);
      }

      if ( isSelected )
      {   
         if ( mSelNode == i )
         {
            theColor.set(0,0,255);
         }
         else if ( i == 0 )
         {
            theColor.set(0,255,0);
         }
         else if ( i == river->mNodes.size() - 1 )
         {
            theColor.set(255,0,0);
         }         
      }

      drawer->drawRectFill( posi - nodeHalfSize, posi + nodeHalfSize, theColor );
   }
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:60,代码来源:guiRiverEditorCtrl.cpp

示例3: renderSlightlyRaisedBox

void renderSlightlyRaisedBox( const RectI &bounds, GuiControlProfile *profile )
{
   S32 l = bounds.point.x + 1, r = bounds.point.x + bounds.extent.x - 1;
   S32 t = bounds.point.y + 1, b = bounds.point.y + bounds.extent.y - 1;

   GFXDrawUtil *drawer = GFX->getDrawUtil();
   drawer->drawRectFill( bounds, profile->mFillColor);
   drawer->drawLine(l, t, l, b, profile->mBorderColor);
   drawer->drawLine(l, t, r, t, profile->mBorderColor);
   drawer->drawLine(l + 1, b, r, b, profile->mBorderColor);
   drawer->drawLine(r, t + 1, r, b - 1, profile->mBorderColor);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:12,代码来源:guiDefaultControlRender.cpp

示例4: renderGui

void GuiDecalEditorCtrl::renderGui( Point2I offset, const RectI &updateRect )
{
   Parent::renderGui( offset, updateRect );

   PROFILE_SCOPE( GuiDecalEditorCtrl_renderGui );

   // Show the pixelSize of the selected decal as a text overlay.
   if ( smRenderDecalPixelSize && mSELDecal != NULL )
   {
      const F32 pixelSize = mSELDecal->calcPixelSize( mSaveViewport.extent.y, mLastCameraQuery.cameraMatrix.getPosition(), mSaveWorldToScreenScale.y );
      
      // Find position onscreen to render the text.
      Point3F screenPos;
      bool onScreen = project( mSELDecal->mPosition, &screenPos );

      if ( onScreen )
      {
         // It is extremely annoying to require the GuiProfile to have a font
         // or to create one within the decal editor for only this single use,
         // so we instead rely on the fact that we already have a Gizmo, that
         // all Gizmo's have a GizmoProfile, and that GizmoProfile has a font.
         GFont *font = mGizmo->getProfile()->font;

         // Might as well use some colors defined in GizmoProfile too instead
         // of just hardcoding it here.
         const ColorI bgColor = mGizmo->getProfile()->inActiveColor;
         const ColorI textColor = mGizmo->getProfile()->activeColor;

         // Note: This mostly mirrors the way WorldEditor renders popupText for
         // the gizmo during a drag operation, consider unifying this into a utility method.

         char buf[256];
         dSprintf( buf, 256, "%0.3f", pixelSize );

         const U32 width = font->getStrWidth((const UTF8 *)buf);;
         const Point2I posi( (U32)screenPos.x, (U32)screenPos.y + 12 );   
         const Point2I minPt(posi.x - width / 2 - 2, posi.y - 1);
         const Point2I maxPt(posi.x + width / 2 + 2, posi.y + font->getHeight() + 1);

         GFXDrawUtil *drawer = GFX->getDrawUtil();
         drawer->drawRectFill( minPt, maxPt, bgColor );
	      GFX->getDrawUtil()->setBitmapModulation( textColor );
         GFX->getDrawUtil()->drawText( mProfile->mFont, Point2I( posi.x - width / 2, posi.y ), buf );
      }      
   }
}
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:46,代码来源:guiDecalEditorCtrl.cpp

示例5: renderRaisedBox

void renderRaisedBox( const RectI &bounds, GuiControlProfile *profile )
{
   S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
   S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;

   GFXDrawUtil* drawUtil = GFX->getDrawUtil();

   drawUtil->drawRectFill( bounds, profile->mFillColor);
   drawUtil->drawLine(l, t, l, b - 1, colorWhite);
   drawUtil->drawLine(l, t, r - 1, t, colorWhite);

   drawUtil->drawLine(l, b, r, b, colorBlack);
   drawUtil->drawLine(r, b - 1, r, t, colorBlack);

   drawUtil->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
   drawUtil->drawLine(r - 1, b - 2, r - 1, t + 1, profile->mBorderColor);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:17,代码来源:guiDefaultControlRender.cpp


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