A Revamped ToggleButtonSprite Class
and its mysterious  Have Arrived!
 Have Arrived!  
 
  I know, what the hell am I talking about here?
 I know, what the hell am I talking about here?
 Fear not, my friends! Everything is fine with my HiddenChest Engine - Linux Edition. It just happens that I created a Spy module that will serve as an exclusive observer or listener kind of structure there. Starting from version 1.1.57 you will be able to create such a menu full of toggleable buttons with less lines of code!
 Fear not, my friends! Everything is fine with my HiddenChest Engine - Linux Edition. It just happens that I created a Spy module that will serve as an exclusive observer or listener kind of structure there. Starting from version 1.1.57 you will be able to create such a menu full of toggleable buttons with less lines of code!  
 
 I almost forgot you need some badly needed proof to confirm my previous statement.
 I almost forgot you need some badly needed proof to confirm my previous statement.  Do not worry, guys! I have prepared some new version of my test code as well. Just take a look at it.
 Do not worry, guys! I have prepared some new version of my test code as well. Just take a look at it.
Doesn't it look clean and easy to understand now? 
 Have Arrived!
 Have Arrived!  
  I know, what the hell am I talking about here?
 I know, what the hell am I talking about here? Fear not, my friends! Everything is fine with my HiddenChest Engine - Linux Edition. It just happens that I created a Spy module that will serve as an exclusive observer or listener kind of structure there. Starting from version 1.1.57 you will be able to create such a menu full of toggleable buttons with less lines of code!
 Fear not, my friends! Everything is fine with my HiddenChest Engine - Linux Edition. It just happens that I created a Spy module that will serve as an exclusive observer or listener kind of structure there. Starting from version 1.1.57 you will be able to create such a menu full of toggleable buttons with less lines of code!  
  I almost forgot you need some badly needed proof to confirm my previous statement.
 I almost forgot you need some badly needed proof to confirm my previous statement.  Do not worry, guys! I have prepared some new version of my test code as well. Just take a look at it.
 Do not worry, guys! I have prepared some new version of my test code as well. Just take a look at it.Note: Simple tests also seemed to confirm that the mouse support has been improved as well.  
 
 
 Code:
module ButtonData
  TITLE = "Scene Settings"
  BACKDROP = 'recycle texture'
  ICONS = %w{toggle1 toggle2 toggle3 toggle4}
  LABELS = ['Find Treasures', 'Kick Asses', 'Play Minigames',
            'Contract Covid-19', 'Hug Corona-chan', 'Escape']
end
class ToggleButtons
  def initialize(pos, states)
    @index = pos
    @timer = 0
    @buttons = []
    @labels = []
    ToggleButtonSprite.timer = Graphics.frame_rate / 3
    @total = ButtonData::LABELS.size
    @total.times do |n|
      cy = 44 + n * 32
      sprite = ToggleButtonSprite.new
      sprite.set_xy(8, cy)
      sprite.frame = RPG::Cache.icon(ButtonData::ICONS[0])
      sprite.bitmap_on = RPG::Cache.icon(ButtonData::ICONS[1])
      sprite.bitmap_off = RPG::Cache.icon(ButtonData::ICONS[2])
      sprite.button = RPG::Cache.icon(ButtonData::ICONS[3])
      sprite.state = states[n]
      @buttons << sprite
      sprite = Sprite.new
      sprite.set_xy(36, cy)
      sprite.bitmap = bit = Bitmap.new(160, 28)
      bit.draw_text(0, 0, bit.width, 28, ButtonData::LABELS[n])
      @labels << sprite
    end
    Spy.button = @buttons[0]
    @buttons[5].block = true
  end
  def update
    @buttons.each{|button| button.update }
    if Input.trigger?(Input::UP)
      Audio.play_cursor
      @index = (@index - 1) % @total
      Spy.button = @buttons[@index]
      return
    elsif Input.trigger?(Input::DOWN)
      Audio.play_cursor
      @index = (@index + 1) % @total
      Spy.button = @buttons[@index]
    end
  end
  def dispose
    (@buttons + @labels).each{|b| b.dispose }
    Spy.clear_button # or Spy.button = nil to clear the Spy's button
  end
  def states() @buttons.map(&:state) end
end
class MenuScene
  def main
    @bg = Sprite.new
    @bg.bitmap = RPG::Cache.title(ButtonData::BACKDROP)
    @title = Sprite.new
    @title.set_xy(Graphics.width / 2 - 120, 8)
    @title.bitmap = bit = Bitmap.new(240, 32)
    bit.draw_text(0, 0, 240, 32, ButtonData::TITLE, 1)
    states = [true, false, true, false, true, false]
    @buttonset = ToggleButtons.new(0, states)
    states.clear
    Graphics.transition
    main_loop while $scene == self
    Graphics.freeze
    @buttonset.dispose
    @title.dispose
    @bg.dispose
  end
  def main_loop
    Graphics.update
    Input.update
    update
  end
  def update
    @buttonset.update
    if Input.trigger?(Input::B)
      Audio.play_cancel
      @buttonset.states
      $scene = Scene_Title.new
      return
    elsif Input.trigger?(Input::KeyP)
      Audio.play_ok
      Graphics.save_screenshot
      return
    end
  end
end
 It seems my laziness caught me off guard once again.
 It seems my laziness caught me off guard once again.  
 I have no other choice but to keep you waiting for a Windows binary executable till...
 err, what about next year? It sounds like a terrific idea, don't you think, pals?
 err, what about next year? It sounds like a terrific idea, don't you think, pals?  
 
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
	
	
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE

 
 
 HiddenChest RGSS Player Executable
 HiddenChest RGSS Player Executable
 

 
 
 