EightBit/Gaming/inc/SDLWrapper.h
Adrian Conlon 89fae1cb6f Tidy the Gaming library a little:
*) Add an SDLWrapper class to control the lifetime of SDL_Init/SDL_Quit
*) Pass FPS as a float, rather than int
*) Allow the key and button handlers to show whether an event was handled or not
*) Add a full screen render option (F12)
*) Use smart pointers in the GameController class

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-10-01 23:54:48 +01:00

18 lines
346 B
C++

#pragma once
namespace Gaming {
class SDLWrapper final {
public:
SDLWrapper();
~SDLWrapper();
static void throwSDLException(std::string failure) {
throw std::runtime_error(failure + ::SDL_GetError());
}
static void verifySDLCall(int returned, std::string failure) {
if (returned < 0)
throwSDLException(failure);
}
};
}