void MapHashTableBuildable::addItem( const Item* item ) {
   if ( item == NULL ) {
      return;
   }

   const GfxData* gfx = getGfxData( item );
   if ( gfx == NULL ) {
      return;
   }

   MC2BoundingBox box( false, false );
   gfx->getMC2BoundingBox( box );
   addItem( &box, item->getID() );
}
示例#2
0
void ToggleButton::paint(const nds::Rectangle & clip)
{
  const unsigned char * gfx = getGfxData();
  const unsigned short * palette = getPaletteData();

  nds::Canvas & canvas(nds::Canvas::instance());

  // paint gfx - a 16x16 graphic in sprite tile format (blocks of 8x8)
  for (int tile = 0; tile < 4; tile++)
  {
    int yi = m_bounds.y + ((tile/2)*8);
    int xi = m_bounds.x + ((tile&1)*8);
    for (int y = yi; y < yi+8; ++y)
    {
      for (int x = xi; x < xi+8; x++)
      {
        canvas.drawPixel(x, y, palette[*gfx++]);
      }
    }
  }
  m_dirty = false;
}