mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-09-11 08:15:10 -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 ##
|
## Synopsis ##
|
||||||
|
|
||||||
try {
|
```c++
|
||||||
|
try {
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
// Init SDL; will be automatically deinitialized when the object is destroyed
|
// 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);
|
SDL_Delay(2000);
|
||||||
|
|
||||||
// All SDL objects are released at this point or if an error occurs
|
// 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
|
// Exception stores SDL_GetError() result and name of function which failed
|
||||||
std::cerr << "Error in: " << e.GetSDLFunction() << std::endl;
|
std::cerr << "Error in: " << e.GetSDLFunction() << std::endl;
|
||||||
std::cerr << " Reason: " << e.GetSDLError() << 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")
|
// This also works (e.g. "SDL_Init failed: No available video device")
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Features ##
|
## Features ##
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user