Skip to content

Instantly share code, notes, and snippets.

@sgallese
Created October 28, 2009 21:48
Show Gist options
  • Save sgallese/220884 to your computer and use it in GitHub Desktop.
Save sgallese/220884 to your computer and use it in GitHub Desktop.
@points = [
[-0.42857146,0.42857146],
[1.0357141,-3.982143],
[0.5,-0.19642878],
[1.8392859,0.32142854],
[2.642857,1.5178571],
[3.9642859,-1.0],
]
require 'rubygems'
require 'builder'
load 'pointdata.rb'
#Make new XML object named x
x = Builder::XmlMarkup.new(:target => $stdout, :indent => 1)
#Make basic XML outline
x.instruct!
x.Story(:version => 8, :last_xpath => "/Story/ObjectRoot/Object[2]") {
x.ObjectRoot{
x.Object( :name => "Start" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(3.0, -1.0, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Start Now")
}
}
x.LinkRoot{
x.Link{
x.Enabled( "true" )
x.RemainEnabled( "true")
x.EnabledColor( "0, 128, 255" )
x.SelectedColor( "255, 0, 0")
x.Actions{
x.TimerChange( :name => "startTimeline" ){
x.start
}
x.Clicks{
x.Any
}
}
}
}
}
x.Object( :name => "Restart" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(3.0, -1.5, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Restart")
}
}
x.LinkRoot{
x.Link{
x.Enabled( "true" )
x.RemainEnabled( "true")
x.EnabledColor( "0, 128, 255" )
x.SelectedColor( "255, 0, 0")
x.Actions{
x.Restart
x.Clicks{
x.Any
}
}
}
}
}
x.Object( :name => "Event Enabled" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(2.5, -2.0, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Event Enabled")
}
}
}
x.Object( :name => "Top-Right" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(3.25, 3.5, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Top-Right")
}
}
}
x.Object( :name => "Bottom-Right" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(3.25, -3.5, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Bottom-Right")
}
}
}
x.Object( :name => "Bottom-Left" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(-3.25, -3.5, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Bottom-Left")
}
}
}
x.Object( :name => "Top-Left" ){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(-3.25, 3.5, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("Top-Left")
}
}
}
x.Object( :name => "You Are Here"){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("1.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(0.0, 1.0, 2.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text("A")
}
}
}
x.Object( :name => "bgImage"){
x.Visible("true")
x.Color("255,255,255")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("8.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(0.0, 0.0, -4.0)")
}
x.Content{
x.Image( :filename => "./square.png")
}
}
pointCount = 0
@points.each do | point |
x.Object( :name => "point#{pointCount.to_s}"){
x.Visible("true")
x.Color("255,0,0")
x.Lighting("false")
x.ClickThrough("false")
x.AroundSelfAxis("false")
x.Scale("5.0")
x.Placement{
x.RelativeTo("Center")
x.Position("(#{point[0].to_s}, #{(point[1]+0.3).to_s}, -4.0)")
}
x.Content{
x.Text( "horiz-align" => "center", "vert-align" => "center", :font => "Courier.ttf", :depth => "0.0"){
x.text(".")
}
}
}
pointCount += 1
end
}
# x.GroupRoot{
# x.Group(:name => "myObjects"){
# x.Objects( :name => "object1" )
# }
# }
# x.TimelineRoot{
# x.Timeline( :name => "startTimeline", "start-immediately" => "false"){
# x.TimedActions( "seconds-time" => "0.0" ){
# }
# }
# }
x.PlacementRoot{
x.Placement(:name => "Center"){
x.RelativeTo("Center")
x.Position("(0.0, 0.0, 0.0)")
x.Axis(:rotation => "(0.0, 1.0, 0.0)", :angle => "0.0")
}
x.Placement(:name => "FrontWall"){
x.RelativeTo("Center")
x.Position("(0.0, 0.0, -4.0)")
x.LookAt(:target => "(0.0, 0.0, 0.0)", :up => "(0.0, 1.0, 0.0)")
}
x.Placement(:name => "LeftWall"){
x.RelativeTo("Center")
x.Position("(-4.0, 0.0, 0.0)")
x.LookAt(:target => "(0.0, 0.0, 0.0)", :up => "(0.0, 1.0, 0.0)")
}
x.Placement(:name => "RightWall"){
x.RelativeTo("Center")
x.Position("(4.0, 0.0, 0.0)")
x.LookAt(:target => "(0.0, 0.0, 0.0)", :up => "(0.0, 1.0, 0.0)")
}
x.Placement(:name => "FloorWall"){
x.RelativeTo("Center")
x.Position("(0.0, -4.0, 0.0)")
x.LookAt(:target => "(0.0, 0.0, 0.0)", :up => "(0.0, 0.0, -1.0)")
}
}
x.Global{
x.CameraPos( "far-clip" => "100.0" ){
x.Placement{
x.RelativeTo("Center")
x.Position("(0.0, 0.0, 6.0)")
}
}
x.CaveCameraPos( "far-clip" => "100.0" ){
x.Placement{
x.RelativeTo("Center")
x.Position("(0.0, 0.0, 0.0)")
}
}
x.Background( :color => "(0, 0, 0)" )
x.WandNavigation( "allow-rotation" => "false", "allow-movement" => "false" )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment