From 9224412274e1e1a31a959083bb257a7d6ab2b113 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 19 Aug 2016 20:40:12 -0400 Subject: Add Sly manual. --- manuals/sly/Window-Creation.html | 177 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 manuals/sly/Window-Creation.html (limited to 'manuals/sly/Window-Creation.html') diff --git a/manuals/sly/Window-Creation.html b/manuals/sly/Window-Creation.html new file mode 100644 index 0000000..5e6dfc7 --- /dev/null +++ b/manuals/sly/Window-Creation.html @@ -0,0 +1,177 @@ + + + + + +Sly: Window Creation + + + + + + + + + + + + + + + + + + + + +
+

+Next: , Up: Booting   [Contents][Index]

+
+
+ +

4.1.1 Window Creation

+ +
+
(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: +

+
+
Scheme Procedure: make-window [#:title] [#:resolution] [#:fullscreen?]
+

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. +

+ +
+
Scheme Procedure: window? obj
+

Return #t if obj is a window. +

+ +
+
Scheme Procedure: window-title window
+

Return the title of window. +

+ +
+
Scheme Procedure: window-resolution window
+

Return the resolution of window. +

+ +
+
Scheme Procedure: window-fullscreen? window
+

Return #t if window is set to fullscreen mode. +

+ +

The following signals hold the state of the current window: +

+
+
Scheme Signal: window-width
+

The width of the current window. +

+ +
+
Scheme Signal: window-height
+

The height of the current window. +

+ +
+
Scheme Signal: window-size
+

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: +

+
+
Scheme Variable: window-resize-hook
+

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. +

+ +
+
Scheme Variable: window-close-hook
+

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: +

+
+
Scheme Procedure: open-window [window]
+

Open the game window using the settings in window. +

+ +
+
Scheme Procedure: close-window
+

Close the currently open window. +

+ +
+
Scheme Syntax: with-window window body
+

Evaluate body in the context of window. window +is opened before evaluating body, and closed afterwards. +

+ +
+
+

+Next: , Up: Booting   [Contents][Index]

+
+ + + + + -- cgit v1.2.3