mirror of
https://github.com/dyne/FreeJ.git
synced 2026-02-05 12:39:15 +01:00
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
27 lines
723 B
Ruby
Executable File
27 lines
723 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'
|
|
|
|
# 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)
|
|
# create an instance of a TextLayer
|
|
txt = Freej::TextLayer.new
|
|
# initializes the new layer with the freej context
|
|
txt.init(cx)
|
|
# writes the hello world text inside the layer
|
|
txt.write("Hello World!")
|
|
# start the layer
|
|
txt.start
|
|
# add the layer to the screen
|
|
cx.add_layer(txt)
|
|
# starts Freej
|
|
cx.start
|