本文整理汇总了C++中graphicsLib::placeTile方法的典型用法代码示例。如果您正苦于以下问题:C++ graphicsLib::placeTile方法的具体用法?C++ graphicsLib::placeTile怎么用?C++ graphicsLib::placeTile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphicsLib
的用法示例。
在下文中一共展示了graphicsLib::placeTile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawMap
// ********************************************************************************************** //
// //
// ********************************************************************************************** //
void classMap::drawMap()
{
if (bg1_surface.width > 0 && game_data.stages[stage_number].maps[number].backgrounds[0].speed == 0.0) {
for (int i=0; i<mapSurface.width/bg1_surface.width+1; i++) {
graphLib.copyArea(st_position(i*bg1_surface.width, game_data.stages[stage_number].maps[number].backgrounds[0].adjust_y), &bg1_surface, &mapSurface);
}
bg1_surface.freeGraphic();
}
if (bg2_surface.width > 0 && game_data.stages[stage_number].maps[number].backgrounds[1].speed == 0.0) {
std::cout << "classmap::loadMap - showing bg2 as static" << std::endl;
for (int i=0; i<mapSurface.width/bg2_surface.width+1; i++) {
graphLib.copyArea(st_position(i*bg2_surface.width, game_data.stages[stage_number].maps[number].backgrounds[1].adjust_y), &bg2_surface, &mapSurface);
}
bg2_surface.freeGraphic();
}
struct st_position pos_origin;
struct st_position pos_destiny;
for (int i=0; i<MAP_W; i++) {
for (int j=0; j<MAP_H; j++) {
// level 1
pos_origin.x = map_tiles.tiles[i][j].tile1.x;
pos_origin.y = map_tiles.tiles[i][j].tile1.y;
pos_destiny.x = i*TILESIZE;
pos_destiny.y = j*TILESIZE;
graphLib.placeTile(pos_origin, pos_destiny, &mapSurface);
// level 2
pos_origin.x = map_tiles.tiles[i][j].tile2.x;
pos_origin.y = map_tiles.tiles[i][j].tile2.y;
graphLib.placeTile(pos_origin, pos_destiny, &mapSurface);
}
}
}
示例2: redraw_boss_door
/// @TODO: fix animation. investigate a better way for drawing it (code is way too confusing)
void classMap::redraw_boss_door(bool is_close, int nTiles, int tileX, short player_number) {
int k, tileCount;
//is_close = false; // THIS IS A TEMPORARY FIX
//std::cout << "classMap::redraw_boss_door - is_close: " << is_close << std::endl;
input.waitTime(10);
//for (k=0; k<tilePieces; k++) {
for (k=0; k<nTiles; k++) {
tileCount = nTiles;
//if (is_close == false) { std::cout << "classMap::redraw_boss_door - nTiles: " << nTiles << ", tilePieces: " << tilePieces << ", tileCount: " << tileCount << std::endl; }
// redraw screen
showMap();
graphLib.updateScreen();
int tiles_showed;
if (is_close == false) {
tiles_showed = k;
} else {
tiles_showed = 0;
}
for (int i=0; i<MAP_W; i++) {
for (int j=0; j<MAP_H; j++) {
if (map_tiles.tiles[i][j].tile3.x != -1 && map_tiles.tiles[i][j].tile3.y != -1) {
if (i == tileX && map_tiles.tiles[i][j].locked == TERRAIN_DOOR) {
//std::cout << "****** redraw_boss_door - k: " << k << ", tiles_showed: " << tiles_showed << ", nTiles: " << nTiles << std::endl;
if (is_close == false) {
if (tiles_showed < nTiles) {
graphLib.placeTile(st_position(map_tiles.tiles[i][j].tile3.x, map_tiles.tiles[i][j].tile3.y), st_position((i*TILESIZE)-scroll.x, (j*TILESIZE)-scroll.y), &graphLib.gameScreen);
graphLib.updateScreen();
tiles_showed++;
}
} else {
if (tiles_showed < k) {
graphLib.placeTile(st_position(map_tiles.tiles[i][j].tile3.x, map_tiles.tiles[i][j].tile3.y), st_position((i*TILESIZE)-scroll.x, (j*TILESIZE)-scroll.y), &graphLib.gameScreen);
graphLib.updateScreen();
tiles_showed++;
}
}
} else {
graphLib.placeTile(st_position(map_tiles.tiles[i][j].tile3.x, map_tiles.tiles[i][j].tile3.y), st_position((i*TILESIZE)+scroll.x, (j*TILESIZE)-scroll.y), &graphLib.gameScreen);
}
}
}
}
_player_list.at(0)->show();
graphLib.draw_hp_bar(_player_list.at(0)->get_current_hp(), player_number, WEAPON_DEFAULT);
//show_sprite(p1Obj->sprite, game_screen);
//draw_hp_bar(p1Obj);
graphLib.updateScreen();
input.waitTime(100);
}
input.waitTime(100);
}
示例3: showAbove
// ********************************************************************************************** //
// show the third level of tiles //
// ********************************************************************************************** //
void classMap::showAbove()
{
// draw 3rd tile level
struct st_position pos_origin;
struct st_position pos_destiny;
for (int i=0; i<MAP_W; i++) {
for (int j=0; j<MAP_H; j++) {
if (map_tiles.tiles[i][j].tile3.x != -1 && map_tiles.tiles[i][j].tile3.y != -1) {
pos_origin.x = map_tiles.tiles[i][j].tile3.x;
pos_origin.y = map_tiles.tiles[i][j].tile3.y;
pos_destiny.x = (i*TILESIZE)-scroll.x;
pos_destiny.y = (j*TILESIZE)-scroll.y;
graphLib.placeTile(pos_origin, pos_destiny, &graphLib.gameScreen);
}
}
}
}