Selwyn @ RMXP.Org Mon Jun 19, 2006 Wrote:Important : This is mainly
designed for scripter!
okay, this will allow you want to make your game in a resolution of 800 by
600, or greater if you so desire.
what you need :
The Display DLL, download it in your game folder (it has to be named
Display.dll) and the following script
SCRIPT
The Script
Code:
#==============================================================================
# ? Resolution
#------------------------------------------------------------------------------
# created by Selwyn
# selwyn@rmxp.ch
#
# released on the 19th of June 2006
#
# allows to change the game window's resolution to 800 by 600.
#==============================================================================
module Resolution
#--------------------------------------------------------------------------
# ? instance variables
#--------------------------------------------------------------------------
attr_reader :state
#--------------------------------------------------------------------------
# ? initialize
#--------------------------------------------------------------------------
def initialize
title = "\0" * 256
Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L').call("Game", "Title", "", title, 256, ".\\Game.ini")
title.delete!("\0")
@set_resolution = Win32API.new('Display.dll', 'SetResolution', 'III', 'I')
@set_window_long = Win32API.new('user32', 'SetWindowLong', 'LIL', 'L')
@set_window_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')
@window = Win32API.new('user32', 'FindWindow', 'PP', 'I').call("RGSS Player", title)
@default_size = size
if size[0] < 800 or size[1] < 600
print("A minimum screen resolution of [800 by 600] is required in order to play #{title}")
exit
end
@state = "default"
self.default
end
#--------------------------------------------------------------------------
# ? fullscreen
#--------------------------------------------------------------------------
def fullscreen
@default_size = size
@set_window_long.call(@window, -16, 0x14000000)
@set_window_pos.call(@window, -1, 0, 0, 802, 602, 64)
@set_resolution.call(800, 600, 4)
@state = "fullscreen"
end
#--------------------------------------------------------------------------
# ? default
#--------------------------------------------------------------------------
def default
x = @default_size[0] / 2 - 403
y = @default_size[1] / 2 - 316
@set_window_long.call(@window, -16, 0x14CA0000)
@set_window_pos.call(@window, 0, x, y, 808, 627, 0)
@set_resolution.call(@default_size[0], @default_size[1], 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
Or an edit by DerVVulfman:
The Script
Code:
#==============================================================================
# ** Resolution Revised
#------------------------------------------------------------------------------
# Original version by Selwyn (June 19, 2006)
# Revisions by DerVVulfman (February 18, 2014)
#
# The original version allowed you to change the resolution to 800x600.
# The revision allows that, or a resolution of 1024x768.
#
#
# To Use:
# ========
# Place a copy of the display.dll in your project's root directory.
# Paste this script into your project.
# Place the following call into 'Main' before the Graphics.freeze command:
# Resolution.initialize
# Insert the following into the loop of each update method for every scene
# command, so it overrides the default ALT+ENTER fullscreen toggle system:
# Resolution.update
#
# To choose your Resolution, go and edit the RES value, currently 0 or 1.
#
# NOTE: Other resolutions may now be possible.
#
#==============================================================================
module Resolution
#--------------------------------------------------------------------------
# * Resolution Choices
#--------------------------------------------------------------------------
RES = 0 # Set your preferred resolution with RES. 0=800x600, 1=1024x768
# These store the resolutions
RES_WD = [800, 1024]
RES_HT = [600, 768]
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :state
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
title = "\0" * 256
Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L').call("Game", "Title", "", title, 256, ".\\Game.ini")
title.delete!("\0")
@set_resolution = Win32API.new('Display.dll', 'SetResolution', 'III', 'I')
@set_window_long = Win32API.new('user32', 'SetWindowLong', 'LIL', 'L')
@set_window_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')
@window = Win32API.new('user32', 'FindWindow', 'PP', 'I').call("RGSS Player", title)
@default_size = size
# Set Warning
if size[0] < RES_WD[RES] or size[1] < RES_HT[RES]
print("A minimum screen resolution of [" + RES_WD[RES].to_s + " by " +
RES_HT[RES].to_s + "] is required in order to play #{title}" )
exit
end
# Set State Flag
@state = "default"
# Set to Default Window
self.default
end
#--------------------------------------------------------------------------
# * Set Fullscreen Mode
#--------------------------------------------------------------------------
def fullscreen
@default_size = size
@set_window_long.call(@window, -16, 0x14000000)
@set_window_pos.call(@window, -1, 0, 0, RES_WD[RES]+2, RES_HT[RES]+2, 64)
# Set State Flag
@set_resolution.call(RES_WD[RES], RES_HT[RES], 4)
@state = "fullscreen"
end
#--------------------------------------------------------------------------
# * Set Windowed Mode
#--------------------------------------------------------------------------
def default
# Define center
x = @default_size[0] / 2 - ((RES_WD[RES]/2)+3)
y = @default_size[1] / 2 - ((RES_HT[RES]/2)+16)
# Ensure original Window size
@set_resolution.call(@default_size[0], @default_size[1], 0)
# Position Window in Center
@set_window_long.call(@window, -16, 0x14CA0000)
@set_window_pos.call(@window, 0, x, y, RES_WD[RES]+8, RES_HT[RES]+27, 0)
# Set State Flag
@state = "default"
end
#--------------------------------------------------------------------------
# * Trigger?
# key : keycode
#--------------------------------------------------------------------------
def trigger?(key)
return @gaks.call(key) & 0x01 == 1
end
#--------------------------------------------------------------------------
# * Obtain original window size
#--------------------------------------------------------------------------
def size
width = @gsm.call(0)
height = @gsm.call(1)
return width, height
end
#--------------------------------------------------------------------------
# * Change between screen modes
#--------------------------------------------------------------------------
def change
if @state == "default"
self.fullscreen
else
self.default
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Change window if F10 is pressed
self.change if trigger?(121)
# Prevent ALT key from changing window state
if Input.trigger?(Input::ALT) or Input.press?(Input::ALT)
@kbe.call(18, 0, 2, 0)
end
end
#--------------------------------------------------------------------------
# * Private Instance Variables
#--------------------------------------------------------------------------
private :fullscreen
private :default
private :trigger?
#--------------------------------------------------------------------------
# * Defined Module Functions
#--------------------------------------------------------------------------
module_function :initialize
module_function :fullscreen
module_function :default
module_function :trigger?
module_function :size
module_function :change
module_function :update
end
Charlie's Arena uses this script. You can find the ddl inside the game's folder. About the demo, just follow the instructions, it's very simple to use, you don't really need one.
Apparently, what caused the .dll link to be missing is what caused an error in the code... breaking it apart. It must have occurred during the transfer from Hideout last year.
are widescreen, more particularly HD modes possible. 1280x720 and 1920x1080? Honestly im mainly looking to do 1680x1050 as thats what most monitors do right now.
actually, 1680x1050 is less then 10 percent of monitors on home computers. ( a lot of people re-use old monitors ) and most laptops are 1280x800 16:10, although there are a few 1280x960 16:9 laptops out there. The reason behind this is simple, many people simply reuse their old screens rather than buy new ones when they upgrade their old computers. What this equates to is this, if you want an accurate portrayal of screen sizes, look back about 5 years and see what was common then. The default resolution for XP was 1024x768 on the CRT monitors, and occasionally 1280x1024, at 4:3 ratios. If you look into wide screen monitors, you will find that the average widescreen was a LCD with a max resolution of 1280x800 16:10, and occasionally you would find 1280x960 16:9, just like our laptops. Now if you look specifically at the high-performance 3D gaming market, you will find the ratio's that you are talking about, but first you'll need to get them off of their 3D FPS and WoW accounts.
Now that said, if you still want to target those resolutions, this script, last I checked, should be able to do it with no issues, although I'm not sure how that will effect your games performance.