Autor=Sr.Batata
PRPlay Video
Introdução
Um sicript ca repruduz videos no RMXP
Como usa-lo
Usando esse codigo em chamar script em um evento
É ali q vc vai configura seu video e da seguinte forma
a = Nome do Arquivo
b = Scena que vc esta, se for em um mapa use:
c = Se podera sair do video, ao apertar Esc
d = Se vai executar em modo full screen
e = Se vai poder controlar o video, com F5 e F6
f F5 = Pause
F6 = Resume
g = (opcional) Resolução, são elas
PRResolutions::
R320x200x16
R320x200x32
R320x240x16
R320x240x32
R400x300x16
R400x300x32
R512x384x16
R512x384x32
R640x480x16
R640x480x32
R800x480x16
R800x480x32
R800x600x16
R800x600x32
R1024x768x16
R1024x768x32
R1152x864x16
R1152x864x32
R1280x768x16
R1280x768x32
R1280x1024x16
R1280x1024x32
R1600x1200x16
R1600x1200x32
h = (opcional) Volume, de 0 a 1000
i = (opcional) Posição do video
j = (opcional) Se vai Repetir, obs(So ative esta
opção junto com a opçao 'esc_exit'
se não o jogador nunca podera sair do video)
full_screen_on # Deicha seu projeto em full screen
full_screen_off # Deicha seu projeto em modo normal
ex: Para deichar em full crie um novo script abaixo deste
e coloque: full_screen_on
Onde colocar o video
Dentro da pasta do seu jogo crie uma pasta chamada Videos (Ex: Nomedoseujogo > Videos > Video)
lembrando que a pasta Videos onde deve coner os videos usados naum devem estar dentro de qualquer outra pasta somente da do seu jogo,
Nem da da graphics, nem audio nem data ela deve estar junto ao incone do projeto
Formatos
O PRPlay Video suporta os seguintes formatos:
MPEG, WMA, AVI
naum funciona 3pg
Script
http://www.4shared.com/file/121317974/4612b26c/PRPlay_Video_30.html
Creditos
Aos
Criadores: PR Coders
E a mim por postar
Sirbatata
Obs
Obs se aja tem esse script aki por favor me avisem
___________________________________________________________________________
PRPlay Video
Introdução
Um sicript ca repruduz videos no RMXP
Como usa-lo
Usando esse codigo em chamar script em um evento
- Código:
$scene = Scene_PRMovie.new(a, b, c, d, e, f, g, h, i, j)
É ali q vc vai configura seu video e da seguinte forma
a = Nome do Arquivo
b = Scena que vc esta, se for em um mapa use:
c = Se podera sair do video, ao apertar Esc
d = Se vai executar em modo full screen
e = Se vai poder controlar o video, com F5 e F6
f F5 = Pause
F6 = Resume
g = (opcional) Resolução, são elas
PRResolutions::
R320x200x16
R320x200x32
R320x240x16
R320x240x32
R400x300x16
R400x300x32
R512x384x16
R512x384x32
R640x480x16
R640x480x32
R800x480x16
R800x480x32
R800x600x16
R800x600x32
R1024x768x16
R1024x768x32
R1152x864x16
R1152x864x32
R1280x768x16
R1280x768x32
R1280x1024x16
R1280x1024x32
R1600x1200x16
R1600x1200x32
h = (opcional) Volume, de 0 a 1000
i = (opcional) Posição do video
j = (opcional) Se vai Repetir, obs(So ative esta
opção junto com a opçao 'esc_exit'
se não o jogador nunca podera sair do video)
full_screen_on # Deicha seu projeto em full screen
full_screen_off # Deicha seu projeto em modo normal
ex: Para deichar em full crie um novo script abaixo deste
e coloque: full_screen_on
Onde colocar o video
Dentro da pasta do seu jogo crie uma pasta chamada Videos (Ex: Nomedoseujogo > Videos > Video)
lembrando que a pasta Videos onde deve coner os videos usados naum devem estar dentro de qualquer outra pasta somente da do seu jogo,
Nem da da graphics, nem audio nem data ela deve estar junto ao incone do projeto
Formatos
O PRPlay Video suporta os seguintes formatos:
MPEG, WMA, AVI
naum funciona 3pg
Script
- Spoiler:
- Código:
##==============================================================================
##==============================================================================
##==============================================================================
##==============================================================================
## PR Coders Apresenta:
##
## PRPlay Video
##
## Criadores: PR Coders
##==============================================================================
##==============================================================================
## Verção: 3.0
## Data: 08/09/08
## Hora: 02:09
##==============================================================================
##==============================================================================
## Este Script, da a capacidade ao RPG XP a executar videos
## facilmente!!
##
## Strunçoes de uso:
##
## Para chamalo vc coloca no evento em chamar script, ou
## em scripts, acima do main:
## '$scene = Scene_PRMovie.new(a, b, c, d, e, f, g, h, i, j)'
##
## a = Nome do Arquivo
## b = Scena que vc esta, se for em um mapa use:
##
## "Scene_Map" obs(Em string e sem)
##
## Agora se quizer fazer uma apresentação no inicio no main
## apague o comando que ja existe la $scene = Scene_Map.new
## e coloque o :
## $scene = Scene_PRMovie.new(a, b, c, d, e, f, g, h, i, j)
## so que no 'b' vc usa "Scene_Title"
##
## c = Se podera sair do video, ao apertar Esc
## d = Se vai executar em modo full screen
## e = Se vai poder controlar o video, com F5 e F6
## f F5 = Pause
## F6 = Resume
##
## g = (opcional) Resolução, são elas
## PRResolutions::
##
## R320x200x16
## R320x200x32
## R320x240x16
## R320x240x32
## R400x300x16
## R400x300x32
## R512x384x16
## R512x384x32
## R640x480x16
## R640x480x32
## R800x480x16
## R800x480x32
## R800x600x16
## R800x600x32
## R1024x768x16
## R1024x768x32
## R1152x864x16
## R1152x864x32
## R1280x768x16
## R1280x768x32
## R1280x1024x16
## R1280x1024x32
## R1600x1200x16
## R1600x1200x32
##
## h = (opcional) Volume, de 0 a 1000
## i = (opcional) Posição do video
## j = (opcional) Se vai Repetir, obs(So ative esta
## opção junto com a opçao 'esc_exit'
## se não o jogador nunca podera sair do video)
##
## OBS(Logo abaixo tem assim 'FOLDER_NAME = "Videos"'
## la você muda a pasta do seus videos)
##
##
## Exemplo de uso em um evento em chmar script:
##
## $scene = Scene_PRMovie.new("exemplo", "Scene_Map", true,
## true, false, PRResolutions::R800x600x32, 1000, 0, false)
##
## Neste exemplo, eu executei o video , podendo ser fechado
## ao apertar 'Esc' ou B, em full screen, não podendo
## controlar o video, na resolução de 800 x 600 32, no
## volume maximo, posição inicial do video, e sem repetição
## quer dizer que quando acabar o video fecha a janela de video,
## e na hora que acabar o video vouta para "Scene_Map"
##
## Videos Testados:
##
## Funciona: MPEG, WMA, AVI
## Não Funciona: 3PG
##
## Duas novas funçoes adcionadas:
##
## full_screen_on # Deicha seu projeto em full screen
## full_screen_off # Deicha seu projeto em modo normal
##
## ex: Para deichar em full crie um novo script abaixo deste
## e coloque: full_screen_on
##==============================================================================
##==============================================================================
#==============================================================================
# PRPlay_Video
#------------------------------------------------------------------------------
# Abre, Executa e Finaliza o Video.
#==============================================================================
module PRPlay_Video
# Se vai ser executado em full screen
FOLDER_NAME = "Videos"
## Não troque nada daqui para baixo
@playing = false
@playing_filename = ""
@open = false
@pause = false
MciSendStr = Win32API.new("winmm", "mciSendString", "ppii", "i")
SetWindowText = Win32API.new("user32", "SetWindowTextA", "ip", "i")
$man = false
module_function
#--------------------------------------------------------------------------
# - Call MciSendStr
#--------------------------------------------------------------------------
def mciSendString(str1, str2, int1, int2)
MciSendStr.call(str1, str2, int1, int2)
end
#--------------------------------------------------------------------------
# - Abre um video
#--------------------------------------------------------------------------
def open(file_name)
@playing_filename = Dir.getwd + "/#{FOLDER_NAME}/#{file_name}"
@playing_filename = @playing_filename.gsub("/", "\")
@open = true
str = 'Open "' + @playing_filename + '" type mpegvideo alias media'
mciSendString(str, 0, 0, 0)
end
#--------------------------------------------------------------------------
# - Executa um Video
#--------------------------------------------------------------------------
def play(repeat=false, full=true)
return if [email=!@open]!@open[/email]
@playing = true
mciSendString(repeat ? "Play media REPEAT" : "Play media", 0, 0, 0)
SetWindowText.call(hwnd, Hwnd.game_name + " ")
@playing_filename = Hwnd.game_name + " "
end
#--------------------------------------------------------------------------
# - Id da janela do Video
#--------------------------------------------------------------------------
def hwnd
return if [email=!@playing]!@playing[/email]
Hwnd.hwnd_others_windows(@playing_filename)
end
#--------------------------------------------------------------------------
# - Status do Video
#--------------------------------------------------------------------------
def status
return if [email=!@playing]!@playing[/email]
buffer = "\0" * 256
mciSendString("status media mode", buffer, 256, 0)
buffer.delete("\0")
end
#--------------------------------------------------------------------------
# - Pausa o Video
#--------------------------------------------------------------------------
def pause
return if [email=!@playing]!@playing[/email] or @pause
@pause = true
mciSendString("Pause media", 0, 0, 0)
end
#--------------------------------------------------------------------------
# - Continua o Video
#--------------------------------------------------------------------------
def resume
return if [email=!@playing]!@playing[/email] or [email=!@pause]!@pause[/email]
mciSendString("Resume media", 0, 0, 0)
@pause = false
end
#--------------------------------------------------------------------------
# - Para o Video
#--------------------------------------------------------------------------
def stop
return if [email=!@playing]!@playing[/email]
@pause = false
mciSendString("Stop media", 0, 0, 0)
end
#--------------------------------------------------------------------------
# - Seta a Posição do video
#--------------------------------------------------------------------------
def set_position(pos)
return if [email=!@playing]!@playing[/email]
mciSendString("play media from " + pos.to_s, 0, 0, 0)
end
#--------------------------------------------------------------------------
# - Posição do Video
#--------------------------------------------------------------------------
def get_position
return 0 if [email=!@playing]!@playing[/email]
buffer = "\0" * 256
mciSendString("status media position", buffer, 256, 0)
buffer = buffer.delete("\0").to_i
buffer
end
#--------------------------------------------------------------------------
# - Duração
#--------------------------------------------------------------------------
def duration
return 0 if [email=!@playing]!@playing[/email]
buffer = "\0" * 256
mciSendString("status media length", buffer, 256, 0)
buffer = buffer.delete("\0").to_i
buffer
end
#--------------------------------------------------------------------------
# - Seta Volume
#--------------------------------------------------------------------------
def set_volume(volume)
return if [email=!@playing]!@playing[/email]
volume = [volume, 1000].min
mciSendString("setaudio media volume to " + volume.to_s, 0, 0, 0)
end
#--------------------------------------------------------------------------
# - Volume
#--------------------------------------------------------------------------
def get_volume
return 0 if [email=!@playing]!@playing[/email]
buffer = "\0" * 256
mciSendString("status media volume", buffer, 256, 0)
buffer = buffer.delete("\0").to_i
buffer
end
#--------------------------------------------------------------------------
# - Fecha o Video
#--------------------------------------------------------------------------
def close
return if [email=!@playing]!@playing[/email] or [email=!@open]!@open[/email]
@open = false
@playing = false
mciSendString("close media", 0, 0, 0)
end
end
#==============================================================================
# Hwnd
#------------------------------------------------------------------------------
# Pega o ID da janela do projeto.
#==============================================================================
module Hwnd
Readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
Findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
module_function
#--------------------------------------------------------------------------
# - Nome da Janela
#--------------------------------------------------------------------------
def game_name
game_name = "\0" * 256
Readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
end
#--------------------------------------------------------------------------
# - Hwnd
#--------------------------------------------------------------------------
def hwnd
return Findwindow.call('RGSS Player', self.game_name)
end
#--------------------------------------------------------------------------
# - Hwnd de outra janela
#--------------------------------------------------------------------------
def hwnd_others_windows(window_name)
return Findwindow.call(0, window_name)
end
end
#==============================================================================
# PRResoulution
#------------------------------------------------------------------------------
# Resolução.
#==============================================================================
class PRResoulution
attr_reader :res_width
attr_reader :res_height
attr_reader :color_deph
#--------------------------------------------------------------------------
# - Inicialização dos Objetos
#--------------------------------------------------------------------------
def initialize(resw, resh, cdeph)
@res_width = resw
@res_height = resh
@color_deph = cdeph
end
end
#==============================================================================
# PRResolutions
#------------------------------------------------------------------------------
# Resoluções.
#==============================================================================
module PRResolutions
R320x200x16 = PRResoulution.new(320, 200, 16)
R320x200x32 = PRResoulution.new(320, 200, 32)
R320x240x16 = PRResoulution.new(320, 240, 16)
R320x240x32 = PRResoulution.new(320, 240, 32)
R400x300x16 = PRResoulution.new(400, 300, 16)
R400x300x32 = PRResoulution.new(400, 300, 32)
R512x384x16 = PRResoulution.new(512, 384, 16)
R512x384x32 = PRResoulution.new(512, 384, 32)
R640x480x16 = PRResoulution.new(640, 480, 16)
R640x480x32 = PRResoulution.new(640, 480, 32)
R800x480x16 = PRResoulution.new(800, 480, 16)
R800x480x32 = PRResoulution.new(800, 480, 32)
R800x600x16 = PRResoulution.new(800, 600, 16)
R800x600x32 = PRResoulution.new(800, 600, 32)
R1024x768x16 = PRResoulution.new(1024, 768, 16)
R1024x768x32 = PRResoulution.new(1024, 768, 32)
R1152x864x16 = PRResoulution.new(1152, 864, 16)
R1152x864x32 = PRResoulution.new(1152, 864, 32)
R1280x768x16 = PRResoulution.new(1128, 768, 16)
R1280x768x32 = PRResoulution.new(1128, 768, 32)
R1280x1024x16 = PRResoulution.new(1280, 1024, 16)
R1280x1024x32 = PRResoulution.new(1280, 1024, 32)
R1600x1200x16 = PRResoulution.new(1600, 1200, 16)
R1600x1200x32 = PRResoulution.new(1600, 1200, 32)
end
#==============================================================================
# PRFull_Screen
#------------------------------------------------------------------------------
# Deicha uma janela em Full Screen.
#==============================================================================
module PRFull_Screen
@hwnd_full_screen = {}
@windows_info = []
PRSetDisplayScreen = Win32API.new("PRFullScreen", "PRSetDisplayScreen", "iii", "i")
PRFullScreenOn = Win32API.new("PRFullScreen", "PRFullScreenON", "iii", "i")
PRFullScreenOff = Win32API.new("PRFullScreen", "PRFullScreenOFF", "iiiii", "i")
SForegroundW = Win32API.new("user32", "SetForegroundWindow", "i", "i")
GetWindowRect = Win32API.new("user32", "GetWindowRect", "ip", "i")
WindowTop = Win32API.new("PRFullScreen", "WindowTop", "i", "i")
ShowWindow = Win32API.new("user32", "ShowWindow", "ii", "i")
SetWindowPos = Win32API.new("user32", "SetWindowPos", "iiiiiii", "i")
SetWindowStyle = Win32API.new("PRFullScreen", "SetWindowStyle", "i", "i")
SW_SHOW = 5
SW_HIDE = 0
module_function
#--------------------------------------------------------------------------
# - Rect da Janela
#--------------------------------------------------------------------------
def rect(hwnd)
rect = [0, 0, 0, 0].pack("i*")
GetWindowRect.call(hwnd, rect)
rect = rect.unpack("iiii")
Rect.new(rect[0], rect[1], rect[2] - rect[0], rect[3] - rect[1])
end
#--------------------------------------------------------------------------
# - Full Screen ON
#--------------------------------------------------------------------------
def full_screen_on(hwnd, res, set_display=true)
if set_display
if PRSetDisplayScreen.call(res.res_width, res.res_height, res.color_deph) == 1
p "Esta resolução não é suportada!"
exit
end
end
@hwnd_full_screen[hwnd] = true
@windows_info[hwnd] = rect(hwnd)
PRFullScreenOn.call(hwnd, res.res_width, res.res_height)
end
#--------------------------------------------------------------------------
# - Full Screen OFF
#--------------------------------------------------------------------------
def full_screen_off(hwnd)
if hwnd == nil
PRFullScreenOff.call(0, 0, 0, 0, 0)
return
end
@hwnd_full_screen[hwnd] = false
rect = @windows_info[hwnd]
PRFullScreenOff.call(hwnd, rect.x, rect.y, rect.width, rect.height)
end
#--------------------------------------------------------------------------
# - Ativa a janela do projeto
#--------------------------------------------------------------------------
def active_project_window
SForegroundW.call(Hwnd.hwnd)
end
#--------------------------------------------------------------------------
# - Coloca a janela do video no Topo
#--------------------------------------------------------------------------
def active_video_window_top
WindowTop.call(PRPlay_Video.hwnd)
end
#--------------------------------------------------------------------------
# - Exibe a janela
#--------------------------------------------------------------------------
def show_window
ShowWindow.call(Hwnd.hwnd, SW_SHOW)
end
#--------------------------------------------------------------------------
# - Esconde a janela
#--------------------------------------------------------------------------
def hide_window
ShowWindow.call(Hwnd.hwnd, SW_HIDE)
end
#--------------------------------------------------------------------------
# - Reposicionando a janela
#--------------------------------------------------------------------------
def position(hwnd, rect)
SetWindowPos.call(hwnd, 0, rect.x, rect.y, rect.width, rect.height, 0)
end
#--------------------------------------------------------------------------
# - Desativa o Fechar da janela
#--------------------------------------------------------------------------
def desative_close(hwnd)
SetWindowStyle.call(hwnd)
end
end
#==============================================================================
# Scene_PRMovie
#------------------------------------------------------------------------------
# Executa videos.
#==============================================================================
class Scene_PRMovie
#--------------------------------------------------------------------------
# - Inicialização dos Objetos
#--------------------------------------------------------------------------
def initialize(file_name, prs, esc_exit, full_screen, control,
res = PRResolutions::R640x480x32, vol = 1000, pos = 0, repeat = false)
@esc_exit = esc_exit
@full_screen = full_screen
@control = control
@res = res
@vol = vol
@pos = pos
@repeat = repeat
@prs = prs
PRPlay_Video.open(file_name)
end
#--------------------------------------------------------------------------
# - Processamento Principal
#--------------------------------------------------------------------------
def main
# Executa o Video
PRPlay_Video.play(@repeat, @full_screen)
PRPlay_Video.set_volume(@vol)
PRPlay_Video.set_position([@pos, PRPlay_Video.duration].min)
# Full Screen
PRFull_Screen.desative_close(PRPlay_Video.hwnd)
if @full_screen
PRFull_Screen.full_screen_on(Hwnd.hwnd, @res)
PRFull_Screen.full_screen_on(PRPlay_Video.hwnd, @res, false)
else
PRFull_Screen.active_video_window_top
end
if !$man and [email=!@full_screen]!@full_screen[/email]
@pos = PRFull_Screen.rect(Hwnd.hwnd)
PRFull_Screen.position(PRPlay_Video.hwnd, @pos)
PRFull_Screen.hide_window
end
# Executar transição
Graphics.transition
# Loop principal
loop do
# Atualizar a tela de jogo
Graphics.update
# Atualizar a entrada de informações
Input.update
# Atualizar Frame
update
# Abortar loop se a tela for alterada
if $scene != self
break
end
end
# Preparar para transição
Graphics.freeze
# Finaliza o Video
PRPlay_Video.close
# Finaliza o Full Screen
if !$man and [email=!@full_screen]!@full_screen[/email]
PRFull_Screen.show_window
PRFull_Screen.position(Hwnd.hwnd, @pos)
end
if @full_screen
if !$man
PRFull_Screen.full_screen_off(Hwnd.hwnd)
PRFull_Screen.full_screen_off(nil)
else
PRFull_Screen.full_screen_on(Hwnd.hwnd, PRResolutions::R640x480x32)
end
end
PRFull_Screen.active_project_window
end
#--------------------------------------------------------------------------
# - Atualização do Frame
#--------------------------------------------------------------------------
def update
status = PRPlay_Video.status
if (@esc_exit and Input.trigger?(Input::B)) or
(status == "" or status == "stopped")
$scene = eval(@prs + ".new")
return
end
if @control
if Input.trigger?(Input::F5)
PRPlay_Video.pause
end
if Input.trigger?(Input::F6)
PRPlay_Video.resume
end
end
end
end
#--------------------------------------------------------------------------
# - Disable Alt
#--------------------------------------------------------------------------
module Input
class << self
alias altkey_update update
KBE = Win32API.new('user32', 'keybd_event', 'LLLL', '')
def update
altkey_update
KBE.call(0x12, 0, 2, 0)
end
end
end
#--------------------------------------------------------------------------
# - Full Screen ON
#--------------------------------------------------------------------------
def full_screen_on
return if $man
$man = true
PRFull_Screen.full_screen_on(Hwnd.hwnd,
PRResolutions::R640x480x32)
end
#--------------------------------------------------------------------------
# - Full Screen OFF
#--------------------------------------------------------------------------
def full_screen_off
return if !$man
$man = false
PRFull_Screen.full_screen_off(Hwnd.hwnd)
end
http://www.4shared.com/file/121317974/4612b26c/PRPlay_Video_30.html
Creditos
Aos
Criadores: PR Coders
E a mim por postar
Sirbatata
Obs
Obs se aja tem esse script aki por favor me avisem
___________________________________________________________________________