Save-Point
Full-Screen Toggle - 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 XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Full-Screen Toggle (/thread-61.html)



Full-Screen Toggle - Helladen - 07-10-2010

This is a script used to toggle full-screen or windowed mode once. After you save the game it will not appear again. You can change this
in the configuration, but I think it is a good idea, because it gets annoying clicking the option over and over again.
Instructions are in the script, and if you have any questions just post them here.

No screen-shots or demos are required.

Code:
=begin
================================================================================
Author: Mr Wiggles
Modifications: Helladen
Verison: 1.6
Last Update: 7/9/10

1.3 -> 1.4: Converted it from Rpg Maker XP to VX.

1.4 -> 1.5: Added where you can skip the toggle option if you have a save and
you can change the command prompt's opacity. This value will effect the
entire command prompt. I also added an option to change the input key.

1.5 -> 1.6: Added a option for the Scene.

How To Use:
You replace your main with this. Easy install, and if you want to configure the
script you just need to edit the settings below.
================================================================================
=end
#-------------------------------------------------------------------------------
# Configuration
#-------------------------------------------------------------------------------
SKIP_TOGGLE = true # This will skip the toggle if you have a save slot.
COMMAND_OPACITY = 160 # Change this value to the opacity you want.
INPUT_KEY = Input::C # This is the key used to confirm the command prompt.
SCENE = Scene_Title.new # The scene that is after or before Scene_FullPromp.
#----------------DO-NOT-EDIT-BELOW-THIS-----------------------------------------
# Start Scene_FullPromp
#-------------------------------------------------------------------------------
class Scene_FullPromp
#-------------------------------------------------------------------------------
def main
    @title = Scene_Title.new
    @title.load_database
    s1 = "Full-Screen"
    s2 = "Windowed"
    @command_window = Window_Command.new(192, [s1, s2])  
    @command_window.opacity = COMMAND_OPACITY
    @command_window.x = 272 - @command_window.width / 2
    @command_window.y = 208 - @command_window.height / 2
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
end
#-------------------------------------------------------------------------------
#  Update
#-------------------------------------------------------------------------------
def update
    @command_window.update
    # If the input key is pressed.
    if Input.trigger?(INPUT_KEY)
      case @command_window.index
      when 0  # Yes/1st option
      unless $keybd
      $keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v' #Recognizes keyboard
      $keybd.call 0xA4, 0, 0, 0
      $keybd.call 13, 0, 0, 0
      $keybd.call 13, 0, 2, 0
      $keybd.call 0xA4, 0, 2, 0
      end
       $scene = Scene_Title.new
      when 1  # No/2nd option
       $scene = Scene_Title.new
      end
    end
  end
end
#-------------------------------------------------------------------------------
# Main
#-------------------------------------------------------------------------------
begin
  Graphics.freeze
    if SKIP_TOGGLE and (Dir.glob('Save*.rvdata').size > 0)
    $scene = SCENE
    else
    $scene = Scene_FullPromp.new
    end
  while $scene != nil
    $scene.main
  end
  Graphics.transition(20)
rescue Errno::ENOENT
  filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
end