Save-Point
KButtonsManager - 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)
+--- Thread: KButtonsManager (/thread-8600.html)



KButtonsManager - kyonides - 11-22-2022

KButtonsManager

XP + VX + ACE

by Kyonides Arkanthes


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: kbuttonsmanagerxp01.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!


RE: KButtonsManager - kyonides - 11-24-2022

VX or VX ACE? Thinking
Why not both of them? Happy with a sweat

As you might have noticed already, my dear fellow forumers, I have updated this thread and its demos over and over again for a very important reason. I have included new demos for XP, VX and VX ACE! Grinning

Here is the proof!

[Image: kbuttonsmanagerace.jpg]



RE: KButtonsManager - kyonides - 11-26-2022

Black Friday's Bug Fixes

Well, I gotta admit Happy with a sweat that I had to correct the vertical scroll feature of my scripts because they were scrolling horizontally until last night. Laughing

I had also made other small changes to the code, but they are not visible at all.

OK, I really hope that you will find them useful for making interesting menus. Grinning


RE: KButtonsManager - kyonides - 12-15-2022

Maintenance Updates

I had to update all of the demos because I noticed that the scripts didn't offer all of the features already available in the RMXP version or they didn't keep track of the button's height, which is important for its location in the invisible grid.
Besides, all of them needed to be able to change the Ghost gray out feature at will. I realized that I had to change it after I was working on Kuests Dynamis and badly needed to update the Side Quests and Active Quests lists simultaneously.