Пример #1
0
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();
}
// 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);
}
Пример #3
0
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);
}
Пример #4
0
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()));
		}
	}
Пример #5
0
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;
}
Пример #6
0
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()));
}
Пример #7
0
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()));
}
Пример #8
0
KnnWayIterator::KnnWayIterator(const OsmMap& map, ConstWayPtr way,
  const RStarTree* tree, const vector<long>& treeIdToWid, bool addError) :
  KnnIterator(tree, 0.0, 0.0, Box()),
  _map(map),
  _treeIdToWid(treeIdToWid)
{
  _wayId = way->getId();
  _ls = ElementConverter(map.shared_from_this()).convertToLineString(way);
  _lsFast = _ls.get();
  _indexSlush = _map.getIndex().getIndexSlush();
  _distanceCount = 0;
  _addError = addError;
  _baseAccuracy = way->getCircularError();
}
Пример #9
0
/// 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);
}
Пример #10
0
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' ');
}
Пример #11
0
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();
	}
// 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;
	}
}
Пример #13
0
// ------------------------------------
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);
}
Пример #14
0
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;
}
Пример #15
0
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.      
}	
// 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;
	}
}
Пример #17
0
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()));
	}
Пример #18
0
// ------------------------------------
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);
}
Пример #19
0
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;
}
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;
	}
}
Пример #21
0
// Testing methods
void 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;
}
Пример #22
0
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()));
	}
Пример #23
0
	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);
	}	
Пример #24
0
int
WIN_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;
}
Пример #25
0
/// intersection of two boxes
Box 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);
}
Пример #26
0
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();
}
Пример #27
0
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;
}
Пример #28
0
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()));
	}
Пример #29
0
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);

	
	
}
Пример #30
0
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);
}