本文整理汇总了C++中Graphic::blit方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphic::blit方法的具体用法?C++ Graphic::blit怎么用?C++ Graphic::blit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphic
的用法示例。
在下文中一共展示了Graphic::blit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderTiles
void VRAMEditorLayeredGraphicScene::renderTiles(
Graphic& g,
int tileIndex,
GGTileSet& tiles,
GGPalette& palette,
Graphic::TileTransferTransOption tileTransOption) {
// Render each tile and blit to Graphic
for (int j = 0; j < tiles.numTiles(); j++) {
// Render tile
Graphic tileGraphic(tiles[j],
palette,
tileTransOption);
// Calculate position in Graphic
int xPos = tileIndexToXPos(tileIndex);
int yPos = tileIndexToYPos(tileIndex);
// Blit if transparency is enabled; copy otherwise
if (tileTransOption == Graphic::tileTrans) {
g.blit(tileGraphic,
Box(xPos, yPos, 0, 0),
Graphic::noTransUpdate);
}
else {
g.copy(tileGraphic,
Box(xPos, yPos, 0, 0),
Graphic::noTransUpdate);
}
// Move to next tile position
++tileIndex;
}
}
示例2: drawMetatile
void LevelEffectGraphicSceneLayer::drawMetatile(
Graphic& drawSurf,
int metatileID,
int baseDrawX,
int baseDrawY) {
drawSurf.blit(metatileCache_[(int)metatileID],
Box(baseDrawX,
baseDrawY,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::noTransUpdate);
}
示例3: renderTiles
void VRAMCache::renderTiles(Graphic& g,
int tileIndex,
GGTileSet& tiles,
GGPalette& palette,
Graphic::TileTransferTransOption tileTransOption) {
// Render each tile and blit to Graphic
for (int j = 0; j < tiles.numTiles(); j++) {
// Render tile
Graphic tileGraphic(tiles[j],
palette,
tileTransOption);
// Calculate position in Graphic
int xPos = tileIndex * GGTile::width;
int yPos = 0;
// Clear the tiles before writing to them to avoid leaving
// artifacts from previous contents (due to our program's
// different concept of transparency from the hardware)
g.fillRect(xPos, yPos, GGTile::width, GGTile::height,
Color(0xFF, 0xFF, 0xFF, Color::fullAlphaTransparency),
Graphic::noTransUpdate);
// Blit if transparency is enabled; copy otherwise
if (tileTransOption == Graphic::tileTrans) {
g.blit(tileGraphic,
Box(xPos, yPos, 0, 0),
Graphic::transUpdate);
}
else {
g.copy(tileGraphic,
Box(xPos, yPos, 0, 0),
Graphic::transUpdate);
}
// Move to next tile position
++tileIndex;
}
}
示例4: render
void MetatilePickerLayeredGraphicScene::render(Graphic& dst,
Box srcbox,
double scale) {
dst.clear();
int metatileNum = 0;
for (int j = 0; j < metatilesPerColumn_; j++) {
for (int i = 0; i < metatilesPerRow_; i++) {
if (bgLayerEnabled_) {
dst.blit(metatilesVisualBG_[metatileNum],
Box(i * MetatileStructure::metatileWidth,
j * MetatileStructure::metatileHeight,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::transUpdate);
}
if (fgLayerEnabled_) {
dst.blit(metatilesVisualFG_[metatileNum],
Box(i * MetatileStructure::metatileWidth,
j * MetatileStructure::metatileHeight,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::transUpdate);
}
if (effectLayerEnabled_) {
dst.blit(metatilesEffect_[metatileNum],
Box(i * MetatileStructure::metatileWidth,
j * MetatileStructure::metatileHeight,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::noTransUpdate);
}
if (verticalSolidityLayerEnabled_) {
dst.blit(metatilesVerticalSolidity_[metatileNum],
Box(i * MetatileStructure::metatileWidth,
j * MetatileStructure::metatileHeight,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::noTransUpdate);
}
if (horizontalSolidityLayerEnabled_) {
dst.blit(metatilesHorizontalSolidity_[metatileNum],
Box(i * MetatileStructure::metatileWidth,
j * MetatileStructure::metatileHeight,
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight),
Graphic::noTransUpdate);
}
++metatileNum;
}
}
if (gridLayerEnabled_) {
gridLayer_.render(dst,
Box(srcbox.x(),
srcbox.y(),
dst.w(),
dst.h()),
1.00);
}
if ((highlightedMetatileBoxEnabled_)) {
dst.drawRectBorder(metatileIndexToX(highlightedMetatileIndex_),
metatileIndexToY(highlightedMetatileIndex_),
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight,
Color(0xFF, 0xFF, 0x00, Color::fullAlphaOpacity),
2);
}
if ((toolManager_->currentTool() == LevelEditorTools::metatilePaint)) {
dst.drawRectBorder(metatileIndexToX(toolManager_->pickedMetatileIndex()),
metatileIndexToY(toolManager_->pickedMetatileIndex()),
MetatileStructure::metatileWidth,
MetatileStructure::metatileHeight,
Color(0xFF, 0x00, 0x00, Color::fullAlphaOpacity),
2);
}
}