module WritingAdditions
Overview
Additions to allow wa-cr to write to files
To use these additions, just require it:
require "wa-cr/write"
Here's some examples of this addition:
require "wa-cr/write"
File.open("Path/To/Test.file") do |file|
# Writes a full wad
my_wad.write(file) # => Size of the written file
# Writes lumps return the size of the written lump
my_demo.write(file) # => Size of the written file
my_sound.write(file) # => Size of the written file
my_pcsound.write(file) # => etc.
my_music.write(file) # => etc.
my_genmidi.write(file) # => etc.
my_dmxgus.write(file) # => etc.
my_playpal.write(file) # => etc.
my_colormap.write(file) # => etc.
my_endoom.write(file) # => etc.
my_texturemap.write(file) # => etc.
my_pnames.write(file) # => etc.
my_graphic.write(file) # => etc.
my_flat.write(file) # => etc.
Map Data
To write specific map data, you have to use the class methods and put in the file to write, and the parsed map data you want to write:
File.open("Path/To/Test.file") do |file|
my_map.write(file) # => An array of all written directories in the order listed below
Map::Thing.write(file, my_things : Array) # => The written file's directory
Map::Linedef.write(file, my_linedefs : Array) # => The written file's directory
Map::Sidedef.write(file, my_sidedefs : Array) # => etc.
Map::Vertex.write(file, my_vertexs : Array) # => etc.
Map::Seg.write(file, my_segs : Array) # => etc.
Map::Ssector.write(file, my_ssectors : Array) # => etc.
Map::Node.write(file, my_nodes : Array) # => etc.
Map::Sector.write(file, my_sectors : Array) # => etc.
Map::Reject.write(file, my_reject : Map::Reject) # => etc.
Map::Blockmap.write(file, my_blockmap : Map::Blockmap) # => etc.
end
Quick Writing
wa-cr's writing additions' methods also have overloads to write to a file by just providing the file path
# Writes a full wad
my_wad.write("Path/To/File") # => Size of the written file
# Writes lumps return the size of the written lump
my_demo.write(file) # => Size of the written file
my_sound.write("Path/To/File") # => Size of the written file
my_pcsound.write("Path/To/File") # => etc.
my_music.write("Path/To/File") # => etc.
my_genmidi.write("Path/To/File") # => etc.
my_dmxgus.write("Path/To/File") # => etc.
my_playpal.write("Path/To/File") # => etc.
my_colormap.write("Path/To/File") # => etc.
my_endoom.write("Path/To/File") # => etc.
my_texturemap.write("Path/To/File") # => etc.
my_pnames.write("Path/To/File") # => etc.
my_graphic.write("Path/To/File") # => etc.
my_flat.write("Path/To/File") # => etc.
# Map Data
my_map.write("Path/To/File") # => An array of all written directories in the order listed below
Map::Thing.write("Path/To/File", my_thing : Array) # => The written file's directory
Map::Linedefwrite("Path/To/File", my_linedefs : Array) # => The written file's directory
Map::Sidedef.write("Path/To/File", my_sidedefs : Array) # => etc.
Map::Vertex.write("Path/To/File", my_vertexes : Array) # => etc.
Map::Seg.write("Path/To/File", my_segs : Array) # => etc.
Map::Ssector.write("Path/To/File", my_ssectors : Array) # => etc.
Map::Node.write("Path/To/File", my_nodes : Array) # => etc.
Map::Sector.write("Path/To/File", my_sectors : Array) # => etc.
Map::Reject.write("Path/To/File", my_reject : Map::Reject) # => etc.
Map::Blockmap.write("Path/To/File", my_blockmap : Map::Blockmap) # => etc.
Defined in:
write.crwrite/write_demo.cr
write/write_map.cr
write/write_music.cr
write/write_sound.cr
write/write_texture.cr