Not logged inGosu Forums
Forum back to Help Search Register Login
Up Forum
Topic Wrong window size By Drowad Date 2012-08-02 09:50
Thanks !

Well, fullscreen isn't an option for me, I want to be able to use the taskbar.
I've look into the gosu source code to understand how it's work, I've never seen this kind of protection before :D

Anyway, I think I've found a solution that suits me :
width, height = (Gosu.screen_width * 0.9).round, (Gosu.screen_height * 0.8).round
Will give the maximum size without gosu resize/scale my window :)
Topic Wrong window size By Drowad Date 2012-08-01 21:57

First of all, thanks for all the work :)

I have a really annoying problem : I want to use a window of 1024x768, but the problem is that the window created was a lot smaller, but for 800x600 it's work normally.
I'm using ruby 1.9.3, the last gem of gosu, and Window 7 professional.

To make a better view of the problem, I've make an example :

require 'Win32API'
require 'gosu'

def test_window_size(width, height)
  window =, height, false)
  handle ='user32', 'FindWindow', 'PP', 'I').call("Gosu::Window", "")
  rect = [0, 0, 0, 0].pack("I*")'user32', 'GetClientRect', 'IP', 'I').call(handle, rect)
  puts "Gosu Size : #{[window.width, window.height]} - Real Size : #{rect.unpack("I*")[2..3]}"

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]

It's only works on Windows, I use GetClientRect to get the "real" client size. As you can see, the window was a lot smaller than expected.
So what I can do ? If this question was already answered, I'm really sorry because I have done some research before posting.

Another question, there is a way to get the gosu window handle on Windows ? Because I want to add some "extra-features" for the Windows users :D

Thanks, and please forgive my english :)

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill