CHANGELOG.md 43.6 KB
Newer Older
1
2
3

This document describes the changes in each version of chicken-sdl2.

4
5
6
7
8
9
This library follows [semantic versioning](http://semver.org).
Until version 1.0.0 is released, the maintainer reserves the right to
change the API if needed, possibly in ways that break compatibility
with previous versions. **Large backward incompatible changes are
unlikely**, but there may be small tweaks and fixes to the API if
problems are discovered.
10

11
12
13
After version 1.0.0 is released, the API is guaranteed to remain
stable (no backward incompatible changes) until the next new major
version (e.g. going from version 1.x to 2.0.0, or 2.x to 3.0.0).
14
15


John Croisant's avatar
John Croisant committed
16
# 0.4.1 (2021-10-21)
17

John Croisant's avatar
John Croisant committed
18
19
- Fixed several compile errors about undefined constants or functions
  when using old versions of SDL2.
John Croisant's avatar
John Croisant committed
20
21
- Fixed incorrect type declarations for `controller-axis-event-axis`
  and `controller-button-event-button`.
John Croisant's avatar
John Croisant committed
22
- chicken-sdl2 no longer depends on the miscmacros egg.
23
24
25


# 0.4.0 (2021-10-15)
John Croisant's avatar
John Croisant committed
26

27
28
29
30
31
32
33
34
35
36
37
## Backward Incompatible Changes

- The list of symbols returned by `renderer-info-texture-formats` now
  contains the symbol `unknown` once for each texture format with an
  unknown name. This can happen when a new texture format was added to
  SDL, but has not yet been added to chicken-sdl2. Previously, this
  would cause an error.

- `renderer-info-texture-formats-raw` now returns a list of integers
  instead of a pointer to a C array of integers.

38
39
40
41
42
43
44
- `controller-axis-event-axis` now returns a controller axis enum
  symbol. Use `controller-axis-event-axis-raw` to get an integer.

- `controller-button-event-button` now returns a controller button
  enum symbol. Use `controller-button-event-button-raw` to get an
  integer.

45
46
47
48
49
- `wait-event!` and `wait-event-timeout!` are now based on `delay!`
  by default, instead of SRFI-18's `thread-sleep!` procedure. If you
  are using SRFI-18 multithreading, you should provide a compatible
  delay procedure based on `thread-sleep!`. See wiki docs for details.

50
- Removed procedures which have been deprecated since chicken-sdl2 0.2.0:
John Croisant's avatar
John Croisant committed
51

52
53
54
55
      copy-color          copy-color*
      copy-colour         copy-colour*
      copy-point          copy-point*
      copy-rect           copy-rect*
56

57

58
## Bug Fixes
59

60
61
- Fixed several joystick procedures accidentally returning nothing.
  Thanks to megane for reporting this. Affected procedures:
62

63
64
65
66
67
      num-joysticks
      joystick-num-axes
      joystick-num-balls
      joystick-num-buttons
      joystick-num-hats
68

69
70
- Fixed `palette-set!` (and using `set!` with `palette-ref`) not
  behaving as expected. Thanks to kp for discovering this.
71

72

73
## New Features
74

75
76
Many new features have been added. Features which require a version of
SDL greater than 2.0.0 are marked with the required version.
77

78
### Cursor
79

80
New procedures:
John Croisant's avatar
John Croisant committed
81

82
83
84
85
86
87
88
89
90
91
92
```
cursor?
create-cursor                 create-cursor*
create-color-cursor           create-color-cursor*
create-colour-cursor          create-colour-cursor*
create-system-cursor          create-system-cursor*
free-cursor!
get-cursor                    cursor-set!
get-default-cursor
show-cursor?                  show-cursor!
```
John Croisant's avatar
John Croisant committed
93

94
### Display / Video Drivers
95

96
New procedures:
97
98

```
99
100
101
102
103
104
video-init!
video-quit!
get-num-video-drivers
get-video-driver
get-current-video-driver

105
106
get-num-video-displays
get-display-name
107
108
109
110
111
get-display-dpi                                   (SDL 2.0.4+)
get-display-bounds
get-display-usable-bounds                         (SDL 2.0.5+)
get-display-orientation                           (SDL 2.0.9+)
get-display-orientation-raw                       (SDL 2.0.9+)
112

113
114
115
116
117
118
119
get-num-display-modes
get-display-mode
get-current-display-mode
get-closest-display-mode
get-desktop-display-mode
```

120
121
122
123
124
125
126
127
128
129
130
131
132
### Events

- Added `display-event` event type. (SDL 2.0.9+)
- Added `drop-text`, `drop-begin`, and `drop-complete` event types. (SDL 2.0.5+).
- Added `take-focus` and `hit-test` window events (SDL 2.0.5+).

New procedures:

```
display-event?                                    (SDL 2.0.9+)
display-event-display                             (SDL 2.0.9+)
display-event-display-set!                        (SDL 2.0.9+)
display-event-event                               (SDL 2.0.9+)
John Croisant's avatar
John Croisant committed
133
display-event-event-raw                           (SDL 2.0.9+)
134
135
136
display-event-event-set!                          (SDL 2.0.9+)
display-event-data1                               (SDL 2.0.9+)
display-event-data1-set!                          (SDL 2.0.9+)
137
138
display-event-orientation                         (SDL 2.0.9+)
display-event-orientation-set!                    (SDL 2.0.9+)
139
140
141
142
143
144

drop-event-window-id                              (SDL 2.0.5+)
drop-event-window-id-set!                         (SDL 2.0.5+)
```

### Game Controller
145
146
147

Added the **sdl2:game-controller** and **sdl2:game-controller-button-bind**
struct record types and many function bindings related to
148
149
150
[game controllers](https://wiki.libsdl.org/CategoryGameController). [#41]

New procedures:
151
152
153
154
155

```
game-controller?
game-controller-open!
game-controller-close!
156
game-controller-from-instance-id                  (SDL 2.0.4+)
157
158
159
160
161
162
163
164
165
166
167
168
game-controller-update!

game-controller-event-state?
game-controller-event-state-set!

game-controller-attached?
game-controller-get-joystick
is-game-controller?

game-controller-mapping
game-controller-mapping-for-guid
game-controller-add-mapping!
169
170
171
172
173
game-controller-add-mappings-from-file!           (SDL 2.0.2+)
game-controller-add-mappings-from-rw!             (SDL 2.0.2+)
game-controller-num-mappings                      (SDL 2.0.6+)
game-controller-mapping-for-index                 (SDL 2.0.6+)
game-controller-mapping-for-device-index          (SDL 2.0.9+)
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

game-controller-name
game-controller-name-for-index

game-controller-get-axis
game-controller-get-axis-from-string
game-controller-get-axis-from-string-raw
game-controller-get-string-for-axis

game-controller-get-button
game-controller-get-button-from-string
game-controller-get-button-from-string-raw
game-controller-get-string-for-button

game-controller-get-bind-for-axis
game-controller-get-bind-for-button

John Croisant's avatar
John Croisant committed
191
192
193
194
195
196
game-controller-get-player-index                  (SDL 2.0.9+)
game-controller-get-product                       (SDL 2.0.6+)
game-controller-get-product-version               (SDL 2.0.6+)
game-controller-get-vendor                        (SDL 2.0.6+)
game-controller-rumble!                           (SDL 2.0.9+)

197
198
199
200
201
202
game-controller-button-bind?
game-controller-button-bind-type
game-controller-button-bind-type-raw
game-controller-button-bind-button
game-controller-button-bind-axis
game-controller-button-bind-hat
203
game-controller-button-bind-hat-mask-raw
204
205
206
207
208

controller-axis-event-axis-raw
controller-button-event-button-raw
```

209
### Joystick
210

211
New procedures:
John Croisant's avatar
John Croisant committed
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
```
joystick-get-axis-initial-state                   (SDL 2.0.6+)
joystick-get-device-instance-id                   (SDL 2.0.6+)
joystick-get-device-player-index                  (SDL 2.0.9+)
joystick-get-device-product                       (SDL 2.0.6+)
joystick-get-device-product-version               (SDL 2.0.6+)
joystick-get-device-type                          (SDL 2.0.6+)
joystick-get-device-type-raw                      (SDL 2.0.6+)
joystick-get-device-vendor                        (SDL 2.0.6+)
joystick-get-player-index                         (SDL 2.0.9+)
joystick-get-product                              (SDL 2.0.6+)
joystick-get-product-version                      (SDL 2.0.6+)
joystick-get-type                                 (SDL 2.0.6+)
joystick-get-type-raw                             (SDL 2.0.6+)
joystick-get-vendor                               (SDL 2.0.6+)
joystick-rumble!                                  (SDL 2.0.9+)

lock-joysticks!                                   (SDL 2.0.7+)
unlock-joysticks!                                 (SDL 2.0.7+)
```

### Mouse

New procedures:

```
capture-mouse!                                    (SDL 2.0.4+)
get-global-mouse-state                            (SDL 2.0.4+)
get-global-mouse-state-raw                        (SDL 2.0.4+)
get-mouse-focus
get-mouse-state
get-mouse-state-raw
get-relative-mouse-mode
get-relative-mouse-state
get-relative-mouse-state-raw
relative-mouse-mode-set!
warp-mouse-global!                                (SDL 2.0.4+)
warp-mouse-in-window!
```

### Surface

- You may now pass a pixel format enum symbol (or corresponding
  integer) to `make-surface` and `make-surface*` as the third
  argument, as an alternative to passing a pixel depth (which is also
  still supported).

- You may now pass a pixel format enum symbol (or corresponding
  integer) to `convert-surface` and `convert-surface*` as the second
  argument, as an alternative to passing a `sdl2:pixel-format` struct
  (which is also still supported).

New procedures:

```
create-rgb-surface-with-format*                   (SDL 2.0.5+)
create-rgb-surface-with-format-from*              (SDL 2.0.5+)
duplicate-surface
duplicate-surface*
surface-color-key?
surface-colour-key?
John Croisant's avatar
John Croisant committed
274
surface-rle?                                      (SDL 2.0.14+)
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299

compose-custom-blend-mode                         (SDL 2.0.6+)

get-yuv-conversion-mode                           (SDL 2.0.8+)
get-yuv-conversion-mode-raw                       (SDL 2.0.8+)
yuv-conversion-mode-set!                          (SDL 2.0.8+)
```

### Vulkan

- Added `vulkan` window flag. (SDL 2.0.6+)

New procedures:

```
vulkan-load-library!                              (SDL 2.0.6+)
vulkan-unload-library!                            (SDL 2.0.6+)
vulkan-get-vk-get-instance-proc-addr              (SDL 2.0.6+)
vulkan-get-instance-extensions                    (SDL 2.0.6+)
vulkan-get-drawable-size                          (SDL 2.0.6+)
vulkan-create-surface                             (SDL 2.0.6+)
```

### Window

300
301
- Added `always-on-top` window flag. (SDL 2.0.5+)

302
303
304
New procedures:

```
John Croisant's avatar
John Croisant committed
305
flash-window!                                     (SDL 2.0.16+)
306
307
set-window-modal-for!                             (SDL 2.0.5+)
window-borders-size                               (SDL 2.0.5+)
308
309
310
311
window-keyboard-grab?                             (SDL 2.0.16+)
window-keyboard-grab-set!                         (SDL 2.0.16+)
window-mouse-grab?                                (SDL 2.0.16+)
window-mouse-grab-set!                            (SDL 2.0.16+)
312
313
314
window-opacity                                    (SDL 2.0.5+)
window-opacity-set!                               (SDL 2.0.5+)
window-resizable?
315
316
317
window-resizable-set!                             (SDL 2.0.5+)
window-always-on-top?                             (SDL 2.0.5+)
window-always-on-top-set!                         (SDL 2.0.16+)
318
319
320
321
```

### Other Features

322
- Added hint enums up to SDL 2.0.16.
323
324
325
326
- Added new blend mode enum.

      mul                                            (SDL 2.0.12+)

327
328
329
330
331
- Added new game controller button enums.

      misc1     touchpad                             (SDL 2.0.14+)
      paddle1   paddle2   paddle3   paddle4          (SDL 2.0.14+)

332
333
334
335
336
337
338
339
340
- Added new keyboard keycode enums.

      app1           app2                            (SDL 2.0.5+)
      audio-rewind   audio-fast-forward              (SDL 2.0.5+)

- Added new keyboard scancode enums.

      audio-rewind   audio-fast-forward              (SDL 2.0.5+)

341
342
343
344
345
346
347
348
349
350
351
352
353
- Added new pixel format enums.

      nv12      nv21                                 (SDL 2.0.4+)
      rgba32    argb32    bgra32    abgr32           (SDL 2.0.5+)

- Added enum groups:
  - Blend factors (SDL 2.0.6+)
  - Blend operations (SDL 2.0.6+)
  - Display event IDs (SDL 2.0.9+)
  - Display orientations (SDL 2.0.9+)
  - Game controller axes
  - Game controller buttons
  - Joystick types (SDL 2.0.6+)
John Croisant's avatar
John Croisant committed
354
  - Window flash operations (SDL 2.0.16+)
355
356
357
358
359
360
361
362

New procedures:

```
get-base-path                                     (SDL 2.0.1+)
get-hint-boolean                                  (SDL 2.0.5+)
get-power-info
get-pref-path                                     (SDL 2.0.1+)
John Croisant's avatar
John Croisant committed
363
364
get-touch-device-type                             (SDL 2.0.10+)
get-touch-device-type-raw                         (SDL 2.0.10+)
365
is-tablet?                                        (SDL 2.0.9+)
John Croisant's avatar
John Croisant committed
366
open-url                                          (SDL 2.0.16+)
367
368
369
370
render-integer-scale-set!                         (SDL 2.0.5+)
render-integer-scale?                             (SDL 2.0.5+)
show-simple-message-box
```
John Croisant's avatar
John Croisant committed
371

John Croisant's avatar
John Croisant committed
372

John Croisant's avatar
John Croisant committed
373
## Other Changes
374

John Croisant's avatar
John Croisant committed
375
376
377
378
379
380
381
382
383
- Added type declarations for over 500 procedures [#13, #47].
  This allows CHICKEN to warn you at compile time if you pass
  incorrect argument types, to make debugging your code easier,
  and allows the compiler to do some performance optimizations.

- Lots of work under the hood to reduce boilerplate for function
  bindings that return an error code on failure. Thanks to megane for
  spearheading this effort.

John Croisant's avatar
John Croisant committed
384
385
- Optimized converting symbols to enum integers and vice versa.

386
- chicken-sdl2 no longer depends on SRFI-18 or SRFI-69.
387

John Croisant's avatar
John Croisant committed
388

John Croisant's avatar
John Croisant committed
389
# 0.3.0 (2019-02-13)
John Croisant's avatar
John Croisant committed
390

391
- Ported the egg to be compatible with both CHICKEN 4 and CHICKEN 5.
John Croisant's avatar
John Croisant committed
392
393

- Improved the way the installer handles compiler and linker flags [!1].
394
395
396
  It will now attempt to automatically discover the correct compiler and linker flags,
  using the `sdl2-config` command.
  In special cases, set the `SDL2_CFLAGS` and `SDL2_LDFLAGS` environment variables
John Croisant's avatar
John Croisant committed
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
  (instead of `SDL2_FLAGS`, which is now ignored).
  The installer will prefix the flags with "-C" or "-L" before passing them to `csc`,
  so that they are correctly passed along to the C compiler or linker.
  Thanks to Christian Kellermann for reporting this issue and submitting the initial patch.

- Added support for the SDL2 framework on macOS [#42].
  The installer will automatically use the framework
  if `sdl2-config` is not available and the framework is installed
  in either the `/Library/Frameworks` or `/System/Library/Frameworks` directories.
  Thanks to Laughing Man for suggesting this.
  In special cases you can use the `SDL2_CFLAGS` and `SDL2_LDFLAGS` environment variables:

  ```
  export SDL2_CFLAGS="-F/path/to/your/frameworks"
  export SDL2_LDFLAGS="-F/path/to/your/frameworks -framework SDL2"
  chicken-install sdl2
  ```

- Due to internal changes while porting the egg to CHICKEN 5,
  version feature identifiers such as `sdl2-0.3.0+` and `libSDL-2.0.4+`
  are no longer automatically available at macro-expansion time in compiled code.
  (They are still automatically available at run time with the `feature?` function.)
  If you want to do version detection with `cond-expand` or the `#+foo` syntax,
  you must additionally import the egg for syntax:

  - CHICKEN 4: `(use-for-syntax sdl2)`
  - CHICKEN 5: `(import-for-syntax sdl2)`

- Fixed an issue where managed instances of
  `sdl2:color`, `sdl2:keysym`, `sdl2:point`, and `sdl2:rect`
John Croisant's avatar
John Croisant committed
427
  would change hash values when the garbage collector runs.
John Croisant's avatar
John Croisant committed
428
  This caused bugs when using any of those objects as keys in a hash table.
John Croisant's avatar
John Croisant committed
429
430
431
432
433
434
435
436
437
438
439
440
  This is caused by [a quirk in CHICKEN related to locatives](https://bugs.call-cc.org/ticket/1293).
  The quirk has been worked around by no longer storing locatives.

- Fixed a potential security issue with `set-error!`.
  Before, the string was passed directly to `SDL_SetError`,
  which treated the string as a format string (for `vnsprintf`).
  That caused some compilers to emit a security warning: "format string is not a string literal".
  Now, up to 1024 chars of the string are used as verbatim content.

- Fixed incorrect argument type declaration for `render-scale-set!`.
  It accepts floating point numbers, but it was incorrectly declared to accept integers.

441

John Croisant's avatar
John Croisant committed
442
# 0.2.0 (2016-02-13)
443

444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
## Backward Incompatible Changes

There have been several backward incompatible changes to improve type
checks for integer arguments. These changes affect **all function
bindings and struct field setters that accept integer arguments**.
\[[#32](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/32)\]

- All procedures that accept integer arguments now accept inexact
  integers (e.g. 1.0) as well as exact integers (e.g. 1). Before, some
  procedures would signal an exception when given an inexact integer.

- Integer arguments are now checked to make sure they are integers.
  Before, some procedures would accept non-integer numbers (e.g. 1.99)
  and truncate them to integers (e.g. 1), which could cause unexpected
  results. Now, an exception will be signalled if the argument is not
  an integer.

- Integers arguments are now checked to make sure they are in the
  proper range for their data representation. E.g. 8-bit unsigned
  integers must be in the range [0, 255]. Before, integer arguments
John Croisant's avatar
John Croisant committed
464
465
466
  would sometimes overflow, which could cause unexpected results.
  Now, an exception will be signalled if the integer is too low or too
  high.
467

468
469
470
471
472
473
Other backward incompatible changes in this version:

- `get-window-from-id` now signals an exception of kind `(exn sdl2)`
  if there is no window with the given ID. Before, it returned a null
  sdl2:window, which was inconsistent with this egg's conventions.

474

475
476
477
478
479
480
481
482
483
484
485
486
487
## Deprecations

The following procedures have new names, for consistency with Scheme
naming conventions. The old names still exist for backward
compatibility, but will be removed in a future version.
You should migrate to the new names as soon as possible.

- Deprecated: `copy-color`.  Renamed to `color-copy`.
- Deprecated: `copy-colour`. Renamed to `colour-copy`.
- Deprecated: `copy-point`.  Renamed to `point-copy`.
- Deprecated: `copy-rect`.   Renamed to `rect-copy`.

The following procedures are deprecated because they are not very
John Croisant's avatar
John Croisant committed
488
useful and they are easy to define using other procedures if needed.
489
490
491
492
493
494
495
496
They will be removed in a future version.

- Deprecated: `copy-color*`.  Use `(color-copy! c (make-color*))` instead.
- Deprecated: `copy-colour*`. Use `(colour-copy! c (make-colour*))` instead.
- Deprecated: `copy-point*`.  Use `(point-copy! p (make-point*))` instead.
- Deprecated: `copy-rect*`.   Use `(rect-copy! r (make-rect*))` instead.


497
498
499
500
501
502
503
504
505
506
507
## Renderer (2D Accelerated Rendering)

Added the **sdl2:renderer** struct record type and many function bindings related to
[2D accelerated rendering](https://wiki.libsdl.org/CategoryRender)
\[[#1](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/1),
[#2](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/2),
[#3](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/3),
[#5](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/5)\]:

```
renderer?
John Croisant's avatar
John Croisant committed
508
509
510
511
create-renderer!              create-software-renderer!     destroy-renderer!
create-window-and-renderer!   get-renderer
get-renderer-info             get-renderer-info*
num-render-drivers            render-driver-info
512
513

renderer-output-size
John Croisant's avatar
John Croisant committed
514
515
516
517
render-clip-rect              render-clip-rect-set!         render-clip-enabled?
render-logical-size           render-logical-size-set!
render-scale                  render-scale-set!
render-viewport               render-viewport-set!
518
519

render-present!
John Croisant's avatar
John Croisant committed
520
521
render-copy!                  render-copy-ex!
render-target-supported?      render-target                 render-target-set!
522
523
render-read-pixels-raw

John Croisant's avatar
John Croisant committed
524
525
526
render-draw-blend-mode        render-draw-blend-mode-set!   render-draw-blend-mode-raw
render-draw-color             render-draw-color-set!
render-draw-colour            render-draw-colour-set!
527
render-clear!
John Croisant's avatar
John Croisant committed
528
529
530
531
render-draw-line!             render-draw-lines!
render-draw-point!            render-draw-points!
render-draw-rect!             render-draw-rects!
render-fill-rect!             render-fill-rects!
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
```


## Renderer Info

Added the **sdl2:renderer-info** struct record type
\[[#1](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/1)\]:

```
renderer-info?                     free-renderer-info!
renderer-info-name
renderer-info-flags                renderer-info-flags-raw
renderer-info-num-texture-formats
renderer-info-texture-formats      renderer-info-texture-formats-raw
renderer-info-max-texture-width    renderer-info-max-texture-height
```


## Texture

Added the **sdl2:texture** struct record type and many related function bindings
\[[#4](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/4)]:

```
texture?
557
558
559
create-texture                     create-texture*
create-texture-from-surface        create-texture-from-surface*
destroy-texture!
560
query-texture                      query-texture-raw
561
texture-format                     texture-access
562
563
564
565
566
567
568
569
570
571
texture-w                          texture-h
lock-texture-raw!                  unlock-texture!
update-texture-raw!                update-yuv-texture-raw!
texture-alpha-mod                  texture-alpha-mod-set!
texture-blend-mode                 texture-blend-mode-set!
texture-color-mod                  texture-color-mod-set!
texture-colour-mod                 texture-colour-mod-set!
gl-bind-texture!                   gl-unbind-texture!
```

John Croisant's avatar
John Croisant committed
572

573
574
575
576
577
578
579
580
581
582
583
## Hints

Added function bindings related to [hints](https://wiki.libsdl.org/CategoryHints).
\[[#7](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/7)\]

```
get-hint
set-hint!
clear-hints!
```

John Croisant's avatar
John Croisant committed
584

John Croisant's avatar
John Croisant committed
585
586
587
588
589
590
## SDL 2.0.4 Support

Added support for various feature that were added in SDL 2.0.4. These
are only available if the egg is compiled with SDL 2.0.4 or higher.
\[[#37](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/37)\]

591
- Added `grabbed-window` procedure.
592
- Added `point-in-rect?` procedure.
593
594
- Added `render-clip-enabled?` procedure.
- Added support for the `mouse-capture` window flag symbol.
595
596
- Added `mouse-wheel-event-direction` and
  `mouse-wheel-event-direction-set!` struct field accessors.
597
598
- Added support for the `context-release-behavior` OpenGL attribute.
  It can be set to the symbols `none` or `flush`.
599
600
- Added `joystick-from-instance-id`.
- Added `joystick-current-power-level`.
601

John Croisant's avatar
John Croisant committed
602

John Croisant's avatar
John Croisant committed
603
604
605
606
## Color, Point, and Rect Operations

- Added `color->values`, `point->values`, and `rect->values`. These
  return the components of those types as multiple values, so that you
John Croisant's avatar
John Croisant committed
607
608
609
610
611
612
  can easily destructure these types with `receive` or `let-values`.

- Renamed several procedures for consistency with Scheme conventions.
  The old names still exist for backward compatibility, but will be
  removed in a future version:

John Croisant's avatar
John Croisant committed
613
614
615
616
    - `copy-color`  renamed to `color-copy`
    - `copy-colour` renamed to `colour-copy`
    - `copy-point`  renamed to `point-copy`
    - `copy-rect`   renamed to `rect-copy`
John Croisant's avatar
John Croisant committed
617

618
619
- Added `color-copy!` (aka `colour-copy!`), `point-copy!`, and
  `rect-copy!`. They efficiently copy the values from the source
John Croisant's avatar
John Croisant committed
620
621
622
  struct into the destination struct, and return the modified
  destination struct.

623
- Added various color mathematical operations:
624

John Croisant's avatar
John Croisant committed
625
    ```
John Croisant's avatar
John Croisant committed
626
627
    color-scale     color-mult     color-add      color-sub
    color-scale!    color-mult!    color-add!     color-sub!
John Croisant's avatar
John Croisant committed
628
629
    color-lerp
    color-lerp!
John Croisant's avatar
John Croisant committed
630
631
632
633

    ("colour" aliases)
    colour-scale    colour-mult    colour-add     colour-sub
    colour-scale!   colour-mult!   colour-add!    colour-sub!
John Croisant's avatar
John Croisant committed
634
635
    colour-lerp
    colour-lerp!
John Croisant's avatar
John Croisant committed
636
    ```
637
638
639

- Added various point mathematical operations:

John Croisant's avatar
John Croisant committed
640
    ```
John Croisant's avatar
John Croisant committed
641
642
643
644
    point-scale     point-unscale       point-move
    point-scale!    point-unscale!      point-move!
    point-add       point-sub           point-lerp
    point-add!      point-sub!          point-lerp!
John Croisant's avatar
John Croisant committed
645
    ```
646
647
648

- Added various rect mathematical operations:

John Croisant's avatar
John Croisant committed
649
    ```
John Croisant's avatar
John Croisant committed
650
651
652
653
654
655
656
657
    rect-scale      rect-unscale
    rect-scale!     rect-unscale!
    rect-move       rect-add-point      rect-sub-point
    rect-move!      rect-add-point!     rect-sub-point!
    rect-grow       rect-grow/center
    rect-grow!      rect-grow/center!
    rect-lerp       rect-lerp-xy
    rect-lerp!      rect-lerp-xy!
John Croisant's avatar
John Croisant committed
658
    ```
659

John Croisant's avatar
John Croisant committed
660

661
## Performance Improvements
662
663
664
665
666
667
668
669

- Managed instances of sdl2:color, sdl2:event, sdl2:keysym,
  sdl2:point, and sdl2:rect are now allocated in CHICKEN-managed
  memory. This improves performance of garbage collecting managed
  instances of those types. Unmanaged instances are not affected.
  Thanks to Kooda Loutre for suggesting this improvement.
  \[[#30](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/30)\]

670
- Significantly improved the performance of initializing managed and
671
672
  unmanaged instances of sdl2:color, sdl2:point, and sdl2:rect.

673
674
- Significantly improved performance of `color-set!`, `point-set!`,
  and `rect-set!` when all arguments are specified. This performance
675
676
  improvement does not apply if any argument is omitted or #f.

677
678
679
- Fixed a performance bug in all struct field setters. Field guards
  were being created every time a field setter was called. Each guard
  is now created only once, at startup, as was originally intended.
680
681
682
  This improves the performance of all struct field setters.


683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
## Feature Identifiers

Added feature identifiers which can be used to detect the versions of
the sdl2 egg and SDL at compile time or run time, for example using
the `cond-expand` macro, `#+foo` syntax, or the `feature?` procedure.

Some or all of the following feature identifiers will be registered
depending on the circumstances:

```
sdl2                Using any version of the sdl2 egg
sdl2-0.2.0+         Using sdl2 egg 0.2.0 or higher

libSDL-2.0.0+       sdl2 egg was compiled with SDL 2.0.0 or higher
libSDL-2.0.1+       ... SDL 2.0.1 or higher
libSDL-2.0.2+       ... SDL 2.0.2 or higher
libSDL-2.0.3+       ... SDL 2.0.3 or higher
libSDL-2.0.4+       ... SDL 2.0.4 or higher
```

These are cumulative, so if you are using sdl2 egg version 0.2.0 with
SDL version 2.0.4, all of the above identifiers will be defined.


## Other changes
708

John Croisant's avatar
John Croisant committed
709
710
- Added the `struct-eq?` procedure. You should use this procedure to
  compare the identities of struct instances. Other procedures, such
John Croisant's avatar
John Croisant committed
711
  as `eq?` or `equal?`, may not work correctly in the future due to
John Croisant's avatar
John Croisant committed
712
713
  changes in the implementation of struct records.

714
715
716
- Added the `egg-version` procedure, which returns a list of three
  integers indicating the version of the sdl2 egg itself. This is
  independent of the version of SDL.
717

718
719
720
721
722
723
724
725
- `fill-rects!` and `update-window-surface-rects!` can now accept a
  vector of sdl2:rects as well as a list of sdl2:rects. Before, they
  only accepted a list of sdl2:rects.

- `enclose-points` now can now accept a vector of sdl2:points as well
  as a list of sdl2:points. Before, it only accepted a list of
  sdl2:points.

726
727
728
- Added support for the `allow-high-dpi` window flag symbol.
  It requires SDL version 2.0.1 or higher.

729
730
731
- Added an install flag to enable profiling in the sdl2 egg. If you
  run chicken-install with the `-D sdl2-profile` flag, the sdl2 egg
  will be compiled with the `-profile` flag, which enables performance
732
733
734
  profiling of sdl2 procedures when any program uses the sdl2 egg.
  This can help you diagnose performance issues in the sdl2 egg and/or
  in your program. See the CHICKEN manual section
John Croisant's avatar
John Croisant committed
735
  "[Using the compiler](https://wiki.call-cc.org/man/5/Using%20the%20compiler)"
736
  for more information about profiling. Profiling greatly reduces
737
738
739
740
  performance, and creates a new "PROFILE.###" file each time the
  program is run, so you should only enable profiling when you are
  diagnosing performance issues.

741
742


John Croisant's avatar
John Croisant committed
743
744
745
746
747
748
749
750
# 0.1.1 (2015-12-22)

- Fixed a compile error when compiling with GCC 4:
  "‘for’ loop initial declarations are only allowed in C99 mode".
  Thanks to Evan Hanson for reporting this issue.
  \[[#29](https://gitlab.com/chicken-sdl2/chicken-sdl2/issues/29)\]


751

John Croisant's avatar
John Croisant committed
752
753
754
# 0.1.0 (2015-12-19)

Initial release. The following procedures were included:
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000

## General

Initialization and cleanup:

```
set-main-ready!
init!                              init-subsystem!
quit!                              quit-subsystem!
was-init
```

Miscellaneous:

```
get-error                          set-error!                         clear-error!
get-platform
screen-saver-enabled?              screen-saver-enabled-set!
has-clipboard-text?                get-clipboard-text                 set-clipboard-text!
```

Struct memory management:

```
struct-null?
```


## Color

Related to the **sdl2:color** struct record type
(each procedure has an alias spelled as "colour"):

```
color?                   colour?
make-color               make-color*              free-color!
make-colour              make-colour*             free-colour!
color-r                  color-r-set!             colour-r                 colour-r-set!
color-g                  color-g-set!             colour-g                 colour-g-set!
color-b                  color-b-set!             colour-b                 colour-b-set!
color-a                  color-a-set!             colour-a                 colour-a-set!
color-set!                                        colour-set!
color->list                                       colour->list
color=?                                           colour=?
copy-color                                        copy-colour
copy-color*                                       copy-colour*
```


## Event

```
event-state                        event-state-set!
flush-event!                       flush-events!
has-event?                         has-events?                        quit-requested?
get-events!                        peek-events                        poll-event!
pump-events!                       push-event!
wait-event!                        wait-event-timeout!
register-events!
```

Related to the **sdl2:event** struct record type:

```
event?
make-event                         make-event*                        free-event!
event-type                         event-type-set!                    event-type-raw
event-timestamp                    event-timestamp-set!
```

Related to the **sdl2:controller-axis-event** variant:

```
controller-axis-event?
controller-axis-event-which        controller-axis-event-which-set!
controller-axis-event-axis         controller-axis-event-axis-set!
controller-axis-event-value        controller-axis-event-value-set!
```

Related to the **sdl2:controller-button-event** variant:

```
controller-button-event?
controller-button-event-which      controller-button-event-which-set!
controller-button-event-button     controller-button-event-button-set!
controller-button-event-state      controller-button-event-state-set!
```

Related to the **sdl2:controller-device-event** variant:

```
controller-device-event?
controller-device-event-which      controller-device-event-which-set!
```

Related to the **sdl2:dollar-gesture-event** variant:

```
dollar-gesture-event?
dollar-gesture-event-touch-id      dollar-gesture-event-touch-id-set!
dollar-gesture-event-gesture-id    dollar-gesture-event-gesture-id-set!
dollar-gesture-event-num-fingers   dollar-gesture-event-num-fingers-set!
dollar-gesture-event-error         dollar-gesture-event-error-set!
dollar-gesture-event-x             dollar-gesture-event-x-set!
dollar-gesture-event-y             dollar-gesture-event-y-set!
```

Related to the **sdl2:drop-event** variant:

```
drop-event?
drop-event-file                    drop-event-file-set!
```

Related to the **sdl2:joy-axis-event** variant:

```
joy-axis-event?
joy-axis-event-which               joy-axis-event-which-set!
joy-axis-event-axis                joy-axis-event-axis-set!
joy-axis-event-value               joy-axis-event-value-set!
```

Related to the **sdl2:joy-ball-event** variant:

```
joy-ball-event?
joy-ball-event-which               joy-ball-event-which-set!
joy-ball-event-ball                joy-ball-event-ball-set!
joy-ball-event-xrel                joy-ball-event-xrel-set!
joy-ball-event-yrel                joy-ball-event-yrel-set!
```

Related to the **sdl2:joy-button-event** variant:

```
joy-button-event?
joy-button-event-which             joy-button-event-which-set!
joy-button-event-button            joy-button-event-button-set!
joy-button-event-state             joy-button-event-state-set!
```

Related to the **sdl2:joy-device-event** variant:

```
joy-device-event?
joy-device-event-which             joy-device-event-which-set!
```

Related to the **sdl2:joy-hat-event** variant:

```
joy-hat-event?
joy-hat-event-which                joy-hat-event-which-set!
joy-hat-event-hat                  joy-hat-event-hat-set!
joy-hat-event-value                joy-hat-event-value-set!           joy-hat-event-value-raw
```

Related to the **sdl2:keyboard-event** variant:

```
keyboard-event?
keyboard-event-window-id           keyboard-event-window-id-set!
keyboard-event-state               keyboard-event-state-set!
keyboard-event-repeat              keyboard-event-repeat-set!
keyboard-event-keysym              keyboard-event-keysym-set!
keyboard-event-scancode            keyboard-event-scancode-set!       keyboard-event-scancode-raw
keyboard-event-sym                 keyboard-event-sym-set!            keyboard-event-sym-raw
keyboard-event-mod                 keyboard-event-mod-set!            keyboard-event-mod-raw
```

Related to the **sdl2:mouse-button-event** variant:

```
mouse-button-event?
mouse-button-event-window-id       mouse-button-event-window-id-set!
mouse-button-event-which           mouse-button-event-which-set!
mouse-button-event-button          mouse-button-event-button-set!     mouse-button-event-button-raw
mouse-button-event-state           mouse-button-event-state-set!
mouse-button-event-x               mouse-button-event-x-set!
mouse-button-event-y               mouse-button-event-y-set!
```

Related to the **sdl2:mouse-motion-event** variant:

```
mouse-motion-event?
mouse-motion-event-window-id       mouse-motion-event-window-id-set!
mouse-motion-event-which           mouse-motion-event-which-set!
mouse-motion-event-state           mouse-motion-event-state-set!      mouse-motion-event-state-raw
mouse-motion-event-x               mouse-motion-event-x-set!
mouse-motion-event-y               mouse-motion-event-y-set!
mouse-motion-event-xrel            mouse-motion-event-xrel-set!
mouse-motion-event-yrel            mouse-motion-event-yrel-set!
```

Related to the **sdl2:mouse-wheel-event** variant:

```
mouse-wheel-event?
mouse-wheel-event-window-id        mouse-wheel-event-window-id-set!
mouse-wheel-event-which            mouse-wheel-event-which-set!
mouse-wheel-event-x                mouse-wheel-event-x-set!
mouse-wheel-event-y                mouse-wheel-event-y-set!
```

Related to the **sdl2:multi-gesture-event** variant:

```
multi-gesture-event?
multi-gesture-event-touch-id       multi-gesture-event-touch-id-set!
multi-gesture-event-dtheta         multi-gesture-event-dtheta-set!
multi-gesture-event-ddist          multi-gesture-event-ddist-set!
multi-gesture-event-x              multi-gesture-event-x-set!
multi-gesture-event-y              multi-gesture-event-y-set!
multi-gesture-event-num-fingers    multi-gesture-event-num-fingers-set!
```

Related to the **sdl2:quit-event** variant:

```
quit-event?
```

Related to the **sdl2:sys-wm-event** variant:

```
sys-wm-event?
sys-wm-event-msg-raw               sys-wm-event-msg-raw-set!
```

Related to the **sdl2:text-editing-event** variant:

```
text-editing-event?
text-editing-event-window-id       text-editing-event-window-id-set!
text-editing-event-text            text-editing-event-text-set!
text-editing-event-start           text-editing-event-start-set!
text-editing-event-length          text-editing-event-length-set!
```

Related to the **sdl2:text-input-event** variant:

```
text-input-event?
text-input-event-window-id         text-input-event-window-id-set!