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


C++ vector2d::x方法代码示例

本文整理汇总了C++中vector2d::x方法的典型用法代码示例。如果您正苦于以下问题:C++ vector2d::x方法的具体用法?C++ vector2d::x怎么用?C++ vector2d::x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vector2d的用法示例。


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

示例1:

	mesodrop::mesodrop(short o, animation* ani, int own, vector2d pos, vector2d dst, char type, bool pld)
	{
		oid = o;
		anim = ani;
		owner = own;
		pickuptype = type;
		playerdrop = pld;

		fx = static_cast<float>(pos.x());
		fy = static_cast<float>(pos.y());

		updatefht();

		dalpha = 1.0f;
		alpha = 1.0f;
		moved = 0.0f;

		if (pos == dst)
		{
			state = DST_FLOATING;
			vspeed = 0;
			hspeed = 0;
			basey = fy;
		}
		else
		{
			state = DST_DROPPED;
			vspeed = -6.0f;
			hspeed = static_cast<float>(dst.x() - pos.x()) / 16;
		}
	}
开发者ID:LankMasterFlex,项目名称:journey_client,代码行数:31,代码来源:mesodrop.cpp

示例2: nextground

	float footholdtree::nextground(bool left, vector2d pos)
	{
		//return getgroundbelow(pos);

		short nextid = -1;
		if (left && pos.x() < ground.horizontal.x())
		{
			nextid = ground.prev;
		}
		else if (!left && pos.x() > ground.horizontal.y())
		{
			nextid = ground.next;
		}

		if (nextid > 0)
		{
			ground = footholds[nextid];

			if (ground.isfloor())
			{
				return static_cast<float>(ground.vertical.x());
			}
			else
			{
				float step = static_cast<float>((ground.vertical.y() - ground.vertical.x())) / (ground.horizontal.y() - ground.horizontal.x());
				return static_cast<float>(ground.vertical.x() + (step * (pos.x() - ground.horizontal.x())));
			}
		}
		else
		{
			return getgroundbelow(pos);
		}
	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:33,代码来源:footholdtree.cpp

示例3: getgroundbelow

	float footholdtree::getgroundbelow(vector2d pos)
	{
		foothold ret;
		float ycomp = 65536;
		pos = pos - vector2d(0, 5);
		for (map<short, foothold>::iterator ftit = footholds.begin(); ftit != footholds.end(); ftit++)
		{
			if (ftit->second.horizontal.contains(pos.x()))
			{
				float y;
				if (ftit->second.isfloor())
				{
					y = static_cast<float>(ftit->second.vertical.x());
				}
				else
				{
					float step = static_cast<float>((ftit->second.vertical.y() - ftit->second.vertical.x())) / (ftit->second.horizontal.y() - ftit->second.horizontal.x());
					y = static_cast<float>(ftit->second.vertical.x() + (step * (pos.x() - ftit->second.horizontal.x())));
				}

				if (ycomp > y && y > pos.y())
				{
					ret = ftit->second;
					ycomp = y;
				}
			}
		}

		ground = ret;
		return ycomp;
		

		/*int closest = lowestg;
		pos = pos - vector2d(0, 5);

		for (vector<map<short, short>>::iterator pfit = platforms.begin(); pfit != platforms.end(); ++pfit)
		{
			if (pfit->count(pos.x()))
			{
				int py = pfit->at(pos.x());

				if (py <= closest && py >= pos.y())
				{
					closest = py;
				}
			}
		}

		return static_cast<float>(closest);*/
	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:50,代码来源:footholdtree.cpp

示例4:

buw::vector2d OpenInfraPlatform::Infrastructure::VerticalAlignmentElement2DArc::Rotate(const double angle, const vector2d& v) const
{
	return buw::vector2d(
		std::cos(angle) * v.x() - std::sin(angle) * v.y(),
		std::sin(angle) * v.x() + std::cos(angle) * v.y()
	);
}
开发者ID:bigdoods,项目名称:OpenInfraPlatform,代码行数:7,代码来源:VerticalAlignmentElement2DArc.cpp

示例5: draw

		void draw(size_t id, rectangle2d<int16_t> rect, float xscale, 
			float yscale, vector2d<int16_t> center, float alpha) {

			if (!available(id))
				return;

			GLfloat left = center.x() + xscale * (rect.l() - center.x());
			GLfloat right = center.x() + xscale * (rect.r() - center.x());
			GLfloat top = center.y() + yscale * (rect.t() - center.y());
			GLfloat bottom = center.y() + yscale * (rect.b() - center.y());

			glBindTexture(GL_TEXTURE_2D, bitmaps[id]);
			glBegin(GL_QUADS);
			glTexCoord2f(0, 0); glVertex3f(left, top, 0);
			glTexCoord2f(0, 1); glVertex3f(left, bottom, 0);
			glTexCoord2f(1, 1); glVertex3f(right, bottom, 0);
			glTexCoord2f(1, 0); glVertex3f(right, top, 0);
			glEnd();
		}
开发者ID:sonbk21,项目名称:JourneyClient,代码行数:19,代码来源:GraphicsGL.cpp

示例6: draw

	void imagecache::draw(imgcontext ict, size_t id, D2D1_RECT_F r, float alpha, float xscale, float yscale, vector2d center)
	{
		target->SetTransform(
			D2D1::Matrix3x2F::Scale(
			D2D1::Size(xscale, yscale),
			D2D1::Point2F(
			static_cast<float>(center.x()),
			static_cast<float>(center.y())
			)));

		draw(ict, id, r, alpha);

		target->SetTransform(
			D2D1::Matrix3x2F::Scale(
			D2D1::Size(1.0f, 1.0f),
			D2D1::Point2F(
			static_cast<float>(center.x()),
			static_cast<float>(center.y())
			)));
	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:20,代码来源:imagecache.cpp

示例7:

bool vector2d::operator!=(const vector2d& other)
{
	int i = 0;

	if (afData[0] == other.x())
	{
		i++;
	}
	if (afData[1] == other.y())
	{
		i++;
	}
	return i != 2;
}
开发者ID:JosephRadu,项目名称:zombie_game_2,代码行数:14,代码来源:vector2d.cpp

示例8:

	void BitmapWrapperD2D::draw(rectangle2d<int32_t> rect, float_t xscale, float_t yscale, vector2d<int32_t> center, float_t alpha) const
	{
		ID2D1BitmapRenderTarget* target = Graphics::locator.gettarget();
		if (target)
		{
			bool transform = (xscale != 1.0f) || (yscale != 1.0f);

			if (transform)
			{
				target->SetTransform(
					D2D1::Matrix3x2F::Scale(
					D2D1::Size(xscale, yscale),
					D2D1::Point2F(
					static_cast<FLOAT>(center.x()),
					static_cast<FLOAT>(center.y())
					)));
			}

			if (source)
			{
				D2D_RECT_F r = D2D1::RectF((FLOAT)rect.l(), (FLOAT)rect.t(), (FLOAT)rect.r(), (FLOAT)rect.b());
				target->DrawBitmap(source, r, alpha);
			}

			if (transform)
			{
				target->SetTransform(
					D2D1::Matrix3x2F::Scale(
					D2D1::Size(1.0f, 1.0f),
					D2D1::Point2F(
					static_cast<FLOAT>(center.x()),
					static_cast<FLOAT>(center.y())
					)));
			}
		}
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:36,代码来源:BitmapWrapperD2D.cpp

示例9: getbelow

	foothold footholdtree::getbelow(vector2d pos)
	{
		foothold ret;
		float comp = 65536;
		pos = pos - vector2d(0, 10);

		for (map<short, foothold>::iterator ftit = footholds.begin(); ftit != footholds.end(); ftit++)
		{
			foothold fh = ftit->second;

			if (fh.hcontains(pos.x()))
			{
				float y = fh.resolvex(pos.x());

				if (comp > y && y > pos.y())
				{
					ret = fh;
					comp = y;
				}
			}
		}

		return ret;
	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:24,代码来源:footholdtree.cpp

示例10: draw

	void TextWrapperGL::draw(vector2d<int32_t> pos) const
	{
		const FontsFT* fonts = LocatorGL::getfonts();
		if (false)
		{
			const FT_Face* fontface = fonts->getfont(font);
			if (*fontface)
			{
				float x = static_cast<float>(pos.x());
				float y = static_cast<float>(pos.y());

				//glBlendFunc(GL_SRC_ALPHA, GL_ZERO);

				for (size_t i = 0; i < str.size(); i++)
				{
					int8_t ch = str[i];
					FT_GlyphSlot g = (*fontface)->glyph; 
					
					FT_UInt  glyph_index = FT_Get_Char_Index(*fontface, ch);

					if (FT_Load_Glyph(*fontface, glyph_index, FT_LOAD_DEFAULT) == FT_Err_Ok)
					{
						if (FT_Render_Glyph(g, FT_RENDER_MODE_NORMAL) == FT_Err_Ok)
						{
							glBindTexture(GL_TEXTURE_2D, texture);
							glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, g->bitmap.width, g->bitmap.rows, 0, GL_RED, GL_UNSIGNED_BYTE, g->bitmap.buffer);

							x += g->advance.x >> 6;
						}
					}
				}

				/*glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

				GLfloat left = pos.x();
				GLfloat right = pos.x() + x;
				GLfloat top = y;
				GLfloat bottom = y + 14;

				glBegin(GL_QUADS);
				glTexCoord2f(0, 0); glVertex3f(left, top, 0);
				glTexCoord2f(0, 1); glVertex3f(left, bottom, 0);
				glTexCoord2f(1, 1); glVertex3f(right, bottom, 0);
				glTexCoord2f(1, 0); glVertex3f(right, top, 0);
				glEnd();*/
			}
		}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:47,代码来源:TextWrapperGL.cpp

示例11: getlwall

	int32_t Footholdtree::getlwall(vector2d<int32_t> pos) const
	{
		int32_t ret = walls.x();
		vector2d<int32_t> ver = vector2d<int32_t>(pos.y() - 80, pos.y() - 20);
		for (map<uint16_t, Foothold>::const_iterator ftit = footholds.begin(); ftit != footholds.end(); ++ftit)
		{
			Foothold fh = ftit->second;
			if (fh.getver().overlaps(ver) && fh.iswall())
			{
				int32_t x = fh.getl();
				if (x > ret && x <= pos.x())
				{
					ret = x;
				}
			}
		}
		return ret;
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:18,代码来源:Footholdtree.cpp

示例12:

	vector2d vector2d::operator + (vector2d v)
	{
		return vector2d(a + v.x(), b + v.y());
	}
开发者ID:swordlegend,项目名称:journey_client,代码行数:4,代码来源:vector2d.cpp

示例13: setposition

	void Player::setposition(vector2d<int32_t> pos)
	{
		phobj.fx = static_cast<float>(pos.x());
		phobj.fy = static_cast<float>(pos.y());
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:5,代码来源:Player.cpp

示例14: multiply

vector2d vector2d::multiply(const vector2d& other) const
{
	vector2d multiply(afData[0] * other.x(), afData[1] * other.y());
	return multiply;
}
开发者ID:JosephRadu,项目名称:zombie_game_2,代码行数:5,代码来源:vector2d.cpp

示例15: add

vector2d vector2d::add(const vector2d& other) const
{
	vector2d add(afData[0] + other.x(), afData[1] + other.y());
	return add;
}
开发者ID:JosephRadu,项目名称:zombie_game_2,代码行数:5,代码来源:vector2d.cpp


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