Next: The Game Loop, Up: Booting [Contents][Index]
(use-modules (sly window))
Sly uses the windowing features of SDL 1.2 under the hood, which currently restricts Sly applications to using only a single window. SDL2 support will come in a future release.
The window data structure:
Create a new window object. title
is a string to display in
the window’s title bar. resolution
is a 2D vector that
specifies the dimensions of the window in pixels. fullscreen?
is a boolean that toggles fullscreen mode.
Return #t
if obj
is a window.
Return the title of window
.
Return the resolution of window
.
Return #t
if window
is set to fullscreen mode.
The following signals hold the state of the current window:
The width of the current window.
The height of the current window.
The size of the current window as a 2D vector.
In addition to signals, the following hooks are triggered upon certain changes to window state:
This hook is run when the current window is resized. Procedures added
to this hook should accept two arguments: Numbers width
and
height
, the new dimensions of the window in pixels.
This hook is run when the close button is clicked. Note that this event is simply a request from the user to close the window, it does not mean that the window has actually been closed. Procedures added to this hook should accept no arguments.
The following procedures are used to open/close windows:
Open the game window using the settings in window
.
Close the currently open window.
Evaluate body
in the context of window
. window
is opened before evaluating body
, and closed afterwards.
Next: The Game Loop, Up: Booting [Contents][Index]