From 767a47d90fe9e1bdc3f435f93c0301a90ef55823 Mon Sep 17 00:00:00 2001 From: Joni Savolainen Date: Sun, 9 Jan 2022 23:22:40 +0200 Subject: [PATCH] Fix Bitmap#draw_text override not accepting Rect argument (#150) --- Data/Scripts/001_Technical/001_MKXP_Compatibility.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb b/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb index 97213c36b..0f82a0b7b 100644 --- a/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb +++ b/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb @@ -12,9 +12,14 @@ end class Bitmap alias mkxp_draw_text draw_text unless method_defined?(:mkxp_draw_text) - def draw_text(x, y, width, height, text, align = 0) - height = text_size(text).height - mkxp_draw_text(x, y, width, height, text, align) + def draw_text(x, y, width, height = nil, text = "", align = 0) + if x.is_a?(Rect) + # rect, string & alignment + mkxp_draw_text(x, y, width) + else + height = text_size(text).height + mkxp_draw_text(x, y, width, height, text, align) + end end end