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


C++ CColor类代码示例

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


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

示例1: drawTargetedElement

void Cockpit::drawTargetedElement ()
{
  char str [20];
  CColor color;
  CVector3 tl, n;
  CRotation r;
  color.setColor (255, 0, 0);
  color.c [3] = 255;
  tl.x = -0.35; tl.y = -0.3; tl.z = -0.5;
  gl->disableAlphaBlending ();
  glEnable (GL_DEPTH_TEST);
  if (fplayer->target != NULL)
    if (fplayer->target->active)
    {
      glEnable (GL_LIGHTING);
      fplayer->target->o->draw (&n, &tl, fplayer->target->rot, 0.05, 0.3, 0);
      glDisable (GL_LIGHTING);
      if (((AIObj *) fplayer->target)->party == fplayer->party)
        color.setColor (0, 0, 255);
      font1->drawText (-24.0, -23.0, -4.0, fplayer->target->o->name, &color);
      sprintf (str, "%d", (int) (15.0 * fplayer->distance (fplayer->target)));
      font1->drawText (-24.0, -25.0, -4.0, str, &color);
    }
  glDisable (GL_DEPTH_TEST);
}
开发者ID:garywang,项目名称:3dmapping,代码行数:25,代码来源:cockpit.cpp

示例2: Xeromyces_ReadColor

// Reads Custom Color
void CGUI::Xeromyces_ReadColor(XMBElement Element, CXeromyces* pFile)
{
	// Read the color and stor in m_PreDefinedColors

	XMBAttributeList attributes = Element.GetAttributes();

	//IGUIObject* object = new CTooltip;
	CColor color;
	CStr name = attributes.GetNamedItem(pFile->GetAttributeID("name"));

	// Try parsing value 
	CStr value (Element.GetText());
	if (! value.empty())
	{
		// Try setting color to value
		if (!color.ParseString(value, 255.f))
		{
			LOGERROR(L"GUI: Unable to create custom color '%hs'. Invalid color syntax.", name.c_str());
		}
		else
		{
			// input color
			m_PreDefinedColors[name] = color;
		}
	}
}
开发者ID:Valvador,项目名称:PyroSpaceFork,代码行数:27,代码来源:CGUI.cpp

示例3: Set

//********************************************
// Set
//********************************************
void CColor::Set(CColor &c)
{
	m_Red = c.r();
	m_Green = c.g();
	m_Blue = c.b();
	m_Alpha = c.a();
}
开发者ID:heguanyu,项目名称:JointDetection,代码行数:10,代码来源:Color.cpp

示例4: RenderPixelBuffer

// The raytracing process
void CRenderingCore::RenderPixelBuffer()
{
    /**************************************************************
    STRATEGY:
    1. Run nested loop for the entire screen.
    **************************************************************/
    m_pcamCurrent->Describe();
    
    // 1.
    for (int y = 0; y < m_iPixelY; y++)
    {
		for (int x = 0; x < m_iPixelX; x++)
		{
			CColor colToUse;
			
            /****************************************************************
			NESTED LOOP LOGIC:
			Calculate the X fraction
			Get the pixel ray for this screen coordinate fromt the 
			camera
			Get the color for this ray.
			Plot the pixel with this color.
			****************************************************************/

			colToUse = Sample ((float)x, (float)y, 1);

			m_ppPixelBuffer[0][x][y] = ((float) (int)(colToUse.GetRed()   * 1000.0f)) / 1000.0f;
			m_ppPixelBuffer[1][x][y] = ((float) (int)(colToUse.GetGreen() * 1000.0f)) / 1000.0f;
			m_ppPixelBuffer[2][x][y] = ((float) (int)(colToUse.GetBlue()  * 1000.0f)) / 1000.0f;

		}
    }
}
开发者ID:vsuley,项目名称:Alight,代码行数:34,代码来源:RenderingCore.cpp

示例5: owned

//----------------------------------------------------------------------------------------------------
void UISearchTextField::drawClearMark (CDrawContext* context) const
{
	if (getText ().empty ())
		return;

	SharedPointer<CGraphicsPath> path = owned (context->createGraphicsPath ());
	if (path == 0)
		return;

	CRect r = getClearMarkRect ();
	CColor color (fontColor);
	color.alpha /= 2;
	context->setFillColor (color);
	context->setDrawMode (kAntiAliasing);
	context->drawEllipse (r, kDrawFilled);
	double h,s,v;
	color.toHSV (h, s, v);
	v = 1. - v;
	color.fromHSV (h, s, v);
	context->setFrameColor (color);
	context->setLineWidth (2.);
	r.inset (r.getWidth () / (M_PI * 2.) + 1, r.getHeight () / (M_PI * 2.) + 1);
	path->beginSubpath (r.getTopLeft ());
	path->addLine (r.getBottomRight ());
	path->beginSubpath (r.getBottomLeft ());
	path->addLine (r.getTopRight ());
	context->setDrawMode (kAntiAliasing|kNonIntegralMode);
	context->drawGraphicsPath (path, CDrawContext::kPathStroked);
}
开发者ID:EQ4,项目名称:vstgui,代码行数:30,代码来源:uisearchtextfield.cpp

示例6: drawWeapon

void Cockpit::drawWeapon ()
{
  char str [20];
  CColor color;
  CVector3 tl, n;
  CRotation r;
  if (fplayer->missiles [fplayer->missiletype] <= 0)
    return;
  color.setColor (255, 0, 0);
  color.c [3] = 255;
  tl.x = 0.35; tl.y = -0.3; tl.z = -0.5;
  gl->disableAlphaBlending ();
  glEnable (GL_DEPTH_TEST);
  CModel *missile = NULL;
  if (fplayer->missiletype == 0) missile = &model_missile1;
  else if (fplayer->missiletype == 1) missile = &model_missile2;
  else if (fplayer->missiletype == 2) missile = &model_missile3;
  else if (fplayer->missiletype == 3) missile = &model_missile4;
  else if (fplayer->missiletype == 4) missile = &model_missile5;
  else if (fplayer->missiletype == 5) missile = &model_missile6;
  else if (fplayer->missiletype == 6) missile = &model_missile7;
  else if (fplayer->missiletype == 7) missile = &model_missile8;
  glEnable (GL_LIGHTING);
  missile->draw (&n, &tl, fplayer->rot, 0.05, 1.0, 0);
  glDisable (GL_LIGHTING);
  glDisable (GL_DEPTH_TEST);
  font1->drawText (16.0, -22.0, -4.0, missile->name, &color);
  sprintf (str, "N %d", fplayer->missiles [fplayer->missiletype]);
  font1->drawText (16.0, -24.0, -4.0, str, &color);
}
开发者ID:garywang,项目名称:3dmapping,代码行数:30,代码来源:cockpit.cpp

示例7: getRed

CColor CColor::modulate ( const CColor& color ) const
{
    unsigned char R = static_cast<unsigned char> ( getRed()   * color.getRed()   / 255 );
    unsigned char G = static_cast<unsigned char> ( getGreen() * color.getGreen() / 255 );
    unsigned char B = static_cast<unsigned char> ( getBlue()  * color.getBlue()  / 255 );
    unsigned char A = static_cast<unsigned char> ( getAlpha() * color.getAlpha() / 255 );

    return CColor ( R , G , B , A );
}
开发者ID:teddy-michel,项目名称:OBJViewer,代码行数:9,代码来源:CColor.cpp

示例8: SetColor

 void CQTOpenGLUserFunctions::SetColor(const CColor& c_color) {
    const GLfloat pfColor[]     = {
       c_color.GetRed()   / 255.0f,
       c_color.GetGreen() / 255.0f,
       c_color.GetBlue()  / 255.0f
    };
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, DEFAULT_SPECULAR);
    glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, DEFAULT_SHININESS);
    glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, DEFAULT_EMISSION);
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, pfColor);
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: Register

buzzvm_state CBuzzController::Register(const std::string& str_key,
                                       const CColor& c_color) {
   buzzvm_pushs(m_tBuzzVM, buzzvm_string_register(m_tBuzzVM, str_key.c_str(), 1));
   buzzvm_pusht(m_tBuzzVM);
   buzzobj_t tColorTable = buzzvm_stack_at(m_tBuzzVM, 1);
   buzzvm_gstore(m_tBuzzVM);
   TablePut(tColorTable, "red", c_color.GetRed());
   TablePut(tColorTable, "green", c_color.GetGreen());
   TablePut(tColorTable, "blue", c_color.GetBlue());
   return m_tBuzzVM->state;
}
开发者ID:isvogor-foi,项目名称:BuzzExt,代码行数:11,代码来源:buzz_controller.cpp

示例10: TablePut

buzzvm_state CBuzzController::TablePut(buzzobj_t t_table,
                                       SInt32 n_idx,
                                       const CColor& c_color) {
   buzzvm_push(m_tBuzzVM, t_table);
   buzzvm_pushi(m_tBuzzVM, n_idx);
   buzzvm_pusht(m_tBuzzVM);
   buzzobj_t tColorTable = buzzvm_stack_at(m_tBuzzVM, 1);
   buzzvm_tput(m_tBuzzVM);
   TablePut(tColorTable, "red", c_color.GetRed());
   TablePut(tColorTable, "green", c_color.GetGreen());
   TablePut(tColorTable, "blue", c_color.GetBlue());
   return m_tBuzzVM->state;   
}
开发者ID:isvogor-foi,项目名称:BuzzExt,代码行数:13,代码来源:buzz_controller.cpp

示例11:

//--------------------------------------------------------------------
void FK2DEngine::UnApplyColorKey( CBitmap& p_Bitmap, CColor p_BackGround )
{
	CColor* p = p_Bitmap.Data();
	for( unsigned int i = p_Bitmap.Width() * p_Bitmap.Height(); i > 0; --i, ++p )
	{
		if( p->Alpha() == 0 )
		{
			*p = p_BackGround;
		}
		else
		{
			p->SetAlpha( 255 );
		}
	}
}
开发者ID:adan830,项目名称:FKEngine,代码行数:16,代码来源:BitmapColorKey.cpp

示例12: DrawText

 void CQTOpenGLUserFunctions::DrawText(const std::string& str_text,
                                       const CVector3& c_center_offset,
                                       const CColor& c_color) {
    glDisable(GL_LIGHTING);
    glDisable(GL_CULL_FACE);
    glColor3ub(c_color.GetRed(),
               c_color.GetGreen(),
               c_color.GetBlue());
    GetOpenGLWidget().renderText(c_center_offset.GetX(),
                                 c_center_offset.GetY(),
                                 c_center_offset.GetZ(),
                                 str_text.c_str());
    glEnable(GL_CULL_FACE);
    glEnable(GL_LIGHTING);
 }
开发者ID:squiddon,项目名称:argos3,代码行数:15,代码来源:qtopengl_user_functions.cpp

示例13: DrawPoint

   void CQTOpenGLUserFunctions::DrawPoint(const CVector3& c_position,
                                          const CColor& c_color,
                                          const Real f_point_diameter) {
      glDisable(GL_LIGHTING);
      glColor3ub(c_color.GetRed(),
                 c_color.GetGreen(),
                 c_color.GetBlue());
      glPointSize(f_point_diameter);
      glBegin(GL_POINTS);
      glVertex3f(c_position.GetX(), c_position.GetY(), c_position.GetZ());
      glEnd();
      glPointSize(1.0);
      glEnable(GL_LIGHTING);

   }
开发者ID:squiddon,项目名称:argos3,代码行数:15,代码来源:qtopengl_user_functions.cpp

示例14: DrawTriangle

   void CQTOpenGLUserFunctions::DrawTriangle(const CVector3& c_center_offset,
                                             const CColor& c_color,
                                             const bool b_fill,
                                             const CQuaternion& c_orientation,
                                             Real f_base,
                                             Real f_height) {

	    glDisable(GL_LIGHTING);
	    glDisable(GL_CULL_FACE);

	    glColor3ub(c_color.GetRed(),
                 c_color.GetGreen(),
                 c_color.GetBlue());

      if(b_fill) {
         glBegin(GL_POLYGON);
      }
      else {
         glBegin(GL_LINE_LOOP);
      }
      CVector3 cNormalDirection(0.0f, 0.0f, 1.0f);
      cNormalDirection.Rotate(c_orientation);
      glNormal3f(cNormalDirection.GetX(),
                 cNormalDirection.GetY(),
                 cNormalDirection.GetZ());

      CVector3 cVertex(f_height * 0.5f, 0.0f, 0.0f);
      cVertex.Rotate(c_orientation);
      glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
                 cVertex.GetY() + c_center_offset.GetY(),
                 cVertex.GetZ() + c_center_offset.GetZ());

      cVertex.Set(-f_height * 0.5f, f_base * 0.5f, 0.0f);
      cVertex.Rotate(c_orientation);
      glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
                 cVertex.GetY() + c_center_offset.GetY(),
                 cVertex.GetZ() + c_center_offset.GetZ());

      cVertex.Set(-f_height * 0.5f, -f_base * 0.5f, 0.0f);
      cVertex.Rotate(c_orientation);
      glVertex3f(cVertex.GetX() + c_center_offset.GetX(),
                 cVertex.GetY() + c_center_offset.GetY(),
                 cVertex.GetZ() + c_center_offset.GetZ());
      glEnd();

      glEnable(GL_CULL_FACE);
      glEnable(GL_LIGHTING);
   }
开发者ID:squiddon,项目名称:argos3,代码行数:48,代码来源:qtopengl_user_functions.cpp

示例15: RenderTileOutline

void TerrainOverlay::RenderTileOutline(const CColor& colour, int line_width, bool draw_hidden, ssize_t i, ssize_t j)
{
	if (draw_hidden)
	{
		glDisable(GL_DEPTH_TEST);
		glDisable(GL_CULL_FACE);
	}
	else
	{
		glEnable(GL_DEPTH_TEST);
		glEnable(GL_CULL_FACE);
	}

	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	if (line_width != 1)
		glLineWidth((float)line_width);

	CVector3D pos;
	glBegin(GL_QUADS);
		glColor4fv(colour.FloatArray());
		m_Terrain->CalcPosition(i,   j,   pos); glVertex3fv(pos.GetFloatArray());
		m_Terrain->CalcPosition(i+1, j,   pos); glVertex3fv(pos.GetFloatArray());
		m_Terrain->CalcPosition(i+1, j+1, pos); glVertex3fv(pos.GetFloatArray());
		m_Terrain->CalcPosition(i,   j+1, pos); glVertex3fv(pos.GetFloatArray());
	glEnd();

	if (line_width != 1)
		glLineWidth(1.0f);
}
开发者ID:,项目名称:,代码行数:30,代码来源:


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