mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-09-09 07:18:45 -04:00
Syntax highlight synopsis code in README.md
This commit is contained in:
parent
9e8fb2fc69
commit
4daba0efa8
10
README.md
10
README.md
@ -7,7 +7,8 @@ This library provides C++11 bindings/wrapper for SDL2 and satellite libraries.
|
||||
|
||||
## Synopsis ##
|
||||
|
||||
try {
|
||||
```c++
|
||||
try {
|
||||
using namespace SDL2pp;
|
||||
|
||||
// Init SDL; will be automatically deinitialized when the object is destroyed
|
||||
@ -59,14 +60,15 @@ This library provides C++11 bindings/wrapper for SDL2 and satellite libraries.
|
||||
SDL_Delay(2000);
|
||||
|
||||
// All SDL objects are released at this point or if an error occurs
|
||||
} catch (SDL2pp::Exception& e) {
|
||||
} catch (SDL2pp::Exception& e) {
|
||||
// Exception stores SDL_GetError() result and name of function which failed
|
||||
std::cerr << "Error in: " << e.GetSDLFunction() << std::endl;
|
||||
std::cerr << " Reason: " << e.GetSDLError() << std::endl;
|
||||
} catch (std::exception& e) {
|
||||
} catch (std::exception& e) {
|
||||
// This also works (e.g. "SDL_Init failed: No available video device")
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Features ##
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user