From 12cf10a35ca156e4d34f5b2154e01484fdfaf41c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 14 Feb 2015 20:05:58 +0100 Subject: Initialize SDL image and check initialization return --- src/rpgedit.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 +#include #include +#include + 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; -- cgit v1.2.3