Black_Mage icon

Centered Title Option Text Script

Black_Mage | PRO | 07/05/22 06:26:09 PM UTC (Edited) | 0 ⭐ | 8382 👁️ | Never ⏰ | []
Ruby |

1.95 KB

|

None

|

0 👍

/

0 👎

#==============================================================================
# Center Aligned Title Screen's Option Text Script by Black Mage.
# For: RPG Maker VX
# Version: 1.0
#
# License: CC-BY 3.0
# https://burningwizard.wordpress.com/
#==============================================================================
 
#==============================================================================
# Changelog
#==============================================================================
# Version 1.0
#   - Initial version.
#==============================================================================
 
#------------------------------------------------------------------------------
# * Beyond this is the sacred land of code. You need programming qualification
#   to delve deeper, or it'll cause many unnecessary problems. Proceed on your
#   own risk.
#------------------------------------------------------------------------------
 
class Scene_Title < Scene_Base
  def create_command_window
    s1 = Vocab::new_game; s2 = Vocab::continue; s3 = Vocab::shutdown
    @command_window = Center_Window_Command.new(172, [s1, s2, s3])
    @command_window.x = (544 - @command_window.width) / 2
    @command_window.y = 288
    @continue_enabled ? @command_window.index = 1 : @command_window.draw_item(1, false)
    @command_window.openness = 0; @command_window.open
  end
end  
class Center_Window_Command < Window_Command
  def draw_item(index, enabled = true)
    rect = black_item_rect(index,@commands[index])
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(rect, @commands[index])
  end  
  def black_item_rect(index,text)
    rect = item_rect(index)
    max_chc_wdth = text.collect {|s| contents.text_size(s).width }
    center = (self.width - max_chc_wdth[0] - 32) / 2
    rect.x = center; rect.width -= 8; rect
  end
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎