-- User interface version of Snake. Mostly fills in display
-- issues like colors, bitmaps, how to appear and disappear,
-- but also handles the timer.

class V_SNAKE

inherit

  V_CHANGELING
  rename
    clear as vt_clear
  undefine
    react, on_paint, init,
    create_record, build_record, vacate
  redefine
    northwest, room, egg
  end

  V_SESSILE
  rename
    make as vgp_make
  undefine
    react, receive_bullet, clear, restart, init,
    create_record, build_record, customized_init,
    raise, vacate
  redefine
    northwest, room
  end

  SNAKE
  redefine
    clear, northwest, room, egg
  select
    clear
  end

creation

  make, make_customized

feature{NONE}

  make( s : STRING ; vgr : V_GAME_ROOM ; c : V_GAME_CELL ) is
  do
    vgp_make( s, vgr, c )
  end

  get_bitmaps is
  do
    east := configuration.game_snake_east_pixmap( Current )
    west := configuration.game_snake_west_pixmap( Current )
    bitmap := east
  end

  get_id is
  do
    id := configuration.snake_code
  end

  east, west : WEL_BITMAP

  display_east is
  do
    if bitmap /= east then
      bitmap := east
      invalidate
    end
  end

  display_west is
  do
    if bitmap /= west then
     bitmap := west
      invalidate
    end
  end

feature

  egg : V_EGG
  northwest : V_GAME_CELL
  room : V_GAME_ROOM

  clear is
  do
    vt_clear
    destroy
  end

end 
