mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Fix #134
This commit is contained in:
parent
d50e7365da
commit
e538ba15bf
@ -30,7 +30,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
|
|
||||||
// XXX: these should be constexpr and not captured in lambda
|
// XXX: these should be constexpr and not captured in lambda
|
||||||
@ -55,9 +56,8 @@ int main(int, char*[]) try {
|
|||||||
|
|
||||||
// Play for 1 second, after which everything is stopped and closed
|
// Play for 1 second, after which everything is stopped and closed
|
||||||
SDL_Delay(1000);
|
SDL_Delay(1000);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
|
|
||||||
Wav wav(TESTDATA_DIR "/test.wav");
|
Wav wav(TESTDATA_DIR "/test.wav");
|
||||||
@ -63,9 +64,8 @@ int main(int, char*[]) try {
|
|||||||
|
|
||||||
// Play for 5 seconds, after which everything is stopped and closed
|
// Play for 5 seconds, after which everything is stopped and closed
|
||||||
SDL_Delay(5000);
|
SDL_Delay(5000);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,8 @@ using namespace SDL2pp;
|
|||||||
|
|
||||||
static const float pi = 3.14159265358979323846f;
|
static const float pi = 3.14159265358979323846f;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_VIDEO);
|
SDL sdl(SDL_INIT_VIDEO);
|
||||||
SDLImage image(IMG_INIT_PNG); // optional
|
SDLImage image(IMG_INIT_PNG); // optional
|
||||||
Window window("libSDL2pp demo: loading", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
Window window("libSDL2pp demo: loading", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
||||||
@ -77,9 +78,8 @@ int main(int, char*[]) try {
|
|||||||
// Frame limiter
|
// Frame limiter
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_VIDEO);
|
SDL sdl(SDL_INIT_VIDEO);
|
||||||
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
||||||
Renderer render(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
|
Renderer render(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
|
||||||
@ -86,9 +87,8 @@ int main(int, char*[]) try {
|
|||||||
// Frame limiter
|
// Frame limiter
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
||||||
|
|
||||||
@ -71,9 +72,8 @@ int main(int, char*[]) try {
|
|||||||
mixer.FadeOutChannel(chan, 2000);
|
mixer.FadeOutChannel(chan, 2000);
|
||||||
|
|
||||||
SDL_Delay(2000);
|
SDL_Delay(2000);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
||||||
|
|
||||||
@ -109,9 +110,8 @@ int main(int, char*[]) try {
|
|||||||
mixer.HaltChannel(-1);
|
mixer.HaltChannel(-1);
|
||||||
|
|
||||||
mixer.UnsetReverseStereo(MIX_CHANNEL_POST);
|
mixer.UnsetReverseStereo(MIX_CHANNEL_POST);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
Mixer mixer(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096);
|
||||||
|
|
||||||
@ -40,9 +41,8 @@ int main(int, char*[]) try {
|
|||||||
mixer.FadeInMusic(music, -1, 2000);
|
mixer.FadeInMusic(music, -1, 2000);
|
||||||
|
|
||||||
SDL_Delay(5000);
|
SDL_Delay(5000);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_AUDIO);
|
SDL sdl(SDL_INIT_AUDIO);
|
||||||
Mixer mixer(MIX_DEFAULT_FREQUENCY, AUDIO_S16SYS, 1, 4096);
|
Mixer mixer(MIX_DEFAULT_FREQUENCY, AUDIO_S16SYS, 1, 4096);
|
||||||
|
|
||||||
@ -48,9 +49,8 @@ int main(int, char*[]) try {
|
|||||||
|
|
||||||
// Play for 1 second, after which everything is stopped and closed
|
// Play for 1 second, after which everything is stopped and closed
|
||||||
SDL_Delay(1000);
|
SDL_Delay(1000);
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,8 @@ enum {
|
|||||||
MY_RENDERTARGET_SIZE = 512,
|
MY_RENDERTARGET_SIZE = 512,
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_VIDEO);
|
SDL sdl(SDL_INIT_VIDEO);
|
||||||
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, MY_SCREEN_WIDTH, MY_SCREEN_HEIGHT, SDL_WINDOW_RESIZABLE);
|
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, MY_SCREEN_WIDTH, MY_SCREEN_HEIGHT, SDL_WINDOW_RESIZABLE);
|
||||||
Renderer render(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
|
Renderer render(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
|
||||||
@ -112,9 +113,8 @@ int main(int, char*[]) try {
|
|||||||
// Frame limiter
|
// Frame limiter
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@ static const unsigned char pixels[4 * 4 * 4] = {
|
|||||||
RGBA(0x80, 0x00, 0xff, 0xff), RGBA(0x00, 0x00, 0xff, 0xff), RGBA(0x00, 0x80, 0xff, 0xff), RGBA(0x00, 0xff, 0xff, 0xff),
|
RGBA(0x80, 0x00, 0xff, 0xff), RGBA(0x00, 0x00, 0xff, 0xff), RGBA(0x00, 0x80, 0xff, 0xff), RGBA(0x00, 0xff, 0xff, 0xff),
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_VIDEO);
|
SDL sdl(SDL_INIT_VIDEO);
|
||||||
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
Window window("libSDL2pp demo: sprites", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
||||||
Renderer render(window, -1, SDL_RENDERER_ACCELERATED);
|
Renderer render(window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
@ -85,9 +86,8 @@ int main(int, char*[]) try {
|
|||||||
// Frame limiter
|
// Frame limiter
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
using namespace SDL2pp;
|
using namespace SDL2pp;
|
||||||
|
|
||||||
int main(int, char*[]) try {
|
int main(int, char*[]) {
|
||||||
|
try {
|
||||||
SDL sdl(SDL_INIT_VIDEO);
|
SDL sdl(SDL_INIT_VIDEO);
|
||||||
SDLTTF ttf;
|
SDLTTF ttf;
|
||||||
Window window("libSDL2pp demo: font", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
Window window("libSDL2pp demo: font", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE);
|
||||||
@ -91,9 +92,8 @@ int main(int, char*[]) try {
|
|||||||
// Frame limiter
|
// Frame limiter
|
||||||
SDL_Delay(1);
|
SDL_Delay(1);
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
return 0;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "Error: " << e.what() << std::endl;
|
std::cerr << "Error: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user