class TyranoDsl::ExportGame::ElementsWriters::TitleScreenWriter
Write the title screen
Public Instance Methods
write(world)
click to toggle source
@param [TyranoDsl::Elements::World] world @return [Array]
# File lib/tyrano_dsl/export_game/elements_writers/title_screen_writer.rb, line 11 def write(world) log {'Writing title screen'} background = get_background(world) first_scene = get_first_scene(world) content_text_content = title_screen_content(background, first_scene) preload_text_content = preload_text([background.target_long_file_name]) [ TyranoDsl::ExportGame::FileActions::CreateFile.new( File.join('data', 'scenario', "title_screen.ks"), content_text_content ), TyranoDsl::ExportGame::FileActions::CreateFile.new( File.join('data', 'scenario', 'system', "_title_screen.ks"), preload_text_content ) ] end
Private Instance Methods
get_background(world)
click to toggle source
@param [TyranoDsl::Elements::World] world @return [TyranoDsl::Elements::Background]
# File lib/tyrano_dsl/export_game/elements_writers/title_screen_writer.rb, line 79 def get_background(world) background_name = world.title_screen.background unless background_name raise TyranoDsl::TyranoException, 'No background defined for the title screen' end world.backgrounds[background_name] end
get_first_scene(world)
click to toggle source
@param [TyranoDsl::Elements::World] world @return [TyranoDsl::Elements::Scene]
# File lib/tyrano_dsl/export_game/elements_writers/title_screen_writer.rb, line 69 def get_first_scene(world) first_scene_name = world.title_screen.first_scene_name unless first_scene_name raise TyranoDsl::TyranoException, 'No scene defined' end world.scenes[first_scene_name] end
title_screen_content(background, first_scene)
click to toggle source
@param [TyranoDsl::Elements::Background] background @param [TyranoDsl::Elements::Scene] first_scene
# File lib/tyrano_dsl/export_game/elements_writers/title_screen_writer.rb, line 35 def title_screen_content(background, first_scene) <<HEREDOC [_tb_system_call storage=system/_title_screen.ks] [hidemenubutton] [tb_keyconfig flag="0" ] [tb_hide_message_window ] [bg storage="#{background.target_short_file_name}" ] *title [glink text="New Game" x="600" y="370" target="*start" ] [glink text="Load Game" x="600" y="470" target="*load" ] [s ] *start [showmenubutton] [cm ] [tb_keyconfig flag="1" ] [jump storage="#{first_scene.target_name}.ks" target="" ] [s ] *load [cm ] [showload] [jump target="*title" storage="" ] [s ] HEREDOC end