Let's take the class in RGSS script as an example, say Bitmap.
When we draw a text on a bitmap which is an instance of Bitmap,
bitmap = Bitmap.new(width, height)
we can either
# # # # # # # # # # # # # # # # # #
bitmap.draw_text(x,y,width,height,text)
# # # # # # # # # # # # # # # # # #
or we can
# # # # # # # # # # # # # # # # # #
bitmap.draw_text(rect,text)
# # # # # # # # # # # # # # # # # #
So how to create a def which can either receive x,y,width,height or rect?
In other language, we may simply build two functions with different parameters , however for Ruby, after we writed a new def, the old one was automatically covered. So I wonder how to write something like Bitmap.draw_text.
Thanks all ^_^
When we draw a text on a bitmap which is an instance of Bitmap,
bitmap = Bitmap.new(width, height)
we can either
# # # # # # # # # # # # # # # # # #
bitmap.draw_text(x,y,width,height,text)
# # # # # # # # # # # # # # # # # #
or we can
# # # # # # # # # # # # # # # # # #
bitmap.draw_text(rect,text)
# # # # # # # # # # # # # # # # # #
So how to create a def which can either receive x,y,width,height or rect?
In other language, we may simply build two functions with different parameters , however for Ruby, after we writed a new def, the old one was automatically covered. So I wonder how to write something like Bitmap.draw_text.
Thanks all ^_^