131 Commits

Author SHA1 Message Date
rhysd 5d8ba4ac12 Return Result from AudioQueue::queue instead of bool 2021-12-30 11:46:13 +09:00
Cobrand 6a31d312ab Merge pull request #1131 from Yamakaky/sensor-api
Add sensor API implementation
2021-10-10 20:05:42 +02:00
Mikaël Fourrier 38e8261988 wgpu 0.10 + strip dependencies 2021-09-15 22:48:53 +02:00
Mikaël Fourrier 67fe292f19 First try at sensor API implementation 2021-08-21 13:55:56 +02:00
Cobrand f6adc8daff Fix bindgen, update sdl_bindings.rs 2021-07-24 17:38:23 +02:00
Cobrand 593b5151ab fix audio-queue-squarewave example 2021-02-15 11:40:13 +01:00
Guillaume Gomez 7fd7ee4447 run cargo fmt 2020-12-08 20:30:47 +01:00
Cameron Mann e1028ed682 Update raw-window-handle-with-wgpu example to use wgpu 0.5
* Remove WindowWrapper since wgpu now uses raw-window-handle correctly
  on OSX which also lets us remove the objc dependency
* Add futures dependency to handle parts of the wgpu API that are now
  asynchronous
* Flip y coords in vertex shader to keep triangle oriented the same way
  since wgpu flipped their y-axis
* Fix various other errors resulting from breaking API changes in wgpu
2020-05-26 23:14:52 -06:00
Jakub Stasiak 9dde795e3f Provide memory buffer -> mixer Chunk conversion methods
This basically provides an API to access Mix_QuickLoad_WAV and
Mix_QuickLoad_RAW with one caveat – thie API takes ownership of the
buffers, while Mix_QuickLoad_* functions don't. Since Rust-SDL2 wraps
Mix_Chunks in its own structure with its own buffer ownership flag it's
easy to work around that and deallocate the buffer when Chunk is
dropped.

There are few design considerations here:

* Taking ownership of the buffer. I couldn't come up with a way to
  get a Chunk based on a buffer while still keeping the code safe and
  making sure that as long as Chunk is alive the buffer is also alive
  *and* not making the change be terribly involved and disruptive
* What's the best way to take an ownership of a buffer passed as a
  parameter? I came up with Box<[T]> as it seems universal enough,
  but I expect a more idiomatic Rust way may exist.

I modified the mixer demo to show how the API is used, a beep is
generated when no sound file is passed to the example.
2020-02-07 00:39:07 +01:00
Logan McGrath b48a21d394 Never trust IDE auto-imports 2020-01-31 13:15:56 -08:00
Logan McGrath 92b4309564 adding an example 2020-01-30 12:15:59 -08:00
Cobrand e865c8f464 Add events example, add missing events 2019-11-06 11:50:42 +00:00
Jakub Stasiak 4e37c1b789 Fix clicking and volume control in the audio-wav example 2019-10-23 02:53:28 +02:00
Cobrand 1d5f701d0f Enable no_std for sdl2-sys 2019-03-23 15:04:53 +00:00
Sunjay Varma 37cf5f76ac Replaced all calls to unwrap() in examples with either the ? operator or expect 2019-01-13 22:49:05 +01:00
Drew Pirrone-Brusse 8f27656a6a Update to bitflags 1.* from 0.7 2018-12-21 13:37:06 +01:00
Niels Wießner 5b7d1c108f Modify joystick example to include set_rumble 2018-12-10 23:22:59 +01:00
Niels Wießner 59ad1c094b Modify game-controller example to include set_rumble 2018-12-10 23:07:57 +01:00
Cobrand cfced74f15 Fix audio whitenoise example 2018-10-15 17:31:20 +00:00
Jon Emil Jahren a27c3c62a5 Convert SDL_mixer bindings into autogenerated bindings
Progresses on #647
2018-04-02 11:19:22 +02:00
Jessica Stokes 809fee03a1 Use power_level in the joystick example 2018-03-31 18:58:33 +02:00
Constantin Nickel 8184caf3fd sdl2::mixer::open_audio must be called before other functions 2018-02-15 18:14:45 -08:00
Martin Lindhe 80fbbab198 avoid dependency of gfx 2017-12-26 19:39:10 +01:00
Martin Lindhe 87db9987c8 add an example using a custom mouse cursor
example: cargo run --example cursor --features="image gfx" assets/cursor.png
2017-12-21 13:34:40 +01:00
vrinek 58989c973d Remove unused macro definition 2017-11-08 18:31:32 -08:00