Initialize SDL_image library before using it.
This commit is contained in:
parent
07d41d06dc
commit
3e6353b999
@ -114,6 +114,11 @@ namespace spades {
|
||||
|
||||
virtual SDL_Surface *LoadSdlImage(const std::string& data) {
|
||||
StringSdlRWops ops(data);
|
||||
int flags = IMG_INIT_PNG|IMG_INIT_JPG;
|
||||
int initted = IMG_Init(flags);
|
||||
if((initted & flags) != flags) {
|
||||
SPRaise("IMG_Init failed: %s", IMG_GetError());
|
||||
}
|
||||
auto *s = IMG_Load_RW(ops, 0);
|
||||
if(s == nullptr) {
|
||||
SPRaise("IMG_Load_RW failed: %s", IMG_GetError());
|
||||
|
Loading…
x
Reference in New Issue
Block a user