じ☆ve冰风 发表于 2026-8-3 14:36:20

SCREEN SIZE for RMVXAce

SCREEN SIZE for RMVXAce
Version: 1.0​



Introduction
I had been tinkering with the manipulation of the available gaming area for RPGMaker XP games. And I did well with a barebones script that did not require the use of any external .DLL outside of Win32 manipulations, a script based upon the work of Selwyn (formerly Squall).

This specific script is an adapation of my XP version, but altered for use with RPGMaker VX Ace. Simpler in design due to updates made in the Viewport class and Weather system.

The Game.Exe's Fullscreen mode reverts to a fixed 640x480 resolution so the + key combination is disabled. Fullscreen mode is literally disabled by intent with this setup.



Screenshots
None.



Script
Spoiler: Script                Code:       
#==============================================================================
# ** SCREEN SIZE for VXACE
#------------------------------------------------------------------------------
#    Version 1.0
#    By DerVVulfman
#    04-13-2026 (MM-DD-YYYY)
#    RGSS3 / RPGMaker VX Ace
#==============================================================================
#
#INTRODUCTION:
#=============
#I had been tinkering with the manipulation of the available gaming area for
#RPGMaker XP games.And I did well with a barebones script that did not re-
#quire the use of any external .DLL outside of Win32 manipulations, a script
#based upon the work of Selwyn (formerly Squall).
#
#This specific script is an adapation of my XP version,but altered for use
#with RPGMaker VX Ace. Simpler in design due to updates made in the Viewport
#class and Weather system.
#
#ALERT: The Game.Exe's Fullscreen mode reverts to a fixed 640x480 resolution
#         so the + key combination is disabled. Fullscreen mode is
#         literally disabled by intent with this setup.
#
#
#   ------------------------------------------------------------------------
#
#INSTRUCTIONS:
#=============
#I would hope this is clear.It is mostly plug-and-play, only requiring you
#to set some configurable values within the ScrnSize moduleat the very top
#of the actual system code.And all the variable options have detailed des-
#criptions of what is being set.
#
#NOTE: If you are usingother scripts that perform alterationsto the size
#      of screen contents (YanFly's Core as an example), ensure both are set
#      to the same resolution.
#
#==============================================================================
#
#COMPATABILITY:
#==============
#Designed for RPGMaker VXAce.
#
#Alters the screen size, so other scripts that adjust viewport settings will
#need to be likewise altered.
#
#
#==============================================================================
#
#CREDITS AND THANKS:
#===================
#The very basics of this systemcomes from the DLL-free version of Selwyn's
#resolution script.
#
#And thanks goes to ViperDamascuswho was looking for a scriptto increase
#VXAce's screen size beyond the 640x480 maximum.
#
#
#==============================================================================
#
#TERMS and CONDITIONS:
#=====================
#Free for use, even in commercial scripts. However, I require due credit for
#myself, Selwyn who crafted the basics, and ViperDamascus for the request.
#
#
#==============================================================================



#==============================================================================
# ** ScrnSize
#------------------------------------------------------------------------------
#This module handles the adjustable screen size for games that utilize
#resolution scripts to alter game window dimensions.
#==============================================================================

module ScrnSize


# GAME SCREEN RESOLUTION
# ======================
# The absolute necessity... defining the size of the visible area of your
# game on the screen. You will see below some dimensions tested, and then
# commented out. Even reducing the size to older RPGMaker 2000 scale exe-
# cuted just fine.
# < -- IT IS RECOMMENDED THAT THE DEFINED VALUES BE MULTIPLES OF 32! -- >
# -----------------------------------------------------------------------
#
    Width   = 1280      # Screen area width in pixels
    Height    = 736       # Screen area height in pixels.
#    Width   = 640
#    Height    = 480
#    Width   = 320
#    Height    = 200


# GAME INI NAMING
# ===============
# A necessity if you are renaming the Game Executable (eg Game.exe). When
# your game/project is run, it looks for its requisite .ini file which it
# assumes to have the same name as its executable. Many leave the name of
# the executable alone. But if you choose to rename Game.exe to Trek.exe,
# it will search for Trek.ini. And if the assumed ini does not exist, the
# game will fail.
#
# The resolution changing system relies upon retriving the windows handle
# for the game when it executes.And for this, it needs the current name
# of the Game's INI file.So if you do change the name of the executable
# (and thus the name of the INI), it needs the name defined below.
# -----------------------------------------------------------------------
#
    INI_Name= 'Game.ini'


# GAME EXECUTION SPEED
# ====================
# This is an old trick,changing the speed of the executable to make the
# game itself run faster.RPGMaker XP was set to a default 40 frames per
# second while RPGMaker VX and VXAce to a native 60 frames per second.
#
# -----------------------------------------------------------------------
# Changing this value affects all...script/code speed,character speed
# in the fieldmap, battle animations, and the like.
#
# RANGE: 10-120. VXAce will not exceed 120fps nor go slower than 10.
#
# NOTE: Smooth mode refreshes graphics ever frame based on this value.
#       Normal mode only refreshes every other frame.
# -----------------------------------------------------------------------
#
    Graphics.frame_rate = 40


end



#==============================================================================
# ●● Resolution
#------------------------------------------------------------------------------
#This module uses the Win32API to connect to the RPGMaker XP game window and
#re-sizes the window based on the game developer's preferences.
#==============================================================================

module Resolution

#--------------------------------------------------------------------------
# ● instance variables
#--------------------------------------------------------------------------
attr_reader :state

#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
   
    # Acquire desired window settings from configuration
    # ==================================================
    @reswidth   = ScrnSize::Width
    @resheight= ScrnSize::Height
   
    # Set instance variables for calling basic Win32 functions
    # ========================================================   
    ini   = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')
    title   = "\0" * 256
   
    # Get Window Title
    # ================================================   
    ini.call('Game', 'Title', '', title, 256, '.\\' + ScrnSize::INI_Name)
    title.delete!("\0")
   
    # Acquire Metrics from the Win32 API
    # ================================================   
    @window       = Win32API.new('user32', 'FindWindow',       'PP',
                  'I').call("RGSS Player", title)
    @set_win_long = Win32API.new('user32', 'SetWindowLong',    'LIL', 'L')
    @set_win_pos= Win32API.new('user32', 'SetWindowPos',   'LLIIIII', 'I')
    @gsm          = Win32API.new('user32', 'GetSystemMetrics', 'I', 'I')
    @gcr          = Win32API.new('user32', 'GetClientRect',    'LP', 'I')
    @kbe          = Win32API.new('user32', 'keybd_event',      'LLLL', '')
    @gaks         = Win32API.new('user32', 'GetAsyncKeyState', 'L', 'I')
   
    # Render message and exit if size is not supported
    # ================================================
    @default_size = self.size
    if size < @reswidth or size < @resheight
      print("\"#{title}\" requires a minimum screen resolution " +
            "of [#{@reswidth} x #{@resheight}]\r\n\r\n" +
            "\tYour Resolution: [#{@default_size} x #{@default_size}]")
      exit
    end
   
    # Apply Resolution Change
    # =======================
    @state = "default"
    self.default
   
end

#--------------------------------------------------------------------------
# ● fullscreen
#--------------------------------------------------------------------------
def fullscreen
    #
    @default_size = size
    @set_win_long.call(@window, -16, 0x14000000)
    @set_win_pos.call(@window, -1, 0, 0, (@reswidth+2), (@resheight+2), 64)
    @state = "fullscreen"
    #
end

#--------------------------------------------------------------------------
# ● default
#--------------------------------------------------------------------------
def default
    #
    x = @default_size / 2 - ((@reswidth/2) + 3)
    y = @default_size / 2 - ((@resheight/2) + 8)
    @set_win_long.call(@window, -16, 0x14CA0000)
    @set_win_pos.call(@window, 0, x, y, (@reswidth+8), (@resheight+27), 0)
    @state = "default"
    #
end

#--------------------------------------------------------------------------
# ● trigger?(key)
#--------------------------------------------------------------------------
def trigger?(key)
    #
    return @gaks.call(key) & 0x01 == 1
    #
end

#--------------------------------------------------------------------------
# ● private
#--------------------------------------------------------------------------
private :fullscreen
private :default
private :trigger?

#--------------------------------------------------------------------------
# ● size
#--------------------------------------------------------------------------
def size
    #
    width   = @gsm.call(0)
    height= @gsm.call(1)
    return width, height
    #
end

#--------------------------------------------------------------------------
# ● change
#--------------------------------------------------------------------------
def change
    #
    if @state == "default"
      self.fullscreen
    else
      self.default
    end
    #
end

#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
    #
    if trigger?(121) # F10
      self.change
    end
    if Input.trigger?(Input::ALT) or Input.press?(Input::ALT)
      @kbe.call(18, 0, 2, 0)
    end
    #
end

#--------------------------------------------------------------------------
# ● module functions
#--------------------------------------------------------------------------
module_function :initialize
module_function :fullscreen
module_function :default
module_function :trigger?
module_function :size
module_function :change
module_function :update
#
end



#==============================================================================
# ●● Input
#------------------------------------------------------------------------------
#A class that handles input data from a gamepad or keyboard.
#==============================================================================

class << Input

#--------------------------------------------------------------------------
# ● Alias Listings (with F12 Stack prevention)
#--------------------------------------------------------------------------
alias res_update update unless $@

#--------------------------------------------------------------------------
# ● Input.update
#--------------------------------------------------------------------------
def Input.update
    # Perform the original call
    res_update
    # Update the Resolution
    Resolution.update
end
end



# Execute at start
Resolution.initialize




Instructions
Plenty, and in the script.



Compatibility
Designed for RPGMaker XP

Alters the screen size, so other scripts that adjust viewport settings will need to be likewise altered.



Credits and Thanks
The very basics of this system comes from the DLL-free version of Selwyn's resolution script.

And thanks goes to ViperDamascus who was looking for a script to increase VXAce's screen size beyond the 640x480 maximum.



Terms and Conditions
Free for use, even in commercial scripts. However, I require due credit for myself, Selwyn who crafted the basics, and ViperDamascus for the request.


本贴来自国际rpgmaker官方论坛作者:DerVVulfman处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/screen-size-for-rmvxace.183264/
页: [1]
查看完整版本: SCREEN SIZE for RMVXAce