void draw (View& view) 
  {    
    sprite.set_alpha ((life_time/max_life_time) * .3);
    sprite.set_scale (0.8f + ((1 - life_time/max_life_time)) * 4.0f,
		       0.8f + ((1 - life_time/max_life_time)) * 4.0f);
    sprite.set_angle(angle);
    view.get_sc().color().draw(sprite, pos.x, pos.y);
  }
예제 #2
0
void
TileMapPaintToolImpl::draw()
{
  TilemapLayer tilemap = TilemapLayer::current();

  if (tilemap.is_null())
    return;

  switch(mode)
  {
    case TileMapPaintToolImpl::SELECTING:
      if (CL_Keyboard::get_keycode(CL_KEY_LSHIFT))
        selection.draw(CL_Color(255,  128, 128, 100));
      else 
        selection.draw();
      break;
      
    default:
      int tile_size = tilemap.get_tileset().get_tile_size();

      // Draw the brush:
      for(int y = 0; y < brush.get_height(); ++y)
        for(int x = 0; x < brush.get_width(); ++x)
        {
          Tile* tile = tilemap.get_tileset().create(brush.at(x, y));
                
          if (tile)
          {
            CL_Sprite sprite = tile->get_sprite();
            sprite.set_alpha(0.5f);
            sprite.draw((current_tile.x + x) * tile_size, 
                        (current_tile.y + y) * tile_size);

            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 100));
          }
          else if (brush.is_opaque())
          {
            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 100));
          }
          else
          {
            CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, 
                                                   (current_tile.y + y) * tile_size),
                                          CL_Size(tile_size, tile_size)),
                                  CL_Color(255, 255, 255, 50));
          }
        }
      break;
  }
}
예제 #3
0
파일: icon.cpp 프로젝트: Flexlay/flexlay
void
IconImpl::draw()
{
  CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y());
  CL_Rect rect(CL_Point(0, 0), CL_Size(parent->get_width()-4, parent->get_height()-4));

  sprite.set_alignment(origin_center);

  if (is_enabled)
  {
    if (is_down)
    {
      Box::draw_button_down(rect);
    }
    else
    {
      if (parent->has_mouse_over())
      {
        if (down)
          Box::draw_button_down(rect);
        else
          Box::draw_button_up(rect);
      }
      else
        Box::draw_button_neutral(rect);
    }
    sprite.set_alpha(1.0f);
  }
  else
  {
    Box::draw_button_neutral(rect);
    sprite.set_alpha(0.3f);
  }
  sprite.draw((rect.get_width()+1)/2, (rect.get_height()+1)/2);
  CL_Display::pop_modelview();
}