require 'Win32API'
require 'gosu'
def test_window_size(width, height)
window = Gosu::Window.new(width, height, false)
handle = Win32API.new('user32', 'FindWindow', 'PP', 'I').call("Gosu::Window", "")
rect = [0, 0, 0, 0].pack("I*")
Win32API.new('user32', 'GetClientRect', 'IP', 'I').call(handle, rect)
puts "Gosu Size : #{[window.width, window.height]} - Real Size : #{rect.unpack("I*")[2..3]}"
end
test_window_size(800, 600) # => Gosu Size : [800, 600] - Real Size : [800, 600]
test_window_size(1024, 768) # => Gosu Size : [1024, 768] - Real Size : [819, 614]
test_window_size(Gosu.screen_width, Gosu.screen_height) # => Gosu Size : [1366, 768] - Real Size : [1092, 614]
width, height = (Gosu.screen_width * 0.9).round, (Gosu.screen_height * 0.8).round
Window (unsigned width, unsigned height, bool fullscreen, double updateInterval=16.666666, bool ignoreConstraint=false)
Window#draw
method in scale(2) do ... end
, and to scale down mouse_x
and mouse_y
wherever you use them. Not pretty, but one of the smaller pain points with Gosu. :)
scale
expects a block with the code that will scale...scale(2) do # passing 2 is the same as 2, 2, 0, 0 :)
image3.draw(1,2,3)
end
Gosu::enable_undocumented_retrofication
(sic)
floor
your drawing coordinates if your game uses floats for positioning and stuff. Even with smoothing disabled, drawing a sprite at 0.5, 0.5 is going to have the "pixels" misaligned.@image.draw @x.floor, @y.floor, @z
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill