#==============================================================================

# GIFFile 클래스

#------------------------------------------------------------------------------


class GIFFile

  #--------------------------------------------------------------------------

  # ● 클래스 변수

  #--------------------------------------------------------------------------

  begin

    @@loader = Win32API.new('wfbitmap','gifLoader',%w(p i p p p p),'l').freeze

    @@load = Win32API.new('wfbitmap','gifLoadImage',%w(l i),'l').freeze

    @@count = Win32API.new('wfbitmap','gifImageCount','v','l').freeze

    @@close = Win32API.new('wfbitmap','GifClose','v','v').freeze

  rescue Exception

    raise if debug?

    raise(LoadError,"cannot read modules.(wfbitmap.dll)")

  end

  #--------------------------------------------------------------------------

  # ● 상수

  #--------------------------------------------------------------------------

  RGSSA_FILE = rpgvx? ? (rpgvxace? ? "Game.rgss3a" : "Game.rgss2a") : 

               "Game.rgssad"

  RGSSA_VERSION = rpgvx? ? (rpgvxace? ? 1 : 2) : 3

  #--------------------------------------------------------------------------

  # ● 공개 인스턴스 변수

  #--------------------------------------------------------------------------

  attr_reader :bitmap

  attr_reader :count

  #--------------------------------------------------------------------------

  # ● 객체 초기화

  #--------------------------------------------------------------------------

  def initialize( giffile )

    w = "\x00" * 2

    h = "\x00" * 2

    @loaded = false

    begin

      infile = giffile.gsub(/\//){ "\\" }

      i = @@loader.call(RGSSA_FILE,RGSSA_VERSION,

                        infile,String.utf82ansi(infile), w , h )

      raise(Errno::ENOENT,infile) if i < 0

      @loaded = true

      @count = @@count.call()

      width = w.unpack("S").first

      height = h.unpack("S").first

      @bitmap = Array.new( @count ){ Bitmap.new( width , height ) }

      i = 0

      for bitmap in @bitmap

        @@load.call( bitmap.object_id , i )

        i += 1

      end

    ensure

      @@close.call() if @loaded

    end

  end

  #--------------------------------------------------------------------------

  # ● 해방

  #--------------------------------------------------------------------------

  def dispose

    for bitmap in @bitmap

      bitmap.dispose

    end

  end

end


#==============================================================================

# GifSprite 클래스

#------------------------------------------------------------------------------


class GifSprite < Sprite

  #--------------------------------------------------------------------------

  # ●객체 초기화

  #--------------------------------------------------------------------------

  def initialize( giffile , wait = 1 , viewport = nil)

    super(viewport)

    @gif = GIFFile.new( giffile )

    @wait = wait

    self.bitmap = @gif.bitmap.at(0)

    @_count = 0

    @_index = 0

  end

  #--------------------------------------------------------------------------

  # ● 해방

  #--------------------------------------------------------------------------

  def dispose

    @gif.dispose

    super

  end

  #--------------------------------------------------------------------------

  # ● 프레임 업데이트

  #--------------------------------------------------------------------------

  def update

    super

    @_count += 1

    if @_count >= @wait

      @_index += 1

      @_index %= @gif.count

      self.bitmap = @gif.bitmap.at(@_index)

      @_count = 0 

    end

  end

end







요약: 1. GIF 이미지를 출력하는 스크립트인데

      2. 뭐라고 써야 시동되는지 몰라서

      3. 5시간째 이거저거 시도해보면서 헤매고있음



아시는분 도와주세요 ㅠ