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


C++ graphicsLib::clear_surface_area方法代码示例

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


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

示例1: draw_dynamic_backgrounds

void classMap::draw_dynamic_backgrounds()
{
	//std::cout << "classMap::draw_dynamic_backgrounds stage_number: " << stage_number << ", map_number: " << number << ", bg.r: " << game_data.stages[stage_number].maps[number].background_color.r << ", bg.g: " << game_data.stages[stage_number].maps[number].background_color.g << ", bg.b: " << game_data.stages[stage_number].maps[number].background_color.b << std::endl;
	graphLib.clear_surface_area(0, 0, mapSurface.width, mapSurface.height, game_data.stages[stage_number].maps[number].background_color.r, game_data.stages[stage_number].maps[number].background_color.g, game_data.stages[stage_number].maps[number].background_color.b, graphLib.gameScreen);
	if (bg1_surface.width > 0 && game_data.stages[stage_number].maps[number].backgrounds[0].speed != 0) {
		int repeat_n = RES_W/bg1_surface.width+1;
		if (repeat_n <= 2) {
			repeat_n = 3;
		}
		for (int i=-1; i<repeat_n; i++) {
			graphLib.copyArea(st_position(bg1_scroll+i*bg1_surface.width, game_data.stages[stage_number].maps[number].backgrounds[0].adjust_y), &bg1_surface, &graphLib.gameScreen);
		}
	}
	if (bg2_surface.width > 0 && game_data.stages[stage_number].maps[number].backgrounds[1].speed != 0) {
		int repeat_n = RES_W/bg2_surface.width+1;
		if (repeat_n <= 2) {
			repeat_n = 3;
		}
		//std::cout << "classmap::loadMap - showing bg2 as DYNAMIC - repeat_n: " << repeat_n << std::endl;
		for (int i=-1; i<repeat_n; i++) {
			//int pos_x = bg2_scroll+i*bg2_surface.width;
			//std::cout << "classMap::draw_dynamic_backgrounds - draw bg2 YES - bg2_scroll: " << bg2_scroll << ", pos_x: " << (bg2_scroll+i*bg2_surface.width) << ", width: " << bg2_surface.width << std::endl;
			graphLib.copyArea(st_position(bg2_scroll+i*bg2_surface.width, game_data.stages[stage_number].maps[number].backgrounds[1].adjust_y), &bg2_surface, &graphLib.gameScreen);
		}
	}
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:26,代码来源:classmap.cpp


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