mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Refactoring and tidying
This commit is contained in:
@@ -4,7 +4,7 @@ class Win32API
|
||||
@@GetWindowThreadProcessId = Win32API.new('user32', 'GetWindowThreadProcessId', '%w(l p)', 'l')
|
||||
@@FindWindowEx = Win32API.new('user32', 'FindWindowEx', '%w(l l p p)', 'l')
|
||||
|
||||
# Added by Peter O. as a more reliable way to get the RGSS window
|
||||
# Added by Peter O. as a more reliable way to get the RGSS window
|
||||
def Win32API.pbFindRgssWindow
|
||||
return @@RGSSWINDOW if @@RGSSWINDOW
|
||||
processid = [0].pack('l')
|
||||
@@ -32,73 +32,6 @@ class Win32API
|
||||
width,height = rect.unpack('l4')[2..3]
|
||||
return width,height
|
||||
end
|
||||
|
||||
=begin
|
||||
# Unused
|
||||
def Win32API.SetWindowText(text)
|
||||
hWnd = pbFindRgssWindow
|
||||
swp = Win32API.new('user32','SetWindowTextA',%(l, p),'i')
|
||||
swp.call(hWnd, text.to_s)
|
||||
end
|
||||
|
||||
# Unused
|
||||
def Win32API.SetWindowPos(w, h)
|
||||
hWnd = pbFindRgssWindow
|
||||
windowrect = Win32API.GetWindowRect
|
||||
clientsize = Win32API.client_size
|
||||
xExtra = windowrect.width-clientsize[0]
|
||||
yExtra = windowrect.height-clientsize[1]
|
||||
swp = Win32API.new('user32','SetWindowPos',%(l,l,i,i,i,i,i),'i')
|
||||
win = swp.call(hWnd,0,windowrect.x,windowrect.y,w+xExtra,h+yExtra,0)
|
||||
return win
|
||||
end
|
||||
|
||||
# Unused
|
||||
def Win32API.GetWindowRect
|
||||
hWnd = pbFindRgssWindow
|
||||
rect = [0,0,0,0].pack('l4')
|
||||
Win32API.new('user32','GetWindowRect',%w(l p),'i').call(hWnd,rect)
|
||||
x,y,width,height = rect.unpack('l4')
|
||||
return Rect.new(x,y,width-x,height-y)
|
||||
end
|
||||
|
||||
# Unused
|
||||
def Win32API.focusWindow
|
||||
window = Win32API.new('user32','ShowWindow','LL','L')
|
||||
hWnd = pbFindRgssWindow
|
||||
window.call(hWnd,9)
|
||||
end
|
||||
|
||||
# Unused
|
||||
def Win32API.fillScreen
|
||||
setWindowLong = Win32API.new('user32','SetWindowLong','LLL','L')
|
||||
setWindowPos = Win32API.new('user32','SetWindowPos','LLIIIII','I')
|
||||
metrics = Win32API.new('user32', 'GetSystemMetrics', 'I', 'I')
|
||||
hWnd = pbFindRgssWindow
|
||||
width = metrics.call(0)
|
||||
height = metrics.call(1)
|
||||
setWindowLong.call(hWnd,-16,0x00000000)
|
||||
setWindowPos.call(hWnd,0,0,0,width,height,0)
|
||||
Win32API.focusWindow
|
||||
return [width,height]
|
||||
end
|
||||
|
||||
# Unused
|
||||
def Win32API.restoreScreen
|
||||
setWindowLong = Win32API.new('user32','SetWindowLong','LLL','L')
|
||||
setWindowPos = Win32API.new('user32','SetWindowPos','LLIIIII','I')
|
||||
metrics = Win32API.new('user32','GetSystemMetrics','I','I')
|
||||
hWnd = pbFindRgssWindow
|
||||
width = SCREEN_WIDTH
|
||||
height = SCREEN_HEIGHT
|
||||
x = [(metrics.call(0)-width)/2,0].max
|
||||
y = [(metrics.call(1)-height)/2,0].max
|
||||
setWindowLong.call(hWnd,-16,0x14CA0000)
|
||||
setWindowPos.call(hWnd,0,x,y,width+6,height+29,0)
|
||||
Win32API.focusWindow
|
||||
return [width,height]
|
||||
end
|
||||
=end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user