Added gra;hic/SE chooser pop-up windows to Animation Editor

This commit is contained in:
Maruno17
2023-11-28 22:28:08 +00:00
parent 01ff59606b
commit 973b93a524
8 changed files with 595 additions and 113 deletions

View File

@@ -81,7 +81,7 @@ class UIControls::NumberSlider < UIControls::BaseControl
self.bitmap.fill_rect(SLIDER_X - 1 + (i * SLIDER_LENGTH / 4), (self.height / 2) - 2, 2, 4, self.bitmap.font.color)
end
# Draw slider knob
fraction = (self.value - self.min_value) / self.max_value.to_f
fraction = (self.value - self.min_value) / (self.max_value.to_f - self.min_value)
knob_x = (SLIDER_LENGTH * fraction).to_i
self.bitmap.fill_rect(SLIDER_X + knob_x - 4, (self.height / 2) - 6, 8, 12, SLIDER_KNOB_COLOR)
# Draw plus button

View File

@@ -48,11 +48,16 @@ class UIControls::List < UIControls::BaseControl
@scrollbar.z = new_val + 1
end
def visible=(new_val)
super
@scrollbar.visible = new_val
end
# Each value in @values is an array: [id, text].
def values=(new_vals)
@values = new_vals
set_interactive_rects
@scrollbar.range = @values.length * ROW_HEIGHT
@scrollbar.range = [@values.length, 1].max * ROW_HEIGHT
if @scrollbar.visible
self.top_row = (@scrollbar.position.to_f / ROW_HEIGHT).round
else
@@ -143,10 +148,11 @@ class UIControls::List < UIControls::BaseControl
SELECTED_ROW_COLOR
)
end
txt = (val.is_a?(Array)) ? val[1] : val
draw_text(self.bitmap,
@interactions[i].x + TEXT_PADDING_X,
@interactions[i].y + TEXT_OFFSET_Y - (@top_row * ROW_HEIGHT),
val[1])
txt)
end
end