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 :
how to use it :
in main, before 'begin', put the following line :
and in each Scene_
put Resolution.update right after Input.update
two negative points:
- the ALT key doesn't work anymore,
- F10 is used to switch in full-screen mode.
Give credit, enjoy!
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
Spoiler
#==============================================================================
# â– Resolution
#------------------------------------------------------------------------------
# created by Selwyn
# [email hidden]
#
# 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
# â– Resolution
#------------------------------------------------------------------------------
# created by Selwyn
# [email hidden]
#
# 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
Expand to see the code.
how to use it :
in main, before 'begin', put the following line :
and in each Scene_
put Resolution.update right after Input.update
two negative points:
- the ALT key doesn't work anymore,
- F10 is used to switch in full-screen mode.
Give credit, enjoy!