improve documents
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user