diff --git a/lib/mikunyan/asset.rb b/lib/mikunyan/asset.rb index d9de063..350a263 100644 --- a/lib/mikunyan/asset.rb +++ b/lib/mikunyan/asset.rb @@ -43,10 +43,12 @@ module Mikunyan :data, :parent_asset, :klass, keyword_init: true ) do + # Alias to {Asset#parse_object} def parse parent_asset.parse_object(self) end + # Alias to {Asset#parse_object_simple} def parse_simple parent_asset.parse_object_simple(self) end @@ -144,6 +146,7 @@ module Mikunyan obj&.type end + # Alias to {ObjectValue#simplify} (for compatibility) def self.object_simplify(obj) obj.is_a?(ObjectValue) ? obj.simplify : obj end diff --git a/lib/mikunyan/binary_reader.rb b/lib/mikunyan/binary_reader.rb index d7eceb1..a3fc223 100644 --- a/lib/mikunyan/binary_reader.rb +++ b/lib/mikunyan/binary_reader.rb @@ -31,7 +31,7 @@ module Mikunyan end # Jumps to given position - # @param [Integer] pos position + # @param [Integer] jmp_pos position def jmp(jmp_pos = 0) @io.pos = jmp_pos + @base_pos end @@ -61,7 +61,7 @@ module Mikunyan # Reads given size of binary string from specified position. This method does not seek. # @param [Integer] size size - # @param [Integer] pos position + # @param [Integer] jmp_pos position # @return [String] data def read_abs(size, jmp_pos) orig_pos = pos diff --git a/lib/mikunyan/decoders/image_decoder.rb b/lib/mikunyan/decoders/image_decoder.rb index 2c104bc..fddbb88 100644 --- a/lib/mikunyan/decoders/image_decoder.rb +++ b/lib/mikunyan/decoders/image_decoder.rb @@ -505,11 +505,13 @@ module Mikunyan end end + # @deprecated class ImageDecoder + # @deprecated Use {Decoder::ImageDecoder#decode_object} or {CustomTypes::Texture2D#generate_png} instead. def self.decode_object(object) - warn 'Warning: Mikunyan::ImageDecoder.decode_object is deprecated and will be removed at a future release. ' \ - 'Use Mikunyan::Decoder::ImageDecoder.decode_object or' \ - 'Mikunyan::CustomTypes::Texture2D::generate_png instead.' + warn 'Warning: Mikunyan::ImageDecoder#decode_object is deprecated and will be removed at a future release. ' \ + 'Use Mikunyan::Decoder::ImageDecoder#decode_object or' \ + 'Mikunyan::CustomTypes::Texture2D#generate_png instead.' Mikunyan::Decoder::ImageDecoder.decode_object(object) end end diff --git a/lib/mikunyan/types/texture2d.rb b/lib/mikunyan/types/texture2d.rb index febfe6a..8d9b157 100644 --- a/lib/mikunyan/types/texture2d.rb +++ b/lib/mikunyan/types/texture2d.rb @@ -8,6 +8,7 @@ module Mikunyan class Texture2D < Mikunyan::BaseObject Mikunyan::CustomTypes.set_custom_type(self, 'Texture2D') + # Generates an png image (an instance of {ChunkyPNG::Image}) from the texture data def generate_png Mikunyan::Decoder::ImageDecoder.decode_object(self) end