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


C++ ZMap::GetBlitInfo方法代码示例

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


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

示例1: Render

void ZCursor::Render(ZMap &the_map, SDL_Surface *dest, int &x, int &y, bool restrict_to_map)
{
	SDL_Rect from_rect, to_rect;
	int x_shift, y_shift;

	if(!current_surface) return;

	if(current_cursor > CURSOR_C)
	{
		x_shift = -8;
		y_shift = -8;
	}
	else
	{
		x_shift = 0;
		y_shift = 0;
	}

	if(restrict_to_map)
	{

		if(the_map.GetBlitInfo(current_surface->GetBaseSurface(), x + x_shift, y + y_shift, from_rect, to_rect))
			current_surface->BlitSurface(&from_rect, &to_rect);
			//SDL_BlitSurface( current_surface, &from_rect, dest, &to_rect);
	}
	else
	{
		to_rect.x = x + x_shift;
		to_rect.y = y + y_shift;

		current_surface->BlitSurface(NULL, &to_rect);
		//SDL_BlitSurface( current_surface, NULL, dest, &to_rect);
	}
}
开发者ID:Nitaym,项目名称:zodengine,代码行数:34,代码来源:cursor.cpp

示例2: DoRender

void OHut::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y)
{
	int &x = loc.x;
	int &y = loc.y;
	SDL_Rect from_rect, to_rect;

	if(the_map.GetBlitInfo( render_img[palette].GetBaseSurface(), x, y, from_rect, to_rect))
	{
		to_rect.x += shift_x;
		to_rect.y += shift_y;

		render_img[palette].BlitSurface(&from_rect, &to_rect);
		//SDL_BlitSurface( render_img[palette], &from_rect, dest, &to_rect);
	}
}
开发者ID:Nitaym,项目名称:zodengine,代码行数:15,代码来源:ohut.cpp

示例3: DoRender

void RLaser::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y)
{
	int &x = loc.x;
	int &y = loc.y;
	ZSDL_Surface *base_surface;
	SDL_Rect from_rect, to_rect;
	int lx, ly;
	
	if(owner != NULL_TEAM)
	{
		switch(mode)
		{
			case R_WALKING: base_surface = &walk[owner][direction][move_i]; break;
			case R_STANDING: base_surface = &stand[owner][direction]; break;
			case R_BEER: base_surface = &beer[owner][action_i]; break;
			case R_CIGARETTE: base_surface = &cigarette[owner][action_i]; break;
			case R_FULLSCAN: base_surface = &full_area_scan[owner][action_i]; break;
			case R_HEADSTRETCH: base_surface = &head_stretch[owner][action_i]; break;
			case R_PICKUP_UP_GRENADES: base_surface = &pickup_up[owner][action_i]; break;
			case R_PICKUP_DOWN_GRENADES: base_surface = &pickup_down[owner][action_i]; break;
			case R_ATTACKING: 
				if(this->CanThrowGrenades() || (m_attacked_object && m_attacked_object->AttackedOnlyByExplosives()))
					base_surface = &throw_something[owner][direction][grenade_i];
				else
					base_surface = &fire[owner][direction][action_i];
				break;
			default: base_surface = &null_img;
		}
	}
	else
		base_surface = &null_img;
	
	if(!base_surface) return;

	submerge_amount = the_map.SubmergeAmount(loc.x+8,loc.y+8);
	
	//if(the_map.GetBlitInfo(base_surface, x, y, from_rect, to_rect))
	if(the_map.GetBlitInfo(x, y + submerge_amount, 16, 16 - submerge_amount, from_rect, to_rect))
	{
		to_rect.x += shift_x;
		to_rect.y += shift_y;

		base_surface->BlitHitSurface(&from_rect, &to_rect, NULL, do_hit_effect);
		//ZSDL_BlitHitSurface( base_surface, &from_rect, dest, &to_rect, do_hit_effect);
	}

	do_hit_effect = false;
}
开发者ID:sebhd,项目名称:zod,代码行数:48,代码来源:rlaser.cpp

示例4: DoRender

void OMapObject::DoRender(ZMap &the_map, /*SDL_Surface *dest,*/ int shift_x, int shift_y)
{
	int &x = loc.x;
	int &y = loc.y;
	SDL_Rect from_rect, to_rect;

	if(!render_img[object_i].GetBaseSurface()) return;

	if(the_map.GetBlitInfo( render_img[object_i].GetBaseSurface(), x, y + (16 - render_img[object_i].GetBaseSurface()->h), from_rect, to_rect))
	{
		to_rect.x += shift_x;
		to_rect.y += shift_y;

		render_img[object_i].BlitSurface(&from_rect, &to_rect);
		//SDL_BlitSurface( render_img[object_i], &from_rect, dest, &to_rect);
	}
}
开发者ID:capehill,项目名称:zodengine,代码行数:17,代码来源:omapobject.cpp

示例5: DoRenderEntries

void GWFactoryList::DoRenderEntries(ZMap &the_map, SDL_Surface *dest)
{
	int ty;

	ty = y + main_top_img.GetBaseSurface()->h;

	for(int ei=show_start_entry; ei<entry_list.size() && (ei-show_start_entry)<show_able_entries; ei++)
	{
		gwfl_render_entry *e = &entry_list[ei];
		int bx, by;

		//since it rendered put in its render locations
		e->x = 0;
		e->y = ty - y;
		e->h = main_entry_img.GetBaseSurface()->h;
		e->w = 120;

		//render its main peice
		the_map.RenderZSurface(&main_entry_img, x, ty);

		//begin rendering the labels
		bx = x + 12;
		by = ty + 7;

		for(int i=0;i<3;i++)
		{
			if(!e->colored[i])
				the_map.RenderZSurface(&entry_bar_grey_img, bx, by);
			else
			{
				if(e->percent[i] > 0.99)
					the_map.RenderZSurface(&entry_bar_green_img, bx, by);
				else
				{
					int gw;
					int wx;
					SDL_Rect from_rect, to_rect;

					gw = entry_bar_green_img.GetBaseSurface()->w * e->percent[i];

					if(gw <= 0) gw = 0;

					if(the_map.GetBlitInfo(entry_bar_green_img.GetBaseSurface(), bx, by, from_rect, to_rect))
					{
						if(from_rect.w > gw) from_rect.w = gw;

						entry_bar_green_img.BlitSurface(&from_rect, &to_rect);
					}

					//the white line
					wx = bx + gw - 1;
					if(wx < bx) wx = bx;
					the_map.RenderZSurface(&entry_bar_white_i_img, wx, by);
				}
			}

			//left text
			if(e->message_left[i].size())
			{
				ZSDL_Surface message_img;

				message_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(e->message_left[i].c_str()));

				the_map.RenderZSurface(&message_img, bx + 2, by + 3);
			}

			//right text
			if(e->message_right[i].size())
			{
				ZSDL_Surface message_img;

				message_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(e->message_right[i].c_str()));

				if(message_img.GetBaseSurface())
					the_map.RenderZSurface(&message_img, bx + 101 - message_img.GetBaseSurface()->w, by + 3);
			}

			by += 17;
		}

		ty += main_entry_img.GetBaseSurface()->h;
	}
}
开发者ID:Nitaym,项目名称:zodengine,代码行数:83,代码来源:gwfactory_list.cpp


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