diff options
| author | Jaromil <[email protected]> | 2010-10-18 11:51:04 (GMT) |
|---|---|---|
| committer | Jaromil <[email protected]> | 2010-10-18 11:51:04 (GMT) |
| commit | 8ddbc50d6eb4a54fc15cd99f1ca5e94e63eb18f0 (patch) | |
| tree | 273efaa056b47c8a70bdf32880a60c7681c28d1f | |
| parent | 1c2bf21a714f90d55c3adf34569d4a05324859f0 (diff) | |
| -rw-r--r-- | freej/python/controller.src | 20 | ||||
| -rw-r--r-- | freej/python/helloworld.src | 26 | ||||
| -rw-r--r-- | freej/python/playeffect.src | 33 |
3 files changed, 46 insertions, 33 deletions
diff --git a/freej/python/controller.src b/freej/python/controller.src index 57d39e5..e561c7e 100644 --- a/freej/python/controller.src +++ b/freej/python/controller.src @@ -1,10 +1,17 @@ +# FreeJ python - controller example +# system wide useful modules import threading import freej -# context and screen initialization -cx = freej.Context() -scr = freej.SdlScreen( 400, 300 ) +# initialize FreeJ creating a Contex +cx = freej.Context() + +# create an output Screen +scr = freej.SdlScreen() +scr.init(400, 300, 32) + +# adds the Screen to the Context cx.add_screen( scr ) @@ -35,16 +42,15 @@ f = Frame() f.i = 0 ### create a text layer inside the controller f.txt = freej.TextLayer() -f.txt.init(cx); +f.txt.init(); f.txt.write("Hello World!") f.txt.start(); -cx.add_layer(f.txt); +scr.add_layer(f.txt); -# register it on the current context +# register our Frame Trigger to the Context cx.register_controller(f) - # start running freej in a separate thread th = threading.Thread(target = cx.start , name = "freej") th.start(); diff --git a/freej/python/helloworld.src b/freej/python/helloworld.src index 8659db6..fe60a89 100644 --- a/freej/python/helloworld.src +++ b/freej/python/helloworld.src @@ -1,14 +1,20 @@ -# system wide useful modules -import threading -import time +# FreeJ python - hello world example +# load the FreeJ python extension import freej -# initializes FreeJ creating a Contex +# we make heavy use of multi-threading +import threading + +# initialize FreeJ creating a Contex cx = freej.Context() -# creates a screen of given size -scr = freej.SdlScreen( 400, 300 ) +# create an output Screen +scr = freej.SdlScreen() + +# initialized the Screen size +# wdt hgt bpp +scr.init(400, 300, 32) # adds the screen cx.add_screen(scr) @@ -16,17 +22,17 @@ cx.add_screen(scr) # create an instance of a TextLayer txt = freej.TextLayer() -# initializes the new layer with the freej context -txt.init(cx); +# initializes the new layer +txt.init(); # writes the hello world text inside the layer txt.write("Hello World!") -# start the layer +# start the layer thread txt.start(); # add the layer to the screen -cx.add_layer(txt); +scr.add_layer(txt); # starts freej in a separate thread th = threading.Thread(target = cx.start , name = "freej") diff --git a/freej/python/playeffect.src b/freej/python/playeffect.src index fa034a6..2340f8b 100644 --- a/freej/python/playeffect.src +++ b/freej/python/playeffect.src @@ -1,43 +1,44 @@ - # system wide useful modules +# FreeJ python - file play and filter example + import threading import time import sys import freej - # initializes FreeJ creating a Contex +# initialize FreeJ creating a Contex cx = freej.Context() - # creates a screen of given size -scr = freej.SdlScreen( 400, 300 ) +# create an output Screen +scr = freej.SdlScreen() +scr.init(400, 300, 32) - # adds the screen -cx.add_screen(scr) +# adds the Screen to the Context +cx.add_screen( scr ) - # refreshes the list of available filter effects +# refreshes the list of available filter effects cx.plugger.refresh(cx) - # check that we have an argument +# check that we have an argument if(sys.argv.__len__()<2): print "[!] this script needs an argument: file to play" quit() - # opens the file given on commandline as a layer +# opens the file given on commandline as a layer lay = cx.open(sys.argv[1]) - - # gets the vertigo filter effect +# gets the vertigo filter effect filt = cx.filters["vertigo"] - # adds the filter to the layer +# adds the filter to the layer lay.add_filter( filt ) - # start the layer thread +# start the layer thread lay.start() - # adds the layer to the freej context -cx.add_layer(lay) +# adds the layer to the freej context +scr.add_layer(lay) - # starts freej in a separate thread +# starts freej in a separate thread th = threading.Thread(target = cx.start , name = "freej") th.start(); |

