New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window#resize? #255
Comments
this should be easy making use of https://wiki.libsdl.org/SDL_SetWindowSize |
https://gist.github.com/Dahrkael/85db6989dffd24cf5ae105a4a60a6e4c <- for future reference |
Thanks for you nudging me! It was pretty straightforward. Needs some testing on Windows and Linux, then 0.10.9 is ready to go. |
There's no API for resizing windows from Ruby, however you can resize by recalling initialize with a different resolution. Example of a Ruby implementation of the resize method: class Window < Gosu::Window
def initialize(width, height)
super
end
def resize(width, height, fullscreen=fullscreen?)
initialize(width, height)
self.fullscreen = fullscreen
end
end
window = Window.new(1280, 720)
window.resize(1920, 1080, true) |
Well, thats not exactly true, although you're right that its a bit hidden and not intuitive at the moment. You can set the width and height of an Window in the Ruby interface which triggers an resize. %rename("width=") setWidth;
%rename("height=") setHeight;
%rename("fullscreen=") setFullscreen;
void setWidth(unsigned width) {
$self->resize(width, $self->height(), $self->fullscreen());
}
void setHeight(unsigned height) {
$self->resize($self->width(), height, $self->fullscreen());
}
void setFullscreen(bool fullscreen) {
$self->resize($self->width(), $self->height(), fullscreen);
} Don't know about the reasons for @jlnr to
but maybe it can be rethought while we're working on #437 |
Ah, I never actually tried setting the width and height that way. It's quite a lot better than my method. |
There is a new forum thread about resizing windows or changing resolutions almost every week. :)
I think a good first addition would be
Window#resize(width, height, fullscreen)
, but the question is, when are you allowed to call it? I think it should raise an exception when called fromWindow#draw
but work everywhere else.(Live-resizable windows are a related, but different issue.)
The text was updated successfully, but these errors were encountered: