Gosu::Window
Constructors
Instance methods
This method is called before update if a button is pressed while the window has focus.
By default, this will toggle fullscreen mode if the user presses Alt+Enter (Windows, Linux), cmd+F (macOS), or F11 (on all operating systems). To support these shortcuts in your application, make sure to call super in your implementation.
id the button's platform-defined id.
See button_up
See Gosu.button_down?
This method is called before update if a button is released while the window has focus.
id the button's platform-defined id.
See button_down
See button_down?
This method is called whenever the user tries to close the window, e.g. by clicking the [x]
button in the window's title bar.
If you do not want the window to close immediately, you should override this method and
call the close! when needed.
This method is called after every update and whenever the OS wants the window to repaint itself. Your application's rendering code should go here.
See needs_redraw?
Called when a file is dropped onto the window.
filename the filename of the dropped file. When multiple files are dropped, this method will be called several times.
The window's height, in pixels. This only counts the drawable area and does not include any borders or decorations added by the window manager.
This method can be overriden to control the visibility of the system cursor over your window, e.g., for level editors or other situations where introducing a custom cursor or hiding the default one is not desired.
Returns whether the system cursor should be shown.
This method can be overriden to give the game a chance to opt out of a call to draw; however, the operating system can still force a redraw for any reason.
Returns whether the window needs to be redrawn.
See #draw
Sets window's width, height and whether window is fullscreen.
Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
The currently active TextInput. If not nil, all keyboard input will be handled by this object.
Returns the currently active text input, if any.
Sets the active TextInput to input. Set to nil to disable keyboard capture.
EXPERIMENTAL - MAY DISAPPEAR WITHOUT WARNING.
Performs a single step in the main loop. This can be useful for integrating Gosu with other libraries that have their own main loop, e.g. Ruby/Tk.
See: https://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=1218
If you find a good way to use tick, please let us know on the forum and we can make this a part of Gosu's stable interface.
Thank you!
This method is called once every update_interval milliseconds while the window is being shown. Your application's main logic should go here.
The window's width, in pixels. This only counts the drawable area and does not include any borders or decorations added by the window manager.