examples: add commentary for exceptions.

This commit is contained in:
Hermet Park 2021-06-23 13:09:11 +09:00
parent a0f28d0db4
commit 89d35123d8
2 changed files with 9 additions and 3 deletions

View file

@ -32,7 +32,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
auto picture = tvg::Picture::gen(); auto picture = tvg::Picture::gen();
if (picture->load(EXAMPLE_DIR"/logo.png") != tvg::Result::Success) return; if (picture->load(EXAMPLE_DIR"/logo.png") != tvg::Result::Success) {
cout << "PNG is not supported, Did you enable PNG Loader??" << endl;
return;
}
picture->translate(i* 150, i * 150); picture->translate(i* 150, i * 150);
picture->rotate(30 * i); picture->rotate(30 * i);
picture->scale(0.25); picture->scale(0.25);

View file

@ -31,7 +31,10 @@ void tvgDrawCmds(tvg::Canvas* canvas)
if (!canvas) return; if (!canvas) return;
auto picture = tvg::Picture::gen(); auto picture = tvg::Picture::gen();
picture->load(EXAMPLE_DIR"/test.tvg"); if (picture->load(EXAMPLE_DIR"/test.tvg") != tvg::Result::Success) {
cout << "TVG is not supported, Did you enable TVG Loader??" << endl;
return;
}
canvas->push(move(picture)); canvas->push(move(picture));
} }
@ -139,4 +142,4 @@ int main(int argc, char **argv)
cout << "engine is not supported" << endl; cout << "engine is not supported" << endl;
} }
return 0; return 0;
} }