Skip to content

Commit 7eacb54

Browse files
committed
Sync with master
2 parents a538de7 + 1756e02 commit 7eacb54

File tree

7 files changed

+915
-73
lines changed

7 files changed

+915
-73
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ before_script:
2727
export PATH=$HOME/.local/bin:$PATH
2828
script:
2929
- |
30-
travis-cargo build -- --all-features &&
31-
travis-cargo test -- --all-features &&
32-
travis-cargo --only stable doc -- --all-features
30+
travis-cargo build -- --features "gfx image ttf mixer" &&
31+
travis-cargo test -- --features "gfx image ttf mixer" &&
32+
travis-cargo --only stable doc -- --features "gfx image ttf mixer"
3333
after_success:
3434
- travis-cargo --only stable doc-upload
3535
env:

Cargo.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ optional = true
3535

3636
[features]
3737

38+
unsafe_textures = []
3839
default = []
3940
ttf = []
4041
image = []
@@ -44,3 +45,80 @@ mixer = []
4445
use-bindgen = ["sdl2-sys/use-bindgen"]
4546
use-pkgconfig = ["sdl2-sys/use-pkgconfig"]
4647
use_mac_framework = ["sdl2-sys/use_mac_framework"]
48+
49+
[[example]]
50+
name = "animation"
51+
52+
[[example]]
53+
name = "audio-queue-squarewave"
54+
55+
[[example]]
56+
name = "audio-wav"
57+
58+
[[example]]
59+
name = "audio-whitenoise"
60+
61+
[[example]]
62+
name = "demo"
63+
64+
[[example]]
65+
name = "game-controller"
66+
67+
[[example]]
68+
required-features = ["unsafe_textures"]
69+
name = "game-of-life-unsafe-textures"
70+
71+
[[example]]
72+
name = "game-of-life"
73+
74+
[[example]]
75+
required-features = ["gfx"]
76+
name = "gfx-demo"
77+
78+
[[example]]
79+
name = "haptic"
80+
81+
[[example]]
82+
required-features = ["image"]
83+
name = "image-demo"
84+
85+
[[example]]
86+
name = "joystick"
87+
88+
[[example]]
89+
name = "keyboard-state"
90+
91+
[[example]]
92+
name = "message-box"
93+
94+
[[example]]
95+
required-features = ["mixer"]
96+
name = "mixer-demo"
97+
98+
[[example]]
99+
name = "mouse-state"
100+
101+
[[example]]
102+
name = "no-renderer"
103+
104+
[[example]]
105+
name = "relative-mouse-state"
106+
107+
[[example]]
108+
name = "renderer-target"
109+
110+
[[example]]
111+
name = "renderer-texture"
112+
113+
[[example]]
114+
name = "renderer-yuv"
115+
116+
[[example]]
117+
name = "resource-manager"
118+
119+
[[example]]
120+
required-features = ["ttf"]
121+
name = "ttf-demo"
122+
123+
[[example]]
124+
name = "window-properties"

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ If you want a library compatible with earlier versions of SDL, please see
1717

1818
# Documentation
1919

20-
* [master documentation](https://rust-sdl2.github.io/rust-sdl2/sdl2/)
21-
* [crates.io documentation](https://docs.rs/sdl2/)
20+
* [crates.io documentation](https://docs.rs/sdl2/), with no features at all.
21+
* [master documentation](https://rust-sdl2.github.io/rust-sdl2/sdl2/) with the following features:
22+
* gfx
23+
* image
24+
* mixer
25+
* ttf
2226

2327
# Requirements
2428

@@ -299,6 +303,19 @@ You can see the full list in the `examples/` folder. Some examples require some
299303
300304
Replace "gfx" by the feature(s) needed for the example you want.
301305

306+
# About the `unsafe_textures` feature
307+
308+
In the `sdl2::render` module, `Texture` has by default lifetimes to prevent it from out-living its parent `TextureCreator`.
309+
These lifetimes are sometimes too hard to deal with in Rust, and so you have the option to enable the `unsafe_textures` feature.
310+
311+
This removes the lifetimes on the `Texture`s, at the cost of optional manual memory management. If you want to manually destroy
312+
the `Texture`s you use, you can call the `destroy` method of your `Texture`s, but beware that *it should not* be called if none of
313+
the parents (`Canvas` or `TextureCreator`) are alive. If you do not call this method, the memory will simply be freed when
314+
the last `Canvas` or the last `TextureCreator` will be freed.
315+
316+
There is no online documentation for this feature, however you can build it yourself in your project by enabling the feature in your
317+
Cargo.toml, running `cargo doc` and accessing `target/doc/sdl2/index.html` via a browser.
318+
302319
# OpenGL
303320

304321
If you want to use OpenGL, you also need the

changelog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
In this file will be listed the changes, especially the breaking ones that one should be careful of
22
when upgrading from a version of rust-sdl2 to another.
33

4+
### v0.31
5+
6+
[PR #673](https://github.com/Rust-sdl2/rust-sdl2/pull/673)
7+
8+
* Support Audio Capture in AudioCallbacks.
9+
10+
[PR #684](https://github.com/Rust-sdl2/rust-sdl2/pull/684)
11+
12+
* **Breaking change** Make get\_swap\_interval return an enum instead of i32
13+
* The signature of set\_swap\_interval has been changed as well, but it shouldn't
14+
breaking exisitng code too much.
15+
16+
[PR #683](https://github.com/Rust-sdl2/rust-sdl2/pull/684)
17+
18+
* Adds the `unsafe_textures` feature to this crate, allowing to get rid of the lifetimes
19+
in `Texture`s in the `render` module.
20+
421
### v0.30
522

623
Re-exported sdl2\_sys as sdl2::sys

0 commit comments

Comments
 (0)