Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in hint.rs #729

Merged
merged 2 commits into from
Nov 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
In this file will be listed the changes, especially the breaking ones that one should be careful of
when upgrading from a version of rust-sdl2 to another.

### v0.32

[PR #279](https://github.com/Rust-SDL2/rust-sdl2/pull/729)

* **Breaking change** set\_video\_minimize\_on\_focus\_lost was renamed to …minimize\_on\_focus\_loss, as it should be. As a bonus, it works now.

### v0.31

[PR #693](https://github.com/Rust-SDL2/rust-sdl2/pull/693), [PR #720](https://github.com/Rust-SDL2/rust-sdl2/pull/720)
Expand All @@ -14,9 +20,9 @@ when upgrading from a version of rust-sdl2 to another.
[PR #695](https://github.com/Rust-sdl2/rust-sdl2/pull/695)

* sdl2-sys can now be generated at compile time by bindgen (Opt-in required
with "use-bindgen" feature)
with "use-bindgen" feature)
* The new sdl2-sys source code is generated by bindgen, hence **almost everything
that uses sdl2-sys will be broken**. The fixes are small but still preset.
that uses sdl2-sys will be broken**. The fixes are small but still preset.

[PR #673](https://github.com/Rust-sdl2/rust-sdl2/pull/673)

Expand All @@ -26,22 +32,22 @@ that uses sdl2-sys will be broken**. The fixes are small but still preset.

* **Breaking change** Make get\_swap\_interval return an enum instead of i32
* The signature of set\_swap\_interval has been changed as well, but it shouldn't
breaking existing code too much.
breaking existing code too much.

[PR #683](https://github.com/Rust-sdl2/rust-sdl2/pull/684)
[PR #683](https://github.com/Rust-sdl2/rust-sdl2/pull/683)

* Adds the `unsafe_textures` feature to this crate, allowing to get rid of the lifetimes
in `Texture`s in the `render` module.
in `Texture`s in the `render` module.

[PR #704](https://github.com/Rust-SDL2/rust-sdl2/pull/704)

* Adds the `Music::from_static_bytes` function, which creates a Music instance with the
static lifetime from a buffer that also has a static lifetime.
static lifetime from a buffer that also has a static lifetime.

[PR #708](https://github.com/Rust-SDL2/rust-sdl2/pull/708)

* Makes the fields of the `sdl2::mixer::Channel(i32)` and `sdl::mixer::Group(i32)` structs
public so they can be instantiated directly, and deprecates `sdl2::mixer::channel(i32)`.
public so they can be instantiated directly, and deprecates `sdl2::mixer::channel(i32)`.

[PR #714](https://github.com/Rust-SDL2/rust-sdl2/pull/714)

Expand All @@ -65,18 +71,18 @@ pay for soundness and runtime safety.

* `Renderer` has been renamed and split into `Canvas` and `TextureCreator`.
* `Canvas` can store a `Surface` or a `Window`, and can be used to render into these as well.
`TextureCreator` creates `Texture`s and is used by Texture to make sure they don't live
longer than expected.
`TextureCreator` creates `Texture`s and is used by Texture to make sure they don't live
longer than expected.
* `set_render_target` has been removed and has been replaced with `Canvas::with_texture_canvas`
and `Canvas::with_multiple_texture_canvas`
and `Canvas::with_multiple_texture_canvas`
* Deleted `WindowRef`, it wasn't useful anymore.

Other Changes:

* Added `PixelFormatEnum::supports_alpha(&self) -> bool` method.
* A single Game Of Life example has been added to show the basic capabilities of the new `Canvas`
and `TextureCreator` structs, as well as adding a very basic game to show how to handle input / game
changes in a basic game.
and `TextureCreator` structs, as well as adding a very basic game to show how to handle input / game
changes in a basic game.

You won't have to worry about what target your `Renderer` has at runtime anymore, everything
is done at compile time now !
Expand Down
24 changes: 12 additions & 12 deletions src/sdl2/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ffi::{CString, CStr};
use sys;
use libc::c_char;

const VIDEO_MINIMIZE_ON_FOCUS_LOST: &'static str = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOST";
const VIDEO_MINIMIZE_ON_FOCUS_LOSS: &'static str = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS";

pub enum Hint {
Default,
Expand All @@ -20,13 +20,13 @@ pub enum Hint {
///
/// # Example
/// ```rust,no_run
/// sdl2::hint::set_video_minimize_on_focus_lost(false);
/// sdl2::hint::set_video_minimize_on_focus_loss(false);
/// ```
///
/// * `value`: `true` to enable minimizing of the Window if it loses key focus when in fullscreen mode,
/// `false` to disable this feature.
pub fn set_video_minimize_on_focus_lost(value: bool) -> bool {
set(VIDEO_MINIMIZE_ON_FOCUS_LOST, if value { "1" } else { "0" })
pub fn set_video_minimize_on_focus_loss(value: bool) -> bool {
set(VIDEO_MINIMIZE_ON_FOCUS_LOSS, if value { "1" } else { "0" })
}

/// A hint that specifies whether a fullscreen [Window](../video/Window.t.html) will be
Expand All @@ -36,16 +36,16 @@ pub fn set_video_minimize_on_focus_lost(value: bool) -> bool {
///
/// # Example
/// ```rust,no_run
/// sdl2::hint::set_video_minimize_on_focus_lost_with_priority(false, &sdl2::hint::Hint::Override);
/// sdl2::hint::set_video_minimize_on_focus_loss_with_priority(false, &sdl2::hint::Hint::Override);
/// ```
///
/// * `value`: `true` to enable minimizing of the Window if it loses key focus when in fullscreen mode,
/// `false` to disable this feature.
/// * `priority`: The priority controls the behavior when setting a hint that already has a value.
/// Hints will replace existing hints of their priority and lower.
/// Environment variables are considered to have override priority.
pub fn set_video_minimize_on_focus_lost_with_priority(value: bool, priority: &Hint) -> bool {
set_with_priority(VIDEO_MINIMIZE_ON_FOCUS_LOST, if value { "1" } else { "0" }, priority)
pub fn set_video_minimize_on_focus_loss_with_priority(value: bool, priority: &Hint) -> bool {
set_with_priority(VIDEO_MINIMIZE_ON_FOCUS_LOSS, if value { "1" } else { "0" }, priority)
}

/// A hint that specifies whether a fullscreen [Window](../video/Window.t.html) will be
Expand All @@ -58,13 +58,13 @@ pub fn set_video_minimize_on_focus_lost_with_priority(value: bool, priority: &Hi
///
/// # Example
/// ```rust,no_run
/// assert_eq!(sdl2::hint::get_video_minimize_on_focus_lost(), true);
/// assert_eq!(sdl2::hint::get_video_minimize_on_focus_loss(), true);
///
/// sdl2::hint::set_video_minimize_on_focus_lost(false);
/// assert_eq!(sdl2::hint::get_video_minimize_on_focus_lost(), false);
/// sdl2::hint::set_video_minimize_on_focus_loss(false);
/// assert_eq!(sdl2::hint::get_video_minimize_on_focus_loss(), false);
/// ```
pub fn get_video_minimize_on_focus_lost() -> bool {
match get(VIDEO_MINIMIZE_ON_FOCUS_LOST) {
pub fn get_video_minimize_on_focus_loss() -> bool {
match get(VIDEO_MINIMIZE_ON_FOCUS_LOSS) {
Some(value) => match &*value {
"1" => true,
_ => false,
Expand Down