summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-02-14 20:05:58 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-02-14 20:15:34 +0100
commit12cf10a35ca156e4d34f5b2154e01484fdfaf41c (patch)
treeb7003ff6047465e68e8b311c53130ac290a95472 /src
parent2453bcdcc11a371baafaa94f30685e71ddd56638 (diff)
downloadrpgedit-12cf10a35ca156e4d34f5b2154e01484fdfaf41c.tar
rpgedit-12cf10a35ca156e4d34f5b2154e01484fdfaf41c.zip
Initialize SDL image and check initialization return
Diffstat (limited to 'src')
-rw-r--r--src/rpgedit.cpp14
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;