영상

Avi 재생 스크립트! [고화질 재생 가능]

by 짭뿌C posted Oct 24, 2012
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

#===============================================================================
# By trebor777
# Date: 26/10/2008
# Version 1.5 - Updated 27/10/2008
#-------------------------------------------------------------------------------
# RMVX Avi Player
#
# Instructions:
#   Video Specification ( to ensure good playability )
#     Recommended encoding:  Xvid + MP3 CBR  (very important to keep a constant
#     bit rate for the audio, else it won't play it)
#     Video Resolution : Up to 640*480
#     Save the videos into a new folder called Movies in your project root folder.
#  
#   Call in an event(using the call script command) or in your script:
#    
#     Movie.play("myvideo",width,height)
#     Movie.play("myvideo")
#
#    By providing the dimensions of your video, if smaller than 640*480, the script
#    will stretch it in the window(or in the screen if in fullscreen), to fit a
#    width of 640px, but keeping the original aspect ratio.
#
#    Don't need to provide the dimensions if the video is 640*480.
#===============================================================================
module Movie
  attr_accessor :fps
  def self.play(movie, width=Graphics.width, height=Graphics.height)
    movie= "./Movies/#{movie}.avi"
    fps = 24
    readini= Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
    wnd= Win32API.new('user32','FindWindowEx','%w(l,l,p,p)','L')
    @mplayer= Win32API.new('winmm','mciSendString','%w(p,p,l,l)','V')
    @detector = Win32API.new('user32','GetSystemMetrics','%w(l)','L')
    timer= 1.0/fps
    info= " " * 255
    game_name= "\0" * 256
    readini.call('Game','Title','',game_name,255,".\\Game.ini")
    game_name.delete!("\0")
    hwnd= wnd.call(0,0,nil,game_name).to_s
    @mplayer.call("open #{movie} alias FILM style child parent #{hwnd}",0,0,0)
    @mplayer.call("status FILM length",info,255,0)
    movie_lenght = info.unpack("a*")[0].gsub!("\000","").to_i
    info= " " * 255
    @ratio = height.to_f/width
    @width = 0
    self.update_stretch
    @mplayer.call("play FILM window",0,0,0)
    loop do
      sleep(timer)
      Input.update
      update_stretch
      @mplayer.call("status FILM mode",info,255,0)
      s= info.unpack("a*")[0].gsub!("\000","")
      break if Input.repeat?(Input::B) or s.to_s == "stopped"
    end
    @mplayer.call("close FILM",0,0,0)
    Input.update
  end
  def self.update_stretch
    n_w = @detector.call(0)
    if @width != n_w
      @width = n_w
      w = (n_w == 544)? 544 : Graphics.width
      h = (n_w == 544)? 416 : Graphics.height
      new_height = (w*@ratio).round
      @mplayer.call("put FILM window at 0 #{(h-new_height)/2} #{w} #{new_height}",0,0,0)
    end
  end
end

 

http://www.youtube.com/watch?v=FnIos3gKytY

여기에서 찾았습니다~^^

하지만

대신 제가 설명해드리죠~^^

 

movie= "./Movies/#{movie}.avi"

이것은 게임프로젝트/Movies 폴더를 만들어야 하지요!

그리고 확장자는 avi로 해야되고요!

이 RPG VX 해상도가 544x416이니

동영상 크기는 당연히 544x416이여야 합니다!

 

그리고 동영상을 실행할려면

 

Movie.play("myvideo")

 

이런식으로 해야됩니다!

[이벤트 커맨드에 스크립트란 기능으로여~!]