diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-02-14 20:05:58 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-02-14 20:15:34 +0100 |
commit | 12cf10a35ca156e4d34f5b2154e01484fdfaf41c (patch) | |
tree | b7003ff6047465e68e8b311c53130ac290a95472 | |
parent | 2453bcdcc11a371baafaa94f30685e71ddd56638 (diff) | |
download | rpgedit-12cf10a35ca156e4d34f5b2154e01484fdfaf41c.tar rpgedit-12cf10a35ca156e4d34f5b2154e01484fdfaf41c.zip |
Initialize SDL image and check initialization return
-rw-r--r-- | src/rpgedit.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rpgedit.cpp b/src/rpgedit.cpp index 6ef5dd3..fc3fe5f 100644 --- a/src/rpgedit.cpp +++ b/src/rpgedit.cpp @@ -27,15 +27,27 @@ #include "control/RPGEdit.hpp" #include <SDL.h> +#include <SDL_image.h> #include <SDL_main.h> +#include <iostream> + extern "C" int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[]) { - SDL_Init(SDL_INIT_VIDEO); + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + std::cerr << "Unable to initialize SDL" << std::endl; + return 1; + } + + if (!(IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG)) { + std::cerr << "Unable to initialize PNG loader" << std::endl; + return 1; + } RPGEdit::Control::RPGEdit().run(); + IMG_Quit(); SDL_Quit(); return 0; |