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


C++ DrawList类代码示例

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


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

示例1: drawMagnifyingGlass

void MinigameBbAnt::drawMagnifyingGlass(DrawList &drawList) {	
	scale2x(_objects[0].x - 28, _objects[0].y - 27);
	drawList.clear();
	drawList.add(_objects[0].anim->frameIndices[0], _objects[0].x, _objects[0].y, _objects[0].priority);
	drawList.add(_objects[0].anim->frameIndices[1], _objects[0].x, _objects[0].y, _objects[0].priority);
	drawList.add(_objects[0].anim->frameIndices[2], _objects[0].x, _objects[0].y, _objects[0].priority);
}
开发者ID:33d,项目名称:scummvm,代码行数:7,代码来源:bbant.cpp

示例2: debug

void BbvsEngine::loadScene(int sceneNum) {
	debug(0, "BbvsEngine::loadScene() sceneNum: %d", sceneNum);

	Common::String sprFilename = Common::String::format("vnm/vspr%04d.vnm", sceneNum);
	Common::String gamFilename = Common::String::format("vnm/game%04d.vnm", sceneNum);

	_screen->clear();

	_spriteModule->load(sprFilename.c_str());
	_gameModule->load(gamFilename.c_str());

	Palette palette = _spriteModule->getPalette();
	_screen->setPalette(palette);

	// Preload sounds
	for (uint i = 0; i < _gameModule->getPreloadSoundsCount(); ++i) {
		Common::String filename = Common::String::format("snd/snd%05d.aif", _gameModule->getPreloadSound(i));
		_sound->loadSound(filename);
	}

	if (sceneNum >= kMainMenu) {
		DrawList drawList;
		drawList.add(_gameModule->getBgSpriteIndex(0), 0, 0, 0);
		_screen->drawDrawList(drawList, _spriteModule);
		drawScreen();
	}

}
开发者ID:AReim1982,项目名称:scummvm,代码行数:28,代码来源:scene.cpp

示例3: buildDrawList1

void MinigameBbAnt::buildDrawList2(DrawList &drawList) {
	buildDrawList1(drawList);
	drawList.add(getAnimation(168)->frameIndices[0], 40, 100, 2000);
	drawNumber(drawList, _counter1, 190, 112);
	drawNumber(drawList, _countdown5, 258, 112);
	drawList.add(getAnimation(169)->frameIndices[0], 120, 120, 2000);
	drawNumber(drawList, _counter4, 192, 132);
}
开发者ID:33d,项目名称:scummvm,代码行数:8,代码来源:bbant.cpp

示例4: DrawListRef

BufferedDrawList::DrawListRef BufferedDrawList::forUpdate() {

	DrawList* dl;
	for(;;) {
		dl = &Dl[Ui];
		if(--Ui == 0) Ui = 2;
		if (dl == Rendering || dl == ToRender)continue;

		break;
	}
	dl->clear();
	return DrawListRef( *dl, *this);
}
开发者ID:jimc1664,项目名称:GP1,代码行数:13,代码来源:DrawList.cpp

示例5: Point

void AsteroidField::Asteroid::Draw(DrawList &draw, const Point &center, const Point &centerVelocity) const
{
	Point pos = location - center;
	pos = Point(remainder(pos.X(), WRAP), remainder(pos.Y(), WRAP));
	
	draw.Add(animation, pos, angle.Unit() * .5, velocity - centerVelocity);
}
开发者ID:AJMansfield,项目名称:endless-sky,代码行数:7,代码来源:AsteroidField.cpp

示例6: Draw

// Draw the asteroids, centered on the given location.
void AsteroidField::Draw(DrawList &draw, const Point &center, double zoom) const
{
	for(const Asteroid &asteroid : asteroids)
		asteroid.Draw(draw, center, zoom);
	for(const shared_ptr<Minable> &minable : minables)
		draw.Add(*minable);
}
开发者ID:Disiuze,项目名称:endless-sky,代码行数:8,代码来源:AsteroidField.cpp

示例7:

void C_3DObject_Group::addDrawList(DrawList &dlist, Port_3D &port)
{
  int i;
  if ((n_objects > 0) && isVisible(port))
    {
      for (i = 0; i<n_objects;i++)
	if (objects[i]->visible)
	  objects[i]->draw_prep(port);
      for (i=0;i<n_objects;i++)
	{
	  if (objects[i]->visible && objects[i]->visible_flag)
	    dlist.add_object(objects[i]);
	}
    }
}
开发者ID:zear,项目名称:sabre,代码行数:15,代码来源:group_3d.C

示例8: TestDrawListRandom

	void TestDrawListRandom(int numEntries) {

		DrawList<MyData> list;
		std::vector<double> configured;
		std::vector<double> drawn;

		const unsigned int cnt = numEntries;
		const unsigned int numDraw = cnt * 4096;
		double probSum = 0;

		list.resize(cnt);
		drawn.resize(cnt);
		configured.resize(cnt);

		// fill
		for (unsigned int i = 0; i < cnt; ++i) {
			double rnd = double(rand()) / double(RAND_MAX);
			configured[i] = rnd;
			list.set(i, MyData(i,i), rnd);
			probSum += rnd;
		}

		// draw
		for (unsigned int i = 0; i < numDraw; ++i) {
			MyData& d = list.draw();
			drawn[d.x]++;
		}

		// compare
		for (unsigned int i = 0; i < cnt; ++i) {
			double a = (configured[i] / probSum);
			double b = (drawn[i] / numDraw);
			ASSERT_NEAR(a, b, a*0.50);			// allow 50% difference between cfg and drawn
		}

	}
开发者ID:Antidote00,项目名称:KLib,代码行数:36,代码来源:TestDrawList.cpp

示例9: drawNumber

int Minigame::drawNumber(DrawList &drawList, int number, int x, int y) {
	int digits = 1, rightX = x;
	
	for (int mag = 10; number / mag != 0; mag *= 10)
		++digits;
		
	rightX = x + digits * 10;
	x = rightX;
	
	while (digits--) {
		const int n = number % 10;
		x -= 10;
		drawList.add(_numbersAnim->frameIndices[n], x, y, 2000);
		number /= 10;
	}

	return rightX;
}
开发者ID:33d,项目名称:scummvm,代码行数:18,代码来源:minigame.cpp

示例10: fmod

// Draw any instances of this asteroid that are on screen.
void AsteroidField::Asteroid::Draw(DrawList &draw, const Point &center, double zoom) const
{
	// Any object within this range must be drawn.
	Point topLeft = center + (Screen::TopLeft() - size) / zoom;
	Point bottomRight = center + (Screen::BottomRight() + size) / zoom;
	
	// Figure out the position of the first instance of this asteroid that is to
	// the right of and below the top left corner of the screen.
	double startX = fmod(position.X() - topLeft.X(), WRAP);
	startX += topLeft.X() + WRAP * (startX < 0.);
	double startY = fmod(position.Y() - topLeft.Y(), WRAP);
	startY += topLeft.Y() + WRAP * (startY < 0.);
	
	// Draw any instances of this asteroid that are on screen.
	for(double y = startY; y < bottomRight.Y(); y += WRAP)
		for(double x = startX; x < bottomRight.X(); x += WRAP)
			draw.Add(*this, Point(x, y));
}
开发者ID:Disiuze,项目名称:endless-sky,代码行数:19,代码来源:AsteroidField.cpp

示例11: TEST

	/** assert that cumulative values are correctly calculated when drawing the first time */
	TEST(DrawList, Cumulative) {

		DrawList<MyData> list;
		list.push_back(MyData(), 0.11);
		list.push_back(MyData(), 0.22);
		list.push_back(MyData(), 0.33);
		list.push_back(MyData(), 0.44);
		list.push_back(MyData(), 0.55);
		list.push_back(MyData(), 0.66);

		for (DrawListEntry<MyData>& dle : list.entries) {
			ASSERT_EQ(0, dle.cumulativeProbability);
		}

		list.draw();

		ASSERT_FLOAT_EQ(0.11f, list.entries[0].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.33f, list.entries[1].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.66f, list.entries[2].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.10f, list.entries[3].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.65f, list.entries[4].cumulativeProbability);
		ASSERT_FLOAT_EQ(2.31f, list.entries[5].cumulativeProbability);

		list.set(0, MyData(), 0.22);

		ASSERT_FLOAT_EQ(0.00f, list.entries[0].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.33f, list.entries[1].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.66f, list.entries[2].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.10f, list.entries[3].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.65f, list.entries[4].cumulativeProbability);
		ASSERT_FLOAT_EQ(2.31f, list.entries[5].cumulativeProbability);

		list.draw();

		ASSERT_FLOAT_EQ(0.22f, list.entries[0].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.44f, list.entries[1].cumulativeProbability);
		ASSERT_FLOAT_EQ(0.77f, list.entries[2].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.21f, list.entries[3].cumulativeProbability);
		ASSERT_FLOAT_EQ(1.76f, list.entries[4].cumulativeProbability);
		ASSERT_FLOAT_EQ(2.42f, list.entries[5].cumulativeProbability);

	}
开发者ID:Antidote00,项目名称:KLib,代码行数:43,代码来源:TestDrawList.cpp

示例12: display

//---------------------------------------------------------------------------
// void display(void)
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);   // clear the backbuffer

	//draw all the Static Stuff -> map data
	for (Drawable* drawable : Static) {
		drawable->draw();
	}
	//draw everything on the drawlist
	for (Drawable* drawable : drawList){ 
		drawable->draw(); 
		//delete the pointers to the drawable on the drawlist
		delete drawable;
	}

	//lastly draw the text -> ensures the text is always draw on top
	for (Drawable* drawable : DrawTextList) {
		drawable->draw();
		//delete the ponter to the drawable
		delete drawable;
	}
    // Visualize the drawing commands
    glFlush();            // Execute all commands waiting to be executed
    glutSwapBuffers();    // Swap the backbuffer and frontbuffer
	//clear the drawing & text list
	drawList.clear();
	DrawTextList.clear();
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:30,代码来源:main.cpp

示例13: path

//draw the path from the map file
void path() {
	for (int i = 0; i < mapSizex; i++) {
		for (int j = 0; j < mapSizey; j++) {
			float x = i*20;
			float y = j*20;

			if (Map[i][j] == '/' ) { 
				//draw the path where enemy's walk
				Color color = { 0.47265625, 0.33203125, 0.28125 };
				PointF begin1 = { x,y };
				PointF begin2 = { (x),(y+20) };
				PointF begin3 = { (x-20),(y+20) };
				PointF begin4 = { (x - 20), (y) };
				Sqaure* sq = new Sqaure(begin1, begin2, begin3, begin4, color);
				Static.push_back(sq);
				//drawList.push_back(sq);
			}
			//path where building is allowed
			if (Map[i][j] == '*' || Map[i][j] == 'T') {
				//draw the building site
				Color color = { 0 , 0.47265625, 0.41796875 };
				PointF begin1 = { x,y };
				PointF begin2 = { (x),(y + 20) };
				PointF begin3 = { (x - 20),(y + 20) };
				PointF begin4 = { (x - 20), (y) };
				Sqaure* sq = new Sqaure(begin1, begin2, begin3, begin4, color);
				Static.push_back(sq);
				//drawList.push_back(sq);
			}
			//end point of the map
			if (Map[i][j] == 'E') {
				//draw the end map
				Color color = { 1.0f, 0.4f, 0.4f };
				PointF begin1 = { x,y };
				PointF begin2 = { (x),(y + 20) };
				PointF begin3 = { (x - 20),(y + 20) };
				PointF begin4 = { (x - 20), (y) };
				Sqaure* sq = new Sqaure(begin1, begin2, begin3, begin4, color);
				Static.push_back(sq);
				//drawList.push_back(sq);
			}
			//if the map data contains nothing special
			else {
				continue;
			}
		}
	}

	
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:51,代码来源:main.cpp

示例14: drawBullet

//draw the actual bullet's as is seen on screen
void drawBullet() {
	//define colors and width of the bullet
	Color color = { 0.9f, 0.9f, 0.9f }; //white bullets
	float lind = 2.0;
	//itterate over the bullet vector
	for (unsigned i = 0; i < bulletvector.size(); i++) {
		PointF BulletPos = bulletvector.at(i)->Move();

		// if bullet is out of screen 
		if (BulletPos[0] > windowWidth || BulletPos[1] > windowHeight || BulletPos[0] < 0 || BulletPos[1] < 0) {
			//delete the bulelt from the vector and the pointer to the bullet
			delete bulletvector.at(i);
			bulletvector.erase(bulletvector.begin() + i);	
			
		}
		else {
			//update the movement of the bullet
			bulletvector.at(i)->Update(BulletPos);
			//draw the bullet		+5 becuase of the width of the bullet
			PointF BulletPos2 = { BulletPos[0], (BulletPos[1] + 5) };
			Line* bulletline = new Line{ BulletPos , BulletPos2 , color, lind };
			//push to the draw list
			drawList.push_back(bulletline);
		}
	}
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:27,代码来源:main.cpp

示例15: raster

//make a grid
void raster() {
	Color color = { 0.40625,0.76171875,0.63671875 };
	int rasterHoogte = windowHeight;
	int rasterBreedte = windowWidth;
	int res =  15;
	float radius = 2.5;
	int seg = 5;
	float varx;
	float vary;

	for (int i = 0; i < (rasterBreedte/res); i++) {
		for (int j = 0; j < ((rasterHoogte)/res); j++) {
			
			varx = 20 * i;
			vary = 20 * j;
			//make a grid if the width still has 200 pixels
			if ((windowWidth - 200) > varx) {
				PointF posPixel = { varx , vary };
				Circle* dots = new Circle(posPixel, color, radius, seg);
				Static.push_back(dots);
			}
			else {
				continue;
			}
		}
	}

	//draw the grid
	path();
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:31,代码来源:main.cpp


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