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


C++ Graphic::fillRect方法代码示例

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


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

示例1: 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;
    }
}
开发者ID:suppertails66,项目名称:tales,代码行数:39,代码来源:VRAMCache.cpp

示例2: drawMetatileEffect


//.........这里部分代码省略.........
    metatileGraphic.clear(
      Color(0x00, 0x00, 0x00, Color::fullAlphaOpacity));
    for (int j = 0; j < 16; j += 2) {
      for (int k = 0; k < 16; k += 2) {
        if ((!(j % 4))) {
          // x is even: skip if y is odd
          if (((k % 4))) {
            continue;
          }
        }
        else {
          // x is odd: skip if y is even
          if ((!(k % 4))) {
            continue;
          }
        }
        
        metatileGraphic.setPixel(j, k, Color(0xFF, 0xFF, 0xFF,
                                             Color::fullAlphaOpacity));
        metatileGraphic.setPixel(j + 1, k, Color(0xFF, 0xFF, 0xFF,
                                             Color::fullAlphaOpacity));
        metatileGraphic.setPixel(j, k + 1, Color(0xFF, 0xFF, 0xFF,
                                             Color::fullAlphaOpacity));
        metatileGraphic.setPixel(j + 1, k + 1, Color(0xFF, 0xFF, 0xFF,
                                             Color::fullAlphaOpacity));
      }
    }
    break;
  case MetatileTypes::bombable:
    metatileGraphic.clear(
      Color(0xFF, 0x80, 0x00, Color::fullAlphaOpacity));
    // large bomb
    if ((indexNum == 0x63) || (indexNum == 0x64) || (indexNum == 0x65)) {
      metatileGraphic.fillRect(3, 5, 11, 10, 
                               Color(0, 0, 0, Color::fullAlphaOpacity),
                               Graphic::noTransUpdate);
      metatileGraphic.drawLine(8, 5,
                               8, 2,
                               Color(0, 0, 0, Color::fullAlphaOpacity),
                               1);
    }
    // regular bomb
    else {
      metatileGraphic.fillRect(5, 5, 7, 7, 
                               Color(0, 0, 0, Color::fullAlphaOpacity),
                               Graphic::noTransUpdate);
      metatileGraphic.drawLine(8, 5,
                               8, 2,
                               Color(0, 0, 0, Color::fullAlphaOpacity),
                               1);
    }
    
    // ring
    if (indexNum == 0x9E) {
      metatileGraphic.drawRectBorder(7, 7, 3, 3,
                               Color(0xFF, 0xFF, 0, Color::fullAlphaOpacity),
                               1,
                               Graphic::noTransUpdate);
    }
    break;
  case MetatileTypes::conveyorRight:
    metatileGraphic.clear(
      Color(0x80, 0x00, 0x80, Color::fullAlphaOpacity));
    switch (indexNum) {
    case 0x74:
      metatileGraphic.drawLine(0, 8,
开发者ID:suppertails66,项目名称:tales,代码行数:67,代码来源:LevelEffectGraphicSceneLayer.cpp


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