您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Box函数代码示例

51自学网 2021-06-01 19:55:38
  C++
这篇教程C++ Box函数代码示例写得很实用,希望能帮到您。

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

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

示例1: UpperArm

voidUpperArm(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,


示例2: Box

// ConstructorInstructionsMenu::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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例8: Box

/// grow a shell around your box by a_numpointsBox 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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例16: setInsets

void DropdownBox::setArrowSize(GLfloat newArrowSize)	{	/* Adjust the arrow glyph: */	arrow.setGlyphSize(newArrowSize);		/* Adjust the label position: */	setInsets(0.0f,arrow.getPreferredBoxSize()+spacing);		/* Try adjusting the widget size to accomodate the new setting: */	if(isManaged)		parent->requestResize(this,calcNaturalSize());	else		resize(Box(Vector(0.0f,0.0f,0.0f),calcNaturalSize()));	}
开发者ID:VisualIdeation,项目名称:Vrui-2.2-003,代码行数:14,


示例17: _base

// ------------------------------------Platform::Platform() :// ------------------------------------    _base(Vector2(0, 0)),    _dim(Vector2(0.5, 2)){    Box b = Box( Vector2(0, 0), Vector2(0.5, 2));    GeomAttr* g = new GeomAttr(b);    AddAttribute(g);    AddAttribute(new SpatialAttr(0, 0));    AddAttribute(new TexAttr("Textures/default.png"));    AddComponent(ECOMP_RENDER);    AddComponent(ECOMP_COLLISION);}
开发者ID:cliclcly,项目名称:oxalo,代码行数:15,


示例18: Vector3

void Magic3D::Object::init(std::string name){    this->name = name;    this->script = name;    this->layer = NULL;    this->octree = NULL;    flag             = 0;    billboard        = eBILLBOARD_NONE;    parent           = NULL;    parentBone       = NULL;    parentPosition   = true;    parentRotation   = true;    parentScale      = true;    collisionMesh    = -1;    enabled          = true;    visible          = true;    shadowed         = false;    reflective       = false;    glowed           = false;    selected         = false;    grid             = false;    frustum          = false;    frustumEffect    = false;    pick             = false;    zOrder           = false;    zOrderFactor     = 0.0f;    position         = Vector3(0.0f, 0.0f, 0.0f);    scale            = Vector3(1.0f, 1.0f, 1.0f);    euler            = Vector3(0.0f, 0.0f, 0.0f);    upward           = Vector3::yAxis();    forward          = Vector3::zAxis();    rightward        = Vector3::xAxis();    box              = Box(Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f));    rotation         = Quaternion::identity();    matrix           = Matrix4::identity();    uniqueUpdate     = false;    scripted         = false;    networkSpawn     = false;    AI               = NULL;}
开发者ID:whztt07,项目名称:Magic3D-2,代码行数:50,


示例19: m3272970053

extern "C"  t968488902* m3272970053 (t3525329790 * __this, const MethodInfo* method){	static bool s_Il2CppMethodIntialized;	if (!s_Il2CppMethodIntialized)	{		il2cpp_codegen_initialize_method (m3272970053_MetadataUsageId);		s_Il2CppMethodIntialized = true;	}	{		t11523773* L_0 = ((t11523773*)SZArrayNew(t11523773_TI_var, (uint32_t)4));		float L_1 = (__this->f1);		float L_2 = L_1;		t837106420 * L_3 = Box(t958209021_TI_var, &L_2);		ArrayElementTypeCheck (L_0, L_3);		*((t837106420 **)(t837106420 **)SZArrayLdElema(L_0, 0, sizeof(t837106420 *))) = (t837106420 *)L_3;		t11523773* L_4 = L_0;		float L_5 = (__this->f2);		float L_6 = L_5;		t837106420 * L_7 = Box(t958209021_TI_var, &L_6);		ArrayElementTypeCheck (L_4, L_7);		*((t837106420 **)(t837106420 **)SZArrayLdElema(L_4, 1, sizeof(t837106420 *))) = (t837106420 *)L_7;		t11523773* L_8 = L_4;		float L_9 = (__this->f3);		float L_10 = L_9;		t837106420 * L_11 = Box(t958209021_TI_var, &L_10);		ArrayElementTypeCheck (L_8, L_11);		*((t837106420 **)(t837106420 **)SZArrayLdElema(L_8, 2, sizeof(t837106420 *))) = (t837106420 *)L_11;		t11523773* L_12 = L_8;		float L_13 = (__this->f4);		float L_14 = L_13;		t837106420 * L_15 = Box(t958209021_TI_var, &L_14);		ArrayElementTypeCheck (L_12, L_15);		*((t837106420 **)(t837106420 **)SZArrayLdElema(L_12, 3, sizeof(t837106420 *))) = (t837106420 *)L_15;		t968488902* L_16 = m427603113(NULL, _stringLiteral843281963, L_12, NULL);		return L_16;	}}
开发者ID:nsbingham,项目名称:unity-roll-a-ball,代码行数:37,


示例20: Box

// Testing methodsvoid Test::_CreateBoxTest(){	/*box_objects = (Box*) malloc(sizeof(Box) * 10);	box_objects[0] = Box();	box_objects[1] = Box(100, 200, 0, 600);	box_objects[2] = Box(100, 100, 100, 700, CYAN, RED);	box_objects[3] = Box(box_objects[2]);	box_objects[3].SetXPosition(200);	box_objects[4] = Box(box_objects[2]);	box_objects[4].SetYPosition(600);	box_objects[5] = Box(20, 20, 700, 0, LIGHTBLUE, WHITE);	box_objects[5].SetXSize(100);	box_objects[6] = Box(box_objects[5]);	box_objects[6].SetYSize(100);	box_objects[7] = Box(150, 150, 400, 400, PINK, YELLOW);	box_objects[7].Translate(250, 250);	box_objects[8] = Box(150, 150, 300, 300);	box_objects[8].SetInnerColour(ORANGE);	box_objects[8].SetOuterColour(GOLD);	box_objects[9] = Box();*/	box_objects = (Box*)malloc(sizeof(Box)* 64);	box_objects[0] = Box(100, 100, 0, 0, DARKBLUE, LIGHTBLUE);	for (int i = 1; i < 64; i++)	{		box_objects[i] = Box(box_objects[0]);		box_objects[i].Translate(100 * (i % 8), 100 * (i / 8));		if (i % 2 == 1 && (i/8) % 2 == 0)			box_objects[i].SetColour(RED, PINK);		else if (i % 2 == 0 && (i/8) % 2 == 1)			box_objects[i].SetColour(DARKGREEN, LIGHTGREEN);		else if (i % 2 == 1 && (i / 8) % 2 == 1)			box_objects[i].SetColour(GOLD, YELLOW);	}	_box_test = true;}
开发者ID:chrislee0419,项目名称:cmpt365-snake,代码行数:38,


示例21: resize

void PopupWindow::removeChild(Widget* removeChild)	{	/* Check if the given widget is really the child: */	if(child!=0&&child==removeChild)		{		/* Tell the child that it is being removed: */		child->unmanageChild();				/* Remove the child: */		child=0;		}		/* Resize the widget: */	resize(Box(Vector(0.0f,0.0f,0.0f),calcNaturalSize()));	}
开发者ID:PengfeiXuAI,项目名称:Sandbox,代码行数:15,


示例22: get_Bbox

	Box 		Segment2D::		get_Bbox(void) const 		throw()	{		double min_x = min(source_.x(), sink_.x());		double max_x = max(source_.x(), sink_.x());		double min_y = min(source_.y(), sink_.y());		double max_y = max(source_.y(), sink_.y());				Vec lower = Vec(min_x, min_y, 0.0);		Vec upper = Vec(max_x, max_y, 0.0);				return Box(lower, upper);	}	
开发者ID:MarcStelzner,项目名称:shawn,代码行数:15,


示例23: WIN_Play_Samples

intWIN_Play_Samples ( const void* data, size_t len ){	HGLOBAL    hg;	HGLOBAL    hg2;	LPWAVEHDR  wh;	void*      allocptr;	do {		while ( PlayedWaveHeadersCount > 0 )                // free used blocks ...			free_memory ();		if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ...			break;		Sleep (26);	} while (1);	if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL )   // allocate some memory for a copy of the buffer		return Box ( "GlobalAlloc failed." );	allocptr = GlobalLock (hg2);	CopyMemory ( allocptr, data, len );                         // Here we can call any modification output functions we want....	if ( (hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL ) // now make a header and WRITE IT!		return -1;	wh                   = (LPWAVEHDR)GlobalLock (hg);	wh -> dwBufferLength = len;	wh -> lpData         = (LPSTR)allocptr;	if ( waveOutPrepareHeader ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {		GlobalUnlock (hg);		GlobalFree   (hg);		return -1;	}	if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {		GlobalUnlock (hg);		GlobalFree   (hg);		return -1;	}	EnterCriticalSection ( &cs );	ScheduledBlocks++;	LeaveCriticalSection ( &cs );	return len;}
开发者ID:CecilHarvey,项目名称:BlueDJGames,代码行数:48,


示例24: if

/// intersection of two boxesBox Box::operator*(const Box& a_rightBox) const{  int rhs_lowCorner[DIM];  int rhs_highCorner[DIM];  int intersect_lowCorner[DIM];  int intersect_highCorner[DIM];  a_rightBox.getLowCorner(rhs_lowCorner);  a_rightBox.getHighCorner(rhs_highCorner);  for(int i=0; i<DIM; i++)    {      /// comparison of low corner of box B with the corners to see if its in between      if(rhs_lowCorner[i]>m_lowCorner[i] && rhs_lowCorner[i]<m_highCorner[i])	{	  intersect_lowCorner[i] = rhs_lowCorner[i];	}      /// comparison of low corner of box A with the corners to see if its in between      else if(m_lowCorner[i]>rhs_lowCorner[i] && m_lowCorner[i]<rhs_highCorner[i])	{	  intersect_lowCorner[i] = m_lowCorner[i];	}      /// If no intersection, then okay      else	{	  /// stop the program if no intersection	  assert(0);	  intersect_lowCorner[i]=0;	}      /// comparison of the high corner of box B with the corners to see if it is in between      if(rhs_highCorner[i]>m_lowCorner[i] && rhs_highCorner[i]<m_highCorner[i])	{	  intersect_highCorner[i] = rhs_highCorner[i];	}      /// comparison of the high corner of box A with the corners to see if it is in between      else if(m_highCorner[i]>rhs_lowCorner[i] && m_highCorner[i]<rhs_highCorner[i])	{	  intersect_highCorner[i]=m_highCorner[i];	}      else	{	  /// stop the program if no intersection	  assert(0);	  intersect_highCorner[i]=0;	}    }      return Box(intersect_lowCorner, intersect_highCorner);}
开发者ID:iamawong,项目名称:cs294_73,代码行数:49,


示例25: getConnectedBubbles

void GameWidget::checkGameOver(){    for(int x = 0; x < grid_size; x++) {        for(int y = 0; y < grid_size; y++) {            QList<Box> connected;            getConnectedBubbles(Box(x,y), connected);            if(connected.size() > 1)                return; //found cluster, continue game        }    }    //assertion: no connected bubbles left in grid    emit newScore(score);    restart();}
开发者ID:cpulvermacher,项目名称:EvilAlarm,代码行数:16,


示例26: LD

Vec3f MeshCutting::getCenterBox(arrayInt voxelIdxs){	std::vector<voxelBox> * boxes = &s_voxelObj->m_boxes;	// Get current bounding box	Vec3f LD(MAX, MAX, MAX);	Vec3f RU(MIN, MIN, MIN);	Box b(LD, RU);	for (int i = 0; i < voxelIdxs.size(); i++)	{		voxelBox curB = boxes->at(voxelIdxs[i]);		b = combineBox(b, Box(curB.leftDown, curB.rightUp));	}	return (b.leftDown + b.rightUp)/2.0;}
开发者ID:pigoblock,项目名称:TFYP,代码行数:16,


示例27: Label

void Popup::setTitle(const char* titleString)	{	/* Delete the current title: */	delete title;	title=0;		if(titleString!=0)		{		/* Create a new title widget: */		title=new Label("_Title",this,titleString,false);		title->setHAlignment(GLFont::Center);		}		/* Resize the widget: */	resize(Box(Vector(0.0f,0.0f,0.0f),calcNaturalSize()));	}
开发者ID:VisualIdeation,项目名称:Vrui,代码行数:16,


示例28: Box

Mark::Mark(){	this->col = false;	x = 100;	y = 24;	_xcoin = 100;	_ycoin = 64;	_vycoin = 0;	vy = 0;	starty = y;	hit = 0;	this->box = Box(x -width/2, y - height/2, 16, 16);		}
开发者ID:huulocuit1,项目名称:GAME,代码行数:16,


示例29: Graphic

void PaletteCycleEditor    ::drawColorPreviewGraphic(Graphic& dst) {  dst = Graphic(colorPreviewWidth_, colorPreviewHeight_);    int currentNum = colorPicker_.pickedIndex();  GGColor color = currentCycleState().color(currentNum);  Color realColor = Color(color.realR(),                          color.realG(),                          color.realB(),                          Color::fullAlphaOpacity);  colorPreview_.setColor(realColor);    colorPreview_.render(dst,                       Box(0, 0, colorPreviewWidth_, colorPreviewHeight_),                       1.00);}
开发者ID:GerbilSoft,项目名称:tales,代码行数:16,



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


C++ Box2d函数代码示例
C++ BoundingBox函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。