Class: Burn::Generator::Rom::AssemblySoundEffect
- Inherits:
-
Object
- Object
- Burn::Generator::Rom::AssemblySoundEffect
- Includes:
- Debug
- Defined in:
- lib/burn/generator/rom/assembly_sound_effect.rb
Instance Attribute Summary collapse
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
- #generate ⇒ Object
- #get_context ⇒ Object
-
#initialize(workspace_root) ⇒ AssemblySoundEffect
constructor
A new instance of AssemblySoundEffect.
Methods included from Debug
Constructor Details
#initialize(workspace_root) ⇒ AssemblySoundEffect
Returns a new instance of AssemblySoundEffect.
8 9 10 11 12 13 14 15 |
# File 'lib/burn/generator/rom/assembly_sound_effect.rb', line 8 def initialize(workspace_root) # Generic @workspace_root = workspace_root # Music related @resources = {} end |
Instance Attribute Details
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
6 7 8 |
# File 'lib/burn/generator/rom/assembly_sound_effect.rb', line 6 def resources @resources end |
Instance Method Details
#generate ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/burn/generator/rom/assembly_sound_effect.rb', line 21 def generate # prepare sound.s - sound effect assembler file File.write( "#{@workspace_root}/tmp/burn/asset/sounds.s", "sounds:\n" \ + @resources.keys.map{|p| " .word @#{p}"}.join("\n") \ + "\n" \ + @resources.map{|key,value| "@#{key}:\n#{value.join} .byte $ff\n" }.join ) end |
#get_context ⇒ Object
17 18 19 |
# File 'lib/burn/generator/rom/assembly_sound_effect.rb', line 17 def get_context self end |