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

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

51自学网 2021-06-03 09:36:50
  C++
这篇教程C++ vector2d函数代码示例写得很实用,希望能帮到您。

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

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

示例1: vector2d

	statsinfo::statsinfo(maplestats* st)	{		app.getimgcache()->setmode(ict_sys);		nl::node src = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["main"];		nl::node detail = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["detail"];		sprites.push_back(sprite(animation(src["backgrnd"]), vector2d()));		sprites.push_back(sprite(animation(src["backgrnd2"]), vector2d()));		sprites.push_back(sprite(animation(src["backgrnd3"]), vector2d()));		detailbgs.push_back(texture(detail["backgrnd"]));		detailbgs.push_back(texture(detail["backgrnd2"]));		detailbgs.push_back(texture(detail["backgrnd3"]));		abilities["rare"] = texture(detail["abilityTitle"]["rare"]["0"]);		abilities["epic"] = texture(detail["abilityTitle"]["epic"]["0"]);		abilities["unique"] = texture(detail["abilityTitle"]["unique"]["0"]);		abilities["legendary"] = texture(detail["abilityTitle"]["legendary"]["0"]);		abilities["none"] = texture(detail["abilityTitle"]["normal"]["0"]);		app.getimgcache()->unlock();		stats = st;		position = config.getstatspos();		dimensions = vector2d();		active = true;	}
开发者ID:archlo,项目名称:journey_client,代码行数:27,


示例2: switch

	loginnotice::loginnotice(char param)	{		app.getimgcache()->setmode(ict_login);		node notice = nl::nx::nodes["UI"]["Login.img"]["Notice"];		string back;		switch (param)		{		case 16:			back = "backgrnd/1";			buttons[BT_LOGINBANOK] = button(notice.resolve("BtYes"), 100, 100);			break;		case 22: //This is TOS, TO DO			break;		case 93:			back = "backgrnd/1";			buttons[BT_LOGINNOTICEOK] = button(notice.resolve("BtYes"), 100, 100);			break;		default:			back = "backgrnd/0";			buttons[BT_LOGINNOTICEOK] = button(notice.resolve("BtYes"), 100, 100);		}		sprites.push_back(sprite(animation(notice.resolve(back)), vector2d()));		sprites.push_back(sprite(animation(notice.resolve("text/" + to_string(param))), vector2d(17, 13)));		app.getimgcache()->unlock();		position = vector2d(292, 200);		dimensions = vector2d(362, 219);		type = param;		active = true;		dragged = false;		buttoncd = 0;	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:35,


示例3: vector2d

void  CBossCutMan::drawEntity(){	if (m_isLeft)		this->m_listSprite[m_checkState]->Render(m_Position, vector2d(1.0, 1.0), 0.0f, DRAWCENTER_MIDDLE_MIDDLE, true, 5);	else		this->m_listSprite[m_checkState]->Render(m_Position, vector2d(-1.0, 1.0), 0.0f, DRAWCENTER_MIDDLE_MIDDLE, true, 5);}
开发者ID:diemhuongpie,项目名称:GameDx,代码行数:7,


示例4: vector2d

	maplayer::maplayer(node source)	{		node tilesrc = nx::nodes["Map"]["Tile"][source["info"]["tS"] + ".img"];		node objsrc = nx::nodes["Map"]["Obj"];		for (node layernode = source.begin(); layernode != source.end(); layernode++)		{			if (layernode.name() == "obj")			{				for (node objnode = layernode.begin(); objnode != layernode.end(); ++objnode)				{					vector2d position = vector2d(objnode["x"], objnode["y"]);					node bmpnode = objsrc[objnode["oS"] + ".img"][objnode["l0"]][objnode["l1"]][objnode["l2"]];					int z = objnode["z"];					objs[z].push_back(sprite(animation(bmpnode), position, true, objnode.resolve("f").get_bool()));				}			}			else if (layernode.name() == "tile")			{				for (node tilenode = layernode.begin(); tilenode != layernode.end(); ++tilenode)				{					node bmpnode = tilesrc[tilenode["u"]][to_string(tilenode["no"].get_integer())];					tile toadd;					toadd.pos = vector2d(tilenode["x"], tilenode["y"]);					toadd.txt = texture(bmpnode);					int z = bmpnode["z"].istype(integernode) ? bmpnode["z"] : tilenode["zM"];					tiles[z].push_back(toadd);				}			}		}	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:33,


示例5: GetVectorAwayFromAll

vector2d Prey::GetVectorAwayFromAll(list<Square> & l_prdt){	//todo:two (nearly) opposite ones, should yield a (nearly) perpendicular vector and its opposite.	Square pos=GetPosition();		list<vector2d>	l_v;	vector2d		v,w;	double dist;	for(list<Square>::iterator it=l_prdt.begin();it!=l_prdt.end();it++)	{		dist=distance_fake(pos,*it);		v=vector2d(pos)-vector2d(*it);		w=v*(1/dist);		l_v.push_back(w);	}	vector2d directionToFleeTo=vector2d(0,0);	for(list<vector2d>::iterator itv=l_v.begin();itv!=l_v.end();itv++)	{		directionToFleeTo=directionToFleeTo+(*itv);	}	if(directionToFleeTo.x==0 && directionToFleeTo.y==0)		directionToFleeTo.x=1,directionToFleeTo.y=1; //just any vector, for this version.		return directionToFleeTo;}
开发者ID:hbdevelop1,项目名称:preypred,代码行数:31,


示例6: vector3d

bool CPlayer::initEntity(){	m_IsCollision = false;	m_IsAutoMove = false;	m_IsAutoJump = false;	m_IsFreeFall = false;	m_Direction.push_back(DIRECTION::DIRECTION_NONE);	m_Direction.push_back(DIRECTION::DIRECTION_NONE);	m_UndyingTime = 0;	m_Position = vector3d(50, 70, 0);	m_PreJumpPos = vector3d(0, 0, 0);	m_State = PLAYERSTATES::STAND;	m_PlayerState = new CStandState();	m_PlayerTag = PLAYERTAGS::SMALL;	m_Acceleration = vector2d(0.5f, 0);	m_Velocity = vector2d(VEL_PLAYER_X_MIN, VEL_DEFAULT_Y);	m_Direction.at(DIRECTIONINDEX::DIRECTION_X) = DIRECTION::DIRECTION_RIGHT;	m_Direction.at(DIRECTIONINDEX::DIRECTION_Y) = DIRECTION::DIRECTION_UP;	this->m_ResouceImage = new CPlayerResource(TAGNODE::PLAYER);	this->loadSprite();	this->m_Bounding = new CBox2D(0, 0, 0, 0);	return true;}
开发者ID:TrungLM13,项目名称:GameDirect2016Team,代码行数:29,


示例7: prepare_sprite

// converts a dead person in black particlesvoid Person::burn(){  GamePlay *gameplay = GAMEPLAY;  BITMAP *sprite = prepare_sprite();  int x, y, u, v;  gameplay->get_level()->to_screen(m_pos, x, y);  x = x-TILE_W/2;  y = y-TILE_H+1;  for (v=0; v<sprite->h; ++v)    for (u=0; u<sprite->w; ++u) {      int color, ou;      if (m_right)	color = getpixel(sprite, ou=u, v);      else	color = getpixel(sprite, ou=sprite->w-1-u, v);      if (color != bitmap_mask_color(sprite))	gameplay->add_particle	  (new PixelParticle(vector2d((m_pos.x*TILE_W - TILE_W/2 + ou) / TILE_W,				      (m_pos.y*TILE_H - TILE_H+1 + v) / TILE_H),			     vector2d(0, rand_range(-2.0, -0.1)),			     vector2d(rand_range(0.5, 4.0), 0),			     rand_range(BPS/4, BPS*3/4),			     makecol(0, 0, 0),			     makecol(0, 0, 0)));    }}
开发者ID:dacap,项目名称:defenderofnothing,代码行数:33,


示例8: if

	void chatbar::draw()	{		if (active)		{			chatspace[open].draw(position);			if (open)			{				chatenter.draw(position);			}		}		uielement::draw();		if (active)		{			if (open)			{			}			else if (lines.size() > 0)			{				closedtext.draw(lines.back(), position + vector2d(-430, -60));			}			chattargets[chattarget].draw(position + vector2d(0, 2));			chatcover.draw(position);		}	}
开发者ID:LankMasterFlex,项目名称:journey_client,代码行数:29,


示例9: vector2d

	mapinfo::mapinfo(int id, nl::node mapnode)	{		mapid = id;		nl::node infonode = mapnode["info"];		nl::node VRnode = infonode.resolve("VRLeft");		if (VRnode.data_type() == nl::node::type::integer)		{			mapwalls = vector2d(infonode.resolve("VRLeft").get_integer(), infonode.resolve("VRRight").get_integer());			mapborders = vector2d(infonode.resolve("VRTop").get_integer(), infonode.resolve("VRBottom").get_integer());		}		else		{			nl::node miniMap = mapnode["miniMap"];			int centerX = miniMap["centerX"].get_integer();			int centerY = miniMap["centerY"].get_integer();			int width = miniMap["width"].get_integer();			int height = miniMap["height"].get_integer() + 1000;			mapwalls = vector2d(centerX - width / 2, centerX + width / 2);			mapborders = vector2d(centerY - height / 2, centerY + height / 2);		}		bgm = infonode.resolve("bgm").get_string();		cloud = infonode.resolve("cloud").get_bool();		fieldlimit = static_cast<int>(infonode.resolve("fieldLimit").get_integer());		hideminimap = infonode.resolve("hideMinimap").get_bool();		mapmark = infonode.resolve("mapMark").get_string();		swim = infonode.resolve("swim").get_bool();		town = infonode.resolve("town").get_bool();	}
开发者ID:dreamsxin,项目名称:journey_client,代码行数:32,


示例10: switch

	int charset::draw(string numstr, char space, alignment align, vector2d pos, float alpha)	{		char length = numstr.length();		int shift = 0;		switch (align)		{		case cha_center:			shift -= (space * length) / 2;		case cha_left:			for (char i = 0; i < length; i++)			{				shift += space;				draw(numstr[i], pos + vector2d(shift, 0), alpha);			}			break;		case cha_right:			for (char i = length - 1; i >= 0; i--)			{				shift += space;				draw(numstr[i], pos - vector2d(shift, 0), alpha);			}			break;		}		return shift;	}
开发者ID:LankMasterFlex,项目名称:journey_client,代码行数:26,


示例11: vector2d

	void statusmenu::draw(ID2D1HwndRenderTarget* target)	{		if (active)		{			backfill.draw(position + vector2d(0, 34), vector2d(0, 116));			uielement::draw(target);		}	}
开发者ID:archlo,项目名称:journey_client,代码行数:9,


示例12: vector2d

Ball::Ball(int px, int py, int sx, int sy, int r) {	/*! /brief Initialize vectors via initialization list	 */	x = 0;	radius = r;		offset = vector2d(px, py);	slope = vector2d(sx, sy);	center = point2d(px, py);}
开发者ID:FlopsKa,项目名称:libvec2d,代码行数:10,


示例13: vector2d

	statsinfo::statsinfo(maplestats* st, inventory* iv)	{		app.getimgcache()->setmode(ict_sys);		nl::node src = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["main"];		nl::node detail = nl::nx::nodes["UI"]["UIWindow4.img"]["Stat"]["detail"];		sprites.push_back(sprite(animation(src["backgrnd"]), vector2d()));		sprites.push_back(sprite(animation(src["backgrnd2"]), vector2d()));		sprites.push_back(sprite(animation(src["backgrnd3"]), vector2d()));		detailbgs.push_back(texture(detail["backgrnd"]));		detailbgs.push_back(texture(detail["backgrnd2"]));		detailbgs.push_back(texture(detail["backgrnd3"]));		abilities["rare"] = texture(detail["abilityTitle"]["rare"]["0"]);		abilities["epic"] = texture(detail["abilityTitle"]["epic"]["0"]);		abilities["unique"] = texture(detail["abilityTitle"]["unique"]["0"]);		abilities["legendary"] = texture(detail["abilityTitle"]["legendary"]["0"]);		abilities["none"] = texture(detail["abilityTitle"]["normal"]["0"]);		buttons[BT_STATS_HP] = button(src["BtHpUp"]);		buttons[BT_STATS_MP] = button(src["BtMpUp"]);		buttons[BT_STATS_STR] = button(src["BtStrUp"]);		buttons[BT_STATS_DEX] = button(src["BtDexUp"]);		buttons[BT_STATS_LUK] = button(src["BtLukUp"]);		buttons[BT_STATS_INT] = button(src["BtIntUp"]);		if (st->getstat(MS_AP) == 0)		{			buttons[BT_STATS_HP].setstate(BTS_DISABLED);			buttons[BT_STATS_MP].setstate(BTS_DISABLED);			buttons[BT_STATS_STR].setstate(BTS_DISABLED);			buttons[BT_STATS_DEX].setstate(BTS_DISABLED);			buttons[BT_STATS_LUK].setstate(BTS_DISABLED);			buttons[BT_STATS_INT].setstate(BTS_DISABLED);		}		buttons[BT_STATS_DETAILOPEN] = button(src["BtDetailOpen"]);		buttons[BT_STATS_DETAILCLOSE] = button(src["BtDetailClose"]);		buttons[BT_STATS_DETAILCLOSE].setactive(false);		statlabel = textlabel(DWF_12L, TXC_BLACK, "");		app.getimgcache()->unlock();		position = config.getconfig()->statsinfopos;		dimensions = vector2d(212, 318);		active = true;		dragged = false;		buttoncd = 0;		showdetail = false;		stats = st;		invent = iv;	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:54,


示例14: glMatrixMode

void Camera::SetMatrix (){	glMatrixMode (GL_PROJECTION);	glLoadIdentity ();	glViewport (0, 0, camera.width, camera.height);	camera.view_field.lb = vector2d (camera.center.x - camera.scale * camera.aspect_ratio,									 camera.center.y - camera.scale);	camera.view_field.rt = vector2d (camera.center.x + camera.scale * camera.aspect_ratio,									 camera.center.y + camera.scale);	gluOrtho2D (camera.view_field.lb.x, camera.view_field.rt.x,				camera.view_field.lb.y, camera.view_field.rt.y);}
开发者ID:kachkov98,项目名称:VerletPhysics,代码行数:12,


示例15: vector2d

	login::login()	{		app.getimgcache()->setmode(ict_login);		nl::nx::view_file("UI");		node title = nl::nx::nodes["UI"].resolve("Login.img/Title/");		node common = nl::nx::nodes["UI"].resolve("Login.img/Common/");		sprites.push_back(sprite(animation(title.resolve("11")), vector2d(410, 300)));		sprites.push_back(sprite(animation(title.resolve("35")), vector2d(410, 260)));		sprites.push_back(sprite(animation(title.resolve("Logo")), vector2d(410, 130)));		sprites.push_back(sprite(animation(title.resolve("signboard")), vector2d(410, 300)));		sprites.push_back(sprite(animation(common.resolve("frame")), vector2d(400, 290)));		buttons[BT_LOGIN] = button(title.resolve("BtLogin"), 475, 248);		buttons[BT_NEW] = button(title.resolve("BtNew"), 309, 320);		buttons[BT_HOMEPAGE] = button(title.resolve("BtHomePage"), 382, 320);		buttons[BT_PWDLOST] = button(title.resolve("BtPasswdLost"), 470, 300);		buttons[BT_QUIT] = button(title.resolve("BtQuit"), 455, 320);		buttons[BT_LOGINLOST] = button(title.resolve("BtLoginIDLost"), 395, 300);		buttons[BT_SAVEID] = button(title.resolve("BtLoginIDSave"), 325, 300);		bool saveid = config.accsaved();		saveidcheck = sprite(animation(title.resolve("check")), vector2d(313, 304));		string defaultacc;		if (saveid)			defaultacc = config.getdefaultacc();		else			defaultacc = "";		textfields[TXT_ACC] = textfield(app.getfonts()->getfont(DWF_LEFT), txc_white, defaultacc, vector2d(315, 249), 12);		textfields[TXT_ACC].setbg(texture(title.resolve("ID")), -5, 0);		textfields[TXT_PASS] = textfield(app.getfonts()->getfont(DWF_LEFT), txc_white, "", vector2d(315, 275), 12);		textfields[TXT_PASS].setbg(texture(title.resolve("PW")), -5, 0);		if (!saveid)		{			textfields[TXT_ACC].setstate("active");			app.getui()->settextfield(&textfields[0]);		}		else		{			textfields[TXT_PASS].setstate("active");			app.getui()->settextfield(&textfields[1]);		}		nl::nx::unview_file("UI");		app.getimgcache()->unlock();		position = vector2d(0, 0);		dimensions = vector2d(800, 600);		active = true;		visible = true;	}
开发者ID:swordlegend,项目名称:journey_client,代码行数:55,


示例16:

void	CBox2D::render(){	vector2d	vertex1[] = { CCamera::setPositionEntity(vector3d(m_Position)), CCamera::setPositionEntity(vector3d(vector2d(m_Position.x, m_Position.y - m_Size.y))) };	m_line->Draw(vertex1, 2, 0xFFFF00FF);	vector2d	vertex2[] = { CCamera::setPositionEntity(vector3d(vector2d(m_Position.x, m_Position.y - m_Size.y))), CCamera::setPositionEntity(vector3d(vector2d(m_Position.x + m_Size.x, m_Position.y - m_Size.y))) };	m_line->Draw(vertex2, 2, 0xFFFF00FF);	vector2d	vertex3[] = { CCamera::setPositionEntity(vector3d(vector2d(m_Position.x + m_Size.x, m_Position.y - m_Size.y))), CCamera::setPositionEntity(vector3d(vector2d(m_Position.x + m_Size.x, m_Position.y))) };	m_line->Draw(vertex3, 2, 0xFFFF00FF);	vector2d	vertex4[] = { CCamera::setPositionEntity(vector3d(m_Position)), CCamera::setPositionEntity(vector3d(vector2d(m_Position.x + m_Size.x, m_Position.y))) };	m_line->Draw(vertex4, 2, 0xFFFF00FF);}
开发者ID:diemhuongpie,项目名称:GameDx,代码行数:14,


示例17: ASSERT

	//---------------------------------------------------------------------------------------------------------	void VertexBufferResource::ChangeVertexBuffer( const VertexStream& stream )	{		const vector2d& interval = stream.GetReflushInterval();		ASSERT( interval.m_x != interval.m_y );		if ( interval.m_x < interval.m_y )		{//正常刷新,产生一个刷新事件			_PushReflushStream( stream, interval );		}		else		{//当刷新越界,得时候产生两个刷新			_PushReflushStream( stream, vector2d( interval.m_x, stream.GetVertexCount() ) );			_PushReflushStream( stream, vector2d( 0, interval.m_y ) );		}	}
开发者ID:bohge,项目名称:Bohge_Engine,代码行数:15,


示例18: vector3d

bool CPlayer::initEntity(){	m_Position		= vector3d(200, 337, 0.5);	m_State			= PLAYSTATE::START;	m_Acceleration	= vector2d(0.5f, 0);	this->m_isJump	= true;	m_Velocity		= vector2d(9.8, 9.8);	this->loadSprite();	this->m_Bounding = new CBox2D(0, 0, 0, 0);	return true;}
开发者ID:diemhuongpie,项目名称:GameDx,代码行数:15,


示例19: getposition

void itemdrop::draw(vector2d viewpos){    if (state != DST_INACTIVE)    {        ico.draw(viewpos + getposition() - vector2d(16, 0), dalpha);    }}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:7,


示例20: vector2d

	void dragitemicon::dragdraw(vector2d cursor)	{		if (drag)		{			itemicon::draw(cursor + rel + vector2d(0, 32));		}	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:7,


示例21: FT_Load_Glyph

//-------------------------------------------------------------------------------------------------------StringManager::BChar* StringManager::_LoadChar(wchar_t wchar){    //参考http://my.unix-center.net/~Simon_fu/?p=385    bool space = false;    if( L' ' == wchar )    {        space = true;        wchar = L'_';    }    FT_Load_Glyph(m_FT_Face,  FT_Get_Char_Index( m_FT_Face, wchar ), FT_LOAD_DEFAULT);//FT_LOAD_FORCE_AUTOHINT| FT_LOAD_TARGET_NORMAL);    //得到字模    FT_Glyph glyph;    FT_Get_Glyph( m_FT_Face->glyph, &glyph );    //转化成位图    FT_Render_Glyph( m_FT_Face->glyph,   FT_RENDER_MODE_LCD );    FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1 );    FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)glyph;    //取道位图数据    FT_Bitmap& bitmap=bitmap_glyph->bitmap;    //重新计算数据    float scale = static_cast<float>(bitmap.rows) / static_cast<float>(m_FT_Face->glyph->metrics.height);//计算文本高宽缩放到bitmap高宽的缩放比    int beginY =  Math::Ceil( m_FT_Face->glyph->metrics.horiBearingY * scale );//y偏移    //FT_Done_Glyph(glyph);    vector2d size = vector2d(bitmap.width, bitmap.rows);    return NEW BChar(beginY, size, glyph, space);}
开发者ID:RichardOpenGL,项目名称:Bohge_Engine,代码行数:31,


示例22: vector2d

//-----------------implementation of windows class-------------------------------Window::Window (int *argc, char *argv[], int window_width, int window_height, const char *window_title){	//init camera	camera.width = window_width;	camera.height = window_height;	is_close = false;	camera.center = vector2d (0, 2.0);	camera.scale = 5.0;	//init keyboard	for (int i = 0; i < 256; i++)		keys[i] = false;	//start logging	InitLog ();	//create window	glutInit (argc, argv);	glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE);	glutInitWindowSize (camera.width, camera.height);	handle = glutCreateWindow (window_title);	//set callbacks	glutDisplayFunc (display);	glutReshapeFunc (reshape);	glutCloseFunc (close);	glutKeyboardFunc (key_down);	glutKeyboardUpFunc (key_up);	glutMotionFunc (mouse_move);	glutPassiveMotionFunc (mouse_move);	glutMouseFunc (mouse_press);	glutMouseWheelFunc (mouse_wheel);	log (LOG_INFO, "Window /"%s/" created succesfully", window_title);}
开发者ID:kachkov98,项目名称:VerletPhysics,代码行数:34,


示例23: getposition

	void mesodrop::draw(vector2d viewpos)	{		if (state != DST_INACTIVE)		{			graphicobject::draw(anim, getposition() + viewpos - vector2d(16, 0), false);		}	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:7,


示例24: vector2d

	void textfield::draw(vector2d parentpos)	{		if (active)		{			vector2d absp = position + parentpos;			if (text.size() > 0)			{				if (crypt > 0)				{					string crtext;					crtext.insert(0, text.size(), crypt);					textlabel::drawover(crtext, absp);				}				else				{					textlabel::draw(absp);				}			}			if (focused)			{				if (showmark)				{					marker.draw(absp + vector2d(getadvance(markpos), 0));				}			}			else if (text.size() == 0)			{				bg.draw(absp + bgposition);			}		}	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:33,


示例25: tilemap_draw_from_data

int tilemap_draw_from_data(TileMap * tilemap){	unsigned int i = 0;	unsigned int j = 0;	int tileNum;	if (!tilemap)	{		slog("Error: no tilemap");		return -1;	}	/*if (!tilemap->tiles_head || !tilemap->tiles_tail)	{		slog("Error: incomplete pq in tilemap");		return;	}*/	tileNum = 0;	for (i = 0; i < tilemap->height; i++)	{		for (j = 0; j < tilemap->width; j++)		{			gf2d_sprite_draw(tilemap->tilemapSprite, vector2d(tilemap->xPos + (j * tilemap->tilemapSprite->frame_w), tilemap->yPos + (i * tilemap->tilemapSprite->frame_h)), NULL, NULL, NULL, NULL, NULL, tilemap->tiles[tileNum]);			tileNum++;		}	}	return 0;}
开发者ID:mwk9,项目名称:2D-game-programming,代码行数:26,


示例26: vector2d

	login::login()	{		app.getimgcache()->setmode(ict_login);		node title = nl::nx::nodes["UI"]["Login.img"]["Title"];		node common = nl::nx::nodes["UI"]["Login.img"]["Common"];		sprites.push_back(sprite(animation(title["11"]), vector2d(410, 300)));		sprites.push_back(sprite(animation(title["35"]), vector2d(410, 260)));		sprites.push_back(sprite(animation(title["Logo"]), vector2d(410, 130)));		sprites.push_back(sprite(animation(title["signboard"]), vector2d(410, 300)));		sprites.push_back(sprite(animation(common["frame"]), vector2d(400, 290)));		buttons[BT_LOGIN] = button(title["BtLogin"], 475, 248);		buttons[BT_NEW] = button(title["BtNew"], 309, 320);		buttons[BT_HOMEPAGE] = button(title["BtHomePage"], 382, 320);		buttons[BT_PWDLOST] = button(title["BtPasswdLost"], 470, 300);		buttons[BT_QUIT] = button(title["BtQuit"], 455, 320);		buttons[BT_LOGINLOST] = button(title["BtLoginIDLost"], 395, 300);		buttons[BT_SAVEID] = button(title["BtLoginIDSave"], 325, 300);		string defaultacc = config.getdefaultacc();		saveid = config.getsaveid();		saveidcheck[false] = texture(title["check"]["0"]);		saveidcheck[true] = texture(title["check"]["1"]);		textfields[TXT_ACC] = textfield(TXT_ACC, DWF_14L, TXC_WHITE, defaultacc, vector2d(315, 249), 12);		textfields[TXT_ACC].setbg(texture(title["ID"]), -5, 0);		textfields[TXT_PASS] = textfield(TXT_PASS, DWF_14L, TXC_WHITE, "", vector2d(315, 275), 12);		textfields[TXT_PASS].setbg(texture(title["PW"]), -5, 0);		if (saveid)		{			textfields[TXT_PASS].setfocus(true);			app.getui()->settextfield(&textfields[TXT_PASS]);		}		else		{			textfields[TXT_ACC].setfocus(true);			app.getui()->settextfield(&textfields[TXT_ACC]);		}		app.getimgcache()->unlock();		position = vector2d(0, 0);		dimensions = vector2d(800, 600);		active = true;		dragged = false;		buttoncd = 0;	}
开发者ID:LankMasterFlex,项目名称:journey_client,代码行数:51,


示例27: button

	chatbar::chatbar()	{		app.getimgcache()->setmode(ict_sys);		node mainbar = nx::nodes["UI"]["StatusBar2.img"]["mainBar"];		node chat = nx::nodes["UI"]["StatusBar2.img"]["chat"];		open = config.getconfig()->chatopen;		buttons[BT_BAR_OPENCHAT] = button(mainbar["chatOpen"]);		buttons[BT_BAR_CLOSECHAT] = button(mainbar["chatClose"]);		buttons[BT_BAR_SCROLLUP] = button(mainbar["scrollUp"]);		buttons[BT_BAR_SCROLLDOWN] = button(mainbar["scrollDown"]);		buttons[BT_BAR_CHATTARGET] = button(mainbar["chatTarget"]["base"]);		buttons[BT_BAR_CHATTARGET].setactive(open);		buttons[open ? BT_BAR_OPENCHAT : BT_BAR_CLOSECHAT].setactive(false);		chatspace[false] = texture(mainbar["chatSpace"]);		chatspace[true] = texture(mainbar["chatEnter"]);		chatenter = texture(mainbar["chatSpace2"]);		chatcover = texture(mainbar["chatCover"]);		chattargets[CHT_ALL] = texture(mainbar["chatTarget"]["all"]);		chattargets[CHT_BUDDY] = texture(mainbar["chatTarget"]["friend"]);		chattargets[CHT_GUILD] = texture(mainbar["chatTarget"]["guild"]);		chattargets[CHT_ALLIANCE] = texture(mainbar["chatTarget"]["association"]);		chattargets[CHT_PARTY] = texture(mainbar["chatTarget"]["party"]);		chattargets[CHT_SQUAD] = texture(mainbar["chatTarget"]["expedition"]);		textfields[TXT_CHAT] = textfield(TXT_CHAT, DWF_12L, TXC_BLACK, "", vector2d(-430, -60), 64);		textfields[TXT_CHAT].setactive(open);		closedtext = textlabel(DWF_12L, TXC_WHITE, "");		app.getimgcache()->unlock();		position = vector2d(512, 590);		dimensions = vector2d(500, 80);		active = true;		dragged = false;		buttoncd = 0;		chattarget = CHT_ALL;	}
开发者ID:thisIsTooHard,项目名称:journey_client,代码行数:44,


示例28: vector2d

void	CTiless::drawEntity(){	for (int i = 0; i < m_listSprite.size(); ++i)	/*if (m_ID == TileStyle::TOF_BRICK_TILE)		m_listSprite.at(i)->Render(CCamera::getInstance()->setPositionEntity(m_Position), vector2d(1, 1), 0, DRAWCENTER_MIDDLE_MIDDLE);	else*/ if (m_ID == TileStyle::TOF_MOUNTAIN_BIG || m_ID == TOF_MOUNTAIN_SMALL || TOF_PIPE_HEAD_DOWN)		m_listSprite.at(i)->Render(CCamera::getInstance()->setPositionEntity(vector3d(m_Position.x, m_Position.y - 16, 0.5f)), vector2d(1, 1), 0, DRAWCENTER_LEFT_BOTTOM, true, 10);	else		m_listSprite.at(i)->Render(CCamera::getInstance()->setPositionEntity(m_Position), vector2d(1, 1), 0, DRAWCENTER_LEFT_TOP, true, 10);}
开发者ID:TrungLM13,项目名称:GameDirect2016Team,代码行数:10,



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


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