From 920e8c6ab5d3712eec02a047fa774eb73945d713 Mon Sep 17 00:00:00 2001 From: regendo Date: Sun, 11 Aug 2013 18:55:45 +0200 Subject: [PATCH] [Multiple Cols]: minor changes --- .../multiple_cols_in_selectables.rb | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/Multiple_Columns_in_selectable_windows/multiple_cols_in_selectables.rb b/Multiple_Columns_in_selectable_windows/multiple_cols_in_selectables.rb index 4782fa7..86522c9 100644 --- a/Multiple_Columns_in_selectable_windows/multiple_cols_in_selectables.rb +++ b/Multiple_Columns_in_selectable_windows/multiple_cols_in_selectables.rb @@ -1,5 +1,5 @@ #========================================== -# Multiple Cols Command Window +# Multiple Cols In Selectable #========================================== # by bStefan aka. regendo # requested by monstrumgod @@ -25,8 +25,7 @@ # def give_item # #code # end -# 5. ??? -# 6. Profit. +# 5. Enjoy #============================================================ @@ -46,30 +45,24 @@ module Horizontal_Command #============== #spacing in pixels - def self.spacing - 32 - end + SPACING = 32 #padding in pixels - def self.standard_padding - 12 - end + PADDING = 12 #number of columns if no number is given upon calling intialize - def self.standard_cols - 2 - end + COLS = 2 end end #============== # Script #============== class Window_HorizontalCommand < Window_Command - def initialize(x = 0, y = 0, cols = standard_cols, width = "fitting") + def initialize(x = 0, y = 0, cols = standard_cols, width = :fitting) col_max(cols) @list = [] make_command_list - width == "fitting" ? window_width(fitting_width) : window_width(width) + width == :fitting ? window_width(fitting_width) : window_width(width) clear_command_list super(x, y) end @@ -77,8 +70,8 @@ def initialize(x = 0, y = 0, cols = standard_cols, width = "fitting") # : width. Changing the standard value from 255 to something else, unless # : it's a method, will not actually change the result. def window_width(width = 255) - @width ? @width : @width = width - @width > Graphics.width ? @width = Graphics.width : @width + @width = width unless @width + @width = [Graphics.width, width].min end def col_max(cols = standard_cols) @@ -111,15 +104,15 @@ def item_width end def spacing - Regendo::Horizontal_Command::spacing + Regendo::Horizontal_Command::SPACING end def standard_padding - Regendo::Horizontal_Command::standard_padding + Regendo::Horizontal_Command::PADDING end def standard_cols - Regendo::Horizontal_Command::standard_cols + Regendo::Horizontal_Command::COLS end end \ No newline at end of file