Files
FreeJ/scripts/ruby/effect.rb
Alex Norman 251d788398 Ruby extensions
Created a separate file for ruby redefinitions and extensions of freej
methods.  removed the extensions hard coded into the ruby swig freej
library and instead load this file in that library [with error
checking].  Updated two example scripts to set paths correctly to use
this new setup [to test before installing].
Also included a .each method for Linkedlist
2009-06-22 12:24:34 -07:00

47 lines
997 B
Ruby
Executable File

#!/usr/bin/ruby
#for now update the load path to include the location of
#the freej module and freej_extensions [as we haven't installed it yet]
$: << '../../bindings/ruby/.libs'
$: << '../../bindings/ruby/'
##import the Freej module
require 'Freej'
# check that we have an argument
if ARGV.length < 1
puts "[!] this script needs an argument: file to play"
exit
end
#initializes Freej creating a Contex
cx = Freej::Context.new
#creates a screen of given size
scr = Freej::SdlScreen.new(400, 300)
#adds the screen
cx.add_screen(scr)
#refreshes the list of available filter effects
cx.plugger.refresh(cx)
#opens the file given on commandline as a layer
lay = cx.open(ARGV[0])
#gets the vertigo filter effect
filt = cx.filters["vertigo"]
#adds the filter to the layer if the filter was found
lay.add_filter( filt ) if filt
#start the layer thread
lay.start
#adds the layer to the Freej context
cx.add_layer(lay)
#fit the video layer to the screen
lay.fit
#start the context
cx.start