libscgui/SDLImageWrapper.cpp

26 lines
523 B
C++
Raw Normal View History

2020-10-23 12:43:47 +02:00
//
// SDLImageWrapper.cpp
// gui
//
// Created by Bob Polis at 2020-10-14
// Copyright (c) 2020 SwiftCoder. All rights reserved.
//
#include <SDL2/SDL_image.h>
#include <stdexcept>
#include "SDLImageWrapper.hpp"
2020-10-23 13:55:57 +02:00
using namespace sc::gui;
2020-10-23 12:43:47 +02:00
SDLImageWrapper::SDLImageWrapper() {
int flags = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF;
int result = IMG_Init(flags);
if ((result & flags) != flags) {
throw std::runtime_error(IMG_GetError());
}
}
SDLImageWrapper::~SDLImageWrapper() {
IMG_Quit();
}