mechacrash
Member
#The original name for this topic was "Simplest resolution script ever?!"
Background:
As ive been playing around with this a little more ive decided to try and make this into a fully operational resolution script for XP (and if you want VX too... after all it has more features than the default!)
Currently this works perfectly for XP but i havnt made any default systems and such for VX (will do that within 48 hours XD)
Features:
*current*
-Resize the screen to 640*480 or 320*240
-Automatically center the window to screen size unless specified otherwise
*in next version*
-Rewritten windows and command classes (already started XD) for use with new resolutions
-Rewritten viewports for new resolutions (almost done... just aliasing)
-Rewritten Bitmap class for auto size reduction (hopefully)
Script:
simply add this in a new script above main and use the call script commands (written below the script) to use it's features! (sorry for lack of commenting but i just dont do that while working... someone else can do that for me if they REAAAALLLY want...)
Use:
To return the screen back to default position
To manually change the screen size
To manually change the screen size (without centering the window)
To manually change the screen size and choose your own x and y location
To center the current window
To half the window size (game size = 320*240)
To half the window size (game size = 320*240)(without centering the window)
To choose your own window location using the current size
All of the above calling methods can be used in normal and evented call script systems.
Final note:
I hope you like this new addition and i promise that i'll keep improving it to make it the best resolution script EVARGH!
Background:
As ive been playing around with this a little more ive decided to try and make this into a fully operational resolution script for XP (and if you want VX too... after all it has more features than the default!)
Currently this works perfectly for XP but i havnt made any default systems and such for VX (will do that within 48 hours XD)
Features:
*current*
-Resize the screen to 640*480 or 320*240
-Automatically center the window to screen size unless specified otherwise
*in next version*
-Rewritten windows and command classes (already started XD) for use with new resolutions
-Rewritten viewports for new resolutions (almost done... just aliasing)
-Rewritten Bitmap class for auto size reduction (hopefully)
Script:
simply add this in a new script above main and use the call script commands (written below the script) to use it's features! (sorry for lack of commenting but i just dont do that while working... someone else can do that for me if they REAAAALLLY want...)
Code:
module Resolution
GetWindowPlacement = Win32API.new('user32','GetWindowPlacement',['l','p'],'l')
GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics',['i'],'i')
MoveWindow = Win32API.new('user32','MoveWindow',['l','i','i','i','i','l'],'l')
FindWindowEx = Win32API.new('user32','FindWindowEx',['l','l','p','p'],'i')
def self.windowloc(window)
string = ' ' * 44
Resolution::GetWindowPlacement.call(window,string)
windowdetails = string.unpack('L11')
result = []
result.push((windowdetails[9] - windowdetails[7]))
result.push((windowdetails[10] - windowdetails[8]))
result.push(windowdetails[7])
result.push(windowdetails[8])
return result
end
end
class Screen
def self.center
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
width,height = Resolution.windowloc(window)[0..1]
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1)
end
def self.resize2(width,height,x,y)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
def self.move(x,y)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
width,height = Resolution.windowloc(window)[0..1]
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
def self.resize(width,height,center = true)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
if center
Resolution::MoveWindow.call(window,(screenwidth - width) / 2,(screenheight - height) / 2,width,height,1)
else
x,y = Resolution.windowloc(window)[2..3]
Resolution::MoveWindow.call(window,x,y,width,height,1)
end
end
def self.half(center = true)
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
if center
Resolution::MoveWindow.call(window,(screenwidth - 326) / 2,(screenheight - 272) / 2,326,272,1)
else
x,y = Resolution.windowloc(window)[2..3]
Resolution::MoveWindow.call(window,x,y,326,272,1)
end
end
def self.default
window = Resolution::FindWindowEx.call(0,0,"RGSS Player",0)
screenwidth = Resolution::GetSystemMetrics.call(0)
screenheight = Resolution::GetSystemMetrics.call(1)
Resolution::MoveWindow.call(window,(screenwidth - 646) / 2,(screenheight / 2) - 273,646,512,1)
end
end
Use:
To return the screen back to default position
Code:
Screen.default
To manually change the screen size
Code:
Screen.resize(width,height)
To manually change the screen size (without centering the window)
Code:
Screen.resize(width,height,false)
To manually change the screen size and choose your own x and y location
Code:
Screen.resize2(width,height,x,y)
To center the current window
Code:
Screen.center
To half the window size (game size = 320*240)
Code:
Screen.half
To half the window size (game size = 320*240)(without centering the window)
Code:
Screen.half(false)
To choose your own window location using the current size
Code:
Screen.move(x,y)
All of the above calling methods can be used in normal and evented call script systems.
Final note:
I hope you like this new addition and i promise that i'll keep improving it to make it the best resolution script EVARGH!