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


C++ Box函数代码示例

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


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

示例1: UpperArm

void
UpperArm(char solid)
{
  int i;

  glNewList(SOLID_MECH_UPPER_ARM, GL_COMPILE);
#ifdef LIGHT
  SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess);
#endif
  glColor3f(1.0, 1.0, 0.0);
  Box(1.0, 2.0, 1.0, solid);
  glTranslatef(0.0, -0.95, 0.0);
  glRotatef(90.0, 1.0, 0.0, 0.0);
#ifdef LIGHT
  SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
  glColor3f(0.5, 0.5, 0.5);
  if (!solid)
    gluQuadricDrawStyle(qobj, GLU_LINE);
  gluCylinder(qobj, 0.4, 0.4, 1.5, 16, 10);
#ifdef LIGHT
  SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess);
#endif
  glColor3f(1.0, 1.0, 0.0);
  glRotatef(-90.0, 1.0, 0.0, 0.0);
  glTranslatef(-0.4, -1.85, 0.0);
  glRotatef(90.0, 0.0, 1.0, 0.0);
  for (i = 0; i < 2; i++) {
    if (!solid)
      gluQuadricDrawStyle(qobj, GLU_LINE);
    if (i)
      gluCylinder(qobj, 0.5, 0.5, 0.8, 16, 10);
    else
      gluCylinder(qobj, 0.2, 0.2, 0.8, 16, 10);
  }
  for (i = 0; i < 2; i++) {
    if (i)
      glScalef(-1.0, 1.0, 1.0);
    if (!solid)
      gluQuadricDrawStyle(qobj, GLU_LINE);
    if (i)
      glTranslatef(0.0, 0.0, 0.8);
    gluDisk(qobj, 0.2, 0.5, 16, 10);
    if (i)
      glTranslatef(0.0, 0.0, -0.8);
  }
  glScalef(-1.0, 1.0, 1.0);
  glRotatef(-90.0, 0.0, 1.0, 0.0);
  glTranslatef(0.4, 2.9, 0.0);
  glEndList();
}
开发者ID:arnelh,项目名称:Examples,代码行数:51,代码来源:glutmech.c

示例2: Box

// Constructor
InstructionsMenu::InstructionsMenu()
{
	// number of objects
	_textcount = 14;
	_boxcount = 4;

	_background = new Box(700, 600, 0, 0, 10, DARKGREY, LIGHTGREY);

	_boxes = (Box*)malloc(sizeof(Box)*_boxcount);
	_boxes[0] = Box(40, 40, 40, 145, 5, DARKGREY, LIGHTGREY);
	_boxes[1] = Box(40, 40, 40, 195, 5, GOLD, YELLOW);
	_boxes[2] = Box(40, 40, 40, 245, 5, RED, PINK);
	_boxes[3] = Box(40, 40, 40, 295, 5, DARKGREEN, LIGHTGREEN);

	_text = (Text*)malloc(sizeof(Text)*_textcount);
	_text[0] = Text(UBUNTU, 1.6f, "Fruit pellet - eat this to grow and gain points.", 100, 305, BLACK);
	_text[1] = Text(UBUNTU, 1.6f, "Snake head - this is what you control.", 100, 255, BLACK);
	_text[2] = Text(UBUNTU, 1.6f, "Snake body - don't eat yourself!", 100, 205, BLACK);
	_text[3] = Text(UBUNTU, 1.6f, "Wall - don't bump into walls! (appears after a score of 5)", 100, 155, BLACK);
	_text[4] = Text(ROBOTO, 2.2f, "---  HELP  ---", 250, 550, BLACK);
	_text[5] = Text(ROBOTO, 1.8f, "- CONTROLS -", 35, 525, BLACK);
	_text[6] = Text(UBUNTU, 1.4f, "\"p\"\t          -   pauses and unpauses the game", 40, 500, BLACK);
	_text[7] = Text(UBUNTU, 1.4f, "\"i\"\t          -   displays the instructions/help menu", 40, 475, BLACK);
	_text[8] = Text(UBUNTU, 1.4f, "\"r\"\t          -   resets the game", 40, 450, BLACK);
	_text[9] = Text(UBUNTU, 1.4f, "\"q\"\t          -   exits the game", 40, 425, BLACK);
	_text[10] = Text(UBUNTU, 1.4f, "\"(arrow key)\"  -   moves the player character (snake)", 40, 400, BLACK);
	_text[11] = Text(ROBOTO, 1.8f, "- BLOCK TYPES -", 35, 350, BLACK);
	_text[12] = Text(ROBOTO, 2.2f, "PRESS \"I\" TO EXIT THIS MENU", 0, 40, RED);
	_text[13] = Text(UBUNTU, 1.2f, "(\"Snake\" is created by Chris Lee and Matthew Tseng for our CMPT 365 Term Project)", 35, 100, RED);

	// center header text
	int width = (int)_text[4].GetWidth();
	_text[4].SetXPosition((700 - width)/2);

	// center exit text
	width = (int)_text[12].GetWidth();
	_text[12].SetXPosition((700 - width)/2);
}
开发者ID:chrislee0419,项目名称:cmpt365-snake,代码行数:39,代码来源:InstructionsMenu.cpp

示例3: createBox

Box createBox(Set *vertices, Set *edges,
              unsigned numX, unsigned numY, unsigned numZ) {
  uassert(numX >= 1 && numY >= 1 && numZ >= 1);
  vector<ElementRef> points(numX*numY*numZ);

  for(unsigned x = 0; x < numX; ++x) {
    for(unsigned y = 0; y < numY; ++y) {
      for(unsigned z = 0; z < numZ; ++z) {
        points[node0(x,y,z)] = vertices->add();
      }
    }
  }

  map<Box::Coord, ElementRef> coords2edges;

  // x edges
  for(unsigned x = 0; x < numX-1; ++x) {
    for(unsigned y = 0; y < numY; ++y) {
      for(unsigned z = 0; z < numZ; ++z) {
        Box::Coord coord(points[node0(x,y,z)], points[node1X(x,y,z)]);
        simit::ElementRef edge = edges->add(coord.first, coord.second);
        coords2edges[coord] = edge;
      }
    }
  }

  // y edges
  for(unsigned x = 0; x < numX; ++x) {
    for(unsigned y = 0; y < numY - 1; ++y) {
      for(unsigned z = 0; z < numZ; ++z) {
        Box::Coord coord(points[node0(x,y,z)], points[node1Y(x,y,z)]);
        simit::ElementRef edge = edges->add(coord.first, coord.second);
        coords2edges[coord] = edge;
      }
    }
  }

  // z edges
  for(unsigned x = 0; x < numX; ++x) {
    for(unsigned y = 0; y < numY; ++y) {
      for(unsigned z = 0; z < numZ-1; ++z) {
        Box::Coord coord(points[node0(x,y,z)], points[node1Z(x,y,z)]);
        simit::ElementRef edge = edges->add(coord.first, coord.second);
        coords2edges[coord] = edge;
      }
    }
  }

  return Box(numX, numY, numZ, points, coords2edges);
}
开发者ID:stephenchouca,项目名称:simit,代码行数:50,代码来源:graph.cpp

示例4: deleteChild

void PopupWindow::addChild(Widget* newChild)
	{
	if(newChild!=titleBar&&newChild!=hideButton&&newChild!=closeButton)
		{
		/* Delete the current child: */
		deleteChild(child);
		
		/* Add the new child: */
		child=newChild;
		
		/* Resize the widget: */
		resize(Box(Vector(0.0f,0.0f,0.0f),calcNaturalSize()));
		}
	}
开发者ID:PengfeiXuAI,项目名称:Sandbox,代码行数:14,代码来源:PopupWindow.cpp

示例5: Box

Node::Node(int nodeId, int x, int y, int w, int h)
{
	_NodeId = nodeId;
	_X = x;
	_Y = y;
	_Width = w;
	_Height = h;
	_BoundaryBox =  Box(_X - _Width / 2, _Y + _Height / 2, _Width, _Height);

	_Tl = NULL;
	_Tr = NULL;
	_Bl = NULL;
	_Br = NULL;
}
开发者ID:nguyenhaidang94,项目名称:GameMario,代码行数:14,代码来源:Node.cpp

示例6: setPreferredSize

void ColorMapEditor::
setPreferredSize(const Vector& newPreferredSize)
{
    //set the new preferred size
    preferredSize = newPreferredSize;

    if(isManaged)
    {
        //try adjusting the widget size to accomodate the new preferred size
        parent->requestResize(this, calcNaturalSize());
    }
    else
        resize(Box(Vector(0.0f,0.0f,0.0f), calcNaturalSize()));
}
开发者ID:KeckCAVES,项目名称:crusta,代码行数:14,代码来源:ColorMapEditor.cpp

示例7: setMarginWidth

void ColorMapEditor::
setMarginWidth(GLfloat newMarginWidth)
{
    //set the new margin width
    marginWidth = newMarginWidth;

    if (isManaged)
    {
        //try adjusting the widget size to accomodate the new margin width
        parent->requestResize(this, calcNaturalSize());
    }
    else
        resize(Box(Vector(0.0f,0.0f,0.0f), calcNaturalSize()));
}
开发者ID:KeckCAVES,项目名称:crusta,代码行数:14,代码来源:ColorMapEditor.cpp

示例8: Box

/// grow a shell around your box by a_numpoints
Box Box::grow(int a_numpoints)
{
  int newlowCorner[DIM];
  int newhighCorner[DIM];

  /// loop through the points, and do the operation on them
  for(int i=0; i<DIM; i++)
    {
      newlowCorner[i] = m_lowCorner[i]-a_numpoints;
      newhighCorner[i] = m_highCorner[i]+a_numpoints;
    }

  return Box(newlowCorner, newhighCorner);
}
开发者ID:iamawong,项目名称:cs294_73,代码行数:15,代码来源:Box.cpp

示例9: SetColor

void Search::ShowBorder() const
{
	SetColor(COL_DIALOGTEXT);
	GotoXY(m_X1+1,m_Y1+1);
	Text(L' ');
	GotoXY(m_X1+20,m_Y1+1);
	Text(L' ');
	Box(m_X1,m_Y1,m_X1+21,m_Y1+2,colors::PaletteColorToFarColor(COL_DIALOGBOX),DOUBLE_BOX);
	GotoXY(m_X1+7,m_Y1);
	SetColor(COL_DIALOGBOXTITLE);
	Text(L' ');
	Text(lng::MSearchFileTitle);
	Text(L' ');
}
开发者ID:johnd0e,项目名称:farmanager,代码行数:14,代码来源:panel.cpp

示例10: file

TempOctree::TempOctree(char* fileNameTemplate,unsigned int sMaxNumPointsPerNode,LidarPoint* points,size_t numPoints)
	:tempFileName(new char[strlen(fileNameTemplate)+1]),
	 file(createTempFile(fileNameTemplate),File::ReadWrite),
	 maxNumPointsPerNode(sMaxNumPointsPerNode),
	 pointBbox(Box::empty),
	 writerThreadRun(true),writerThread(this,&TempOctree::writerThreadMethod)
	{
	/* Save the temporary file name: */
	strcpy(tempFileName,fileNameTemplate);
	
	/* Immediately unlink the temporary file; it will stay alive until the file handle is closed: */
	unlink(tempFileName);
	
	/* Calculate the point set's bounding box: */
	for(unsigned int i=0;i<numPoints;++i)
		pointBbox.addPoint(points[i]);
	
	/* Extend the bounding box by a small delta to include all points in a half-open box: */
	Point newMax=pointBbox.max;
	for(int i=0;i<3;++i)
		{
		Scalar delta=Scalar(1);
		if(newMax[i]+delta!=newMax[i])
			{
			while(newMax[i]+(delta*Scalar(0.5))!=newMax[i])
				delta*=Scalar(0.5);
			}
		else
			{
			while(newMax[i]+delta==newMax[i])
				delta*=Scalar(2);
			}
		newMax[i]+=delta;
		}
	pointBbox=Box(pointBbox.min,newMax);
	
	/* Set the root's domain to contain all points: */
	root.domain=Cube(pointBbox);
	
	/* Create the root node's subtree: */
	root.numPoints=numPoints;
	root.points=points;
	createSubTree(root);
	
	/* Wait until the octree file is finished: */
	writerThreadRun=false;
	writeQueueCond.signal();
	writerThread.join();
	file.flush();
	}
开发者ID:KeckCAVES,项目名称:LidarViewer,代码行数:50,代码来源:TempOctree.cpp

示例11: DefaultComparer_Equals_m27418_gshared

// System.Boolean System.Collections.Generic.EqualityComparer`1/DefaultComparer<System.TimeSpan>::Equals(T,T)
extern "C" bool DefaultComparer_Equals_m27418_gshared (DefaultComparer_t3286 * __this, TimeSpan_t1036  ___x, TimeSpan_t1036  ___y, const MethodInfo* method)
{
	{
		TimeSpan_t1036  L_0 = ___x;
		goto IL_0015;
	}
	{
		TimeSpan_t1036  L_1 = ___y;
		TimeSpan_t1036  L_2 = L_1;
		Object_t * L_3 = Box(IL2CPP_RGCTX_DATA(InitializedTypeInfo(method->declaring_type)->rgctx_data, 2), &L_2);
		return ((((Object_t*)(Object_t *)L_3) == ((Object_t*)(Object_t *)NULL))? 1 : 0);
	}

IL_0015:
	{
		TimeSpan_t1036  L_4 = ___y;
		TimeSpan_t1036  L_5 = L_4;
		Object_t * L_6 = Box(IL2CPP_RGCTX_DATA(InitializedTypeInfo(method->declaring_type)->rgctx_data, 2), &L_5);
		NullCheck((TimeSpan_t1036 *)(&___x));
		bool L_7 = TimeSpan_Equals_m14108((TimeSpan_t1036 *)(&___x), (Object_t *)L_6, NULL);
		return L_7;
	}
}
开发者ID:AndreaMelle,项目名称:UnityNativeIntegrationScoping,代码行数:24,代码来源:Bulk_Generics_9.cpp

示例12: height

// ------------------------------------
TerrainChunk::TerrainChunk(float height, float x) : 
// ------------------------------------
	height(height),
	x(x)
{
	Box b = Box(Vector2(0, -100), Vector2(10, 100 + height));
	GeomAttr* g = new GeomAttr(b);
	AddAttribute(g);
	AddAttribute(new SpatialAttr(x, 0));
	AddAttribute(new TexAttr("Textures/default.png"));
	
	AddComponent(ECOMP_RENDER);
	AddComponent(ECOMP_COLLISION);
}
开发者ID:cliclcly,项目名称:oxalo,代码行数:15,代码来源:eTerrainChunk.cpp

示例13: Box

IMGUI& IMGUI::rect(int x, int y, int w, int h, HexColor color){

	this->m_box = Box(x,y,w,h);
	this->m_hover = hasHover(this->m_box);
	this->m_lClicked = this->m_hover && this->ks.lClick;
	this->m_rClicked = this->m_hover && this->ks.rClick;

	m_UIContainer->push(Label, color, this->m_box, currentLayer);

	this->m_buttonFlags |= NoInsertion;
	this->m_forceNoDraw = true;

	return *this;
}
开发者ID:DezerteR,项目名称:Po-Male-Ka,代码行数:14,代码来源:IMGUI.cpp

示例14: Box

Van::Van (int n){	//--------------------------------------------------------
	int a, b, c;
	Count = 0; 
	Load1 = new Box[Max=n]; 
	Load2 = new Box[2]; 

	cout <<"\nEnter the boxes; use a 0 dimension to quit\n";
	for (Count=0; Count<Max; ++Count) {
		cout <<"  Dimensions: ";   
    	cin >> a >> b >> c;
		if (a*b*c == 0) break;
    	Load1[Count] = Box(a, b, c); // Make a local box, copy it using assignment.
	}								 // Delete the local box at end of loop body.      
}	
开发者ID:ahmetshen-us,项目名称:systems_programming_notes,代码行数:14,代码来源:van.cpp

示例15: DefaultComparer_Equals_m27365_gshared

// System.Boolean System.Collections.Generic.EqualityComparer`1/DefaultComparer<System.Guid>::Equals(T,T)
extern "C" bool DefaultComparer_Equals_m27365_gshared (DefaultComparer_t3281 * __this, Guid_t2182  ___x, Guid_t2182  ___y, const MethodInfo* method)
{
	{
		Guid_t2182  L_0 = ___x;
		goto IL_0015;
	}
	{
		Guid_t2182  L_1 = ___y;
		Guid_t2182  L_2 = L_1;
		Object_t * L_3 = Box(IL2CPP_RGCTX_DATA(InitializedTypeInfo(method->declaring_type)->rgctx_data, 2), &L_2);
		return ((((Object_t*)(Object_t *)L_3) == ((Object_t*)(Object_t *)NULL))? 1 : 0);
	}

IL_0015:
	{
		Guid_t2182  L_4 = ___y;
		Guid_t2182  L_5 = L_4;
		Object_t * L_6 = Box(IL2CPP_RGCTX_DATA(InitializedTypeInfo(method->declaring_type)->rgctx_data, 2), &L_5);
		NullCheck((Guid_t2182 *)(&___x));
		bool L_7 = Guid_Equals_m13813((Guid_t2182 *)(&___x), (Object_t *)L_6, NULL);
		return L_7;
	}
}
开发者ID:AndreaMelle,项目名称:UnityNativeIntegrationScoping,代码行数:24,代码来源:Bulk_Generics_9.cpp


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