Save-Point
KButtonsManager VX + ACE - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: KButtonsManager VX + ACE (/thread-9673.html)



KButtonsManager VX + ACE - kyonides - 09-27-2024

KButtonsManager VX + ACE

by Kyonides


Introduction

Are you Boring bored of using the same boring menu window in your game projects?
Do you want your Gamer game to look way different than those thousands of Steam games floating around?
Now you have got a chance to be original! Grinning

A Brief Explanation

Let's take a look Detective at the custom Scene_Title script included in the demo as an example of how to use it effectively.

Here we got the make_buttons method I defined there. It pretty much contains all you need to know about the script calls needed to make it work properly. (By the way, it is called from the scene's main method.)

Code:
  def make_buttons
    # Did the Game find Any Saved Games there?
    @continue = Dir['Save*.rxdata'].any?
    # Create Button Manager - Pass (Total Options, Cursor Filename)
    @manager = KButtons::Manager.new(OPTIONS.size, CURSOR_FILE)
    # Set the Buttons' Direction - Pass = :horizontal or :vertical
    @manager.direction = :horizontal
    # Set the Offsets - Pass (X, Y)
    @manager.set_offsets(0, 4)
    # Set the Coordinates - Pass (X, Y)
    @manager.set_xy(80, 260)
    # Draw Name and Picture
    # - Pass (Name's Height, Font Size, Names Array, Symbols Array)
    @manager.draw_text_picture(26, 24, OPTIONS, SYMBOLS)
    # Define List of States
    # - [Booleans like true or false, Add, As, Many, As, Necessary]
    @manager.enabled = [true, @continue, true, true]
    # Set the Initial Position of the Cursor - Usually Number 0
    @manager.index = (@continue and @index == 0)? 1 : @index
  end

Later on you would only need to dispose the Button Manager like this:

Code:
@manager.dispose

VX Version

This is how it would look like in RMVX.

Code:
class Scene_Title
  $data_system = load_data("Data/System.rvdata")
  CURSOR_FILE = "cursor gradient"
  OPTIONS = [Vocab.new_game, Vocab.continue, "Settings", Vocab.shutdown]
  SYMBOLS = ["active", "writing", "settings", "screen off"]
  def create_command_window
    # Create Button Manager - Pass (Total Options, Cursor Filename)
    @manager = KButtons::Manager.new(OPTIONS.size, CURSOR_FILE)
    # Set the Buttons' Direction - Pass = :horizontal or :vertical
    @manager.direction = :horizontal
    # Set the Offsets - Pass (X, Y)
    @manager.set_offsets(0, 4)
    # Set the Coordinates - Pass (X, Y)
    @manager.set_xy(80, 260)
    # Draw Name and Picture
    # - Pass (Name's Height, Font Size, Names Array, Symbols Array)
    @manager.draw_text_picture(26, 24, OPTIONS, SYMBOLS)
    # Define List of States
    # - [Booleans like true or false, Add, As, Many, As, Necessary]
    @manager.enabled = [true, @continue_enabled, true, true]
    # Set the Initial Position of the Cursor - Usually Number 0
    @manager.index = (@continue_enabled and @index == 0)? 1 : @index
  end

  def dispose_command_window
    @manager.dispose
  end

Of course, there are other details to keep in mind, but it is better to take a look at the full scripts to learn how to properly use them.

Screenshot

[Image: kbuttonsmanagerace.jpg]


Terms & Conditions

Free for use in non commercial games. Grinning
Contact me if you are going commercial. Winking
Mention my nickname in your game credits. Two Thumbs Up!