mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
Mention mixer support in readme
This commit is contained in:
parent
995003768b
commit
6dd5817471
22
README.md
22
README.md
@ -12,7 +12,7 @@ try {
|
||||
using namespace SDL2pp;
|
||||
|
||||
// Init SDL; will be automatically deinitialized when the object is destroyed
|
||||
SDL sdl(SDL_INIT_VIDEO);
|
||||
SDL sdl(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||
|
||||
// Likewise, init SDL_ttf library
|
||||
SDLTTF sdl_ttf;
|
||||
@ -29,6 +29,11 @@ try {
|
||||
|
||||
Font font("Vera.ttf", 20); // SDL_ttf font
|
||||
|
||||
// Initialize audio mixer
|
||||
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
||||
|
||||
Chunk sound("effect.ogg"); // OGG sound file
|
||||
|
||||
// Create texture from surface containing text rendered by SDL_ttf
|
||||
Texture text(renderer, font.RenderText_Solid("Hello, world!",
|
||||
SDL_Color{255, 255, 255, 255}));
|
||||
@ -53,6 +58,9 @@ try {
|
||||
|
||||
renderer.Present();
|
||||
|
||||
// Play our sound one time on a first available mixer channel
|
||||
mixer.PlayChannel(-1, sound);
|
||||
|
||||
// You can still access wrapped C SDL types
|
||||
SDL_Renderer* sdl_renderer = renderer.Get();
|
||||
|
||||
@ -94,6 +102,11 @@ Currently, the library provides wrapper classes for
|
||||
* SDL_image
|
||||
* Library initialization/deinitialization
|
||||
* Loading functions integrated into Texture and Surface
|
||||
* SDL_mixer
|
||||
* Library initialization/deinitialization
|
||||
* Sound sample handling (Mix_Chunk)
|
||||
* Music handling (Mix_Music)
|
||||
* Mixer class which encapsulates device handling and all playback functions
|
||||
* SDL_ttf
|
||||
* Library initialization/deinitialization
|
||||
* TTF_Font (all functions covered)
|
||||
@ -122,8 +135,9 @@ example clang 3.4+ or gcc 4.8+.
|
||||
Dependencies:
|
||||
* cmake
|
||||
* SDL2
|
||||
* SDL_image2 (optional)
|
||||
* SDL_ttf2 (optional)
|
||||
* SDL2_image (optional)
|
||||
* SDL2_mixer (optional)
|
||||
* SDL2_ttf (optional)
|
||||
|
||||
To build standalone version:
|
||||
|
||||
@ -132,6 +146,7 @@ To build standalone version:
|
||||
Following variabled may be supplied to CMake to affect build:
|
||||
|
||||
* ```SDL2PP_WITH_IMAGE``` - enable SDL_image support (default ON)
|
||||
* ```SDL2PP_WITH_MIXER``` - enable SDL_mixer support (default ON)
|
||||
* ```SDL2PP_WITH_TTF``` - enable SDL_ttf support (default ON)
|
||||
* ```SDL2PP_WITH_WERROR``` - treat warnings as errors, useful for CI (default OFF)
|
||||
* ```SDL2PP_CXXSTD``` - override C++ standard (default C++11). With C++1y some additional features are enabled such as usage of [[deprecated]] attribute and using stock experimental/optional from C++ standard library
|
||||
@ -183,6 +198,7 @@ Just place the library into dedicated directory in your project
|
||||
|
||||
```cmake
|
||||
SET(SDL2PP_WITH_IMAGE ON) # if you need SDL_image support
|
||||
SET(SDL2PP_WITH_MIXER ON) # if you need SDL_mixer support
|
||||
SET(SDL2PP_WITH_TTF ON) # if you need SDL_ttf support
|
||||
ADD_SUBDIRECTORY(extlib/libSDL2pp)
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user