Changed callbacks to std::function

Now you can also use lambdas with captured values.
This commit is contained in:
Bob Polis 2021-02-01 00:38:55 +01:00
parent 502664615a
commit f1e82f6126
2 changed files with 4 additions and 2 deletions

View File

@ -12,10 +12,11 @@
#include <SDL2/SDL.h>
#include <map>
#include <vector>
#include <functional>
namespace sc {
namespace gui {
using EventHandler = bool(*)(const SDL_Event&);
using EventHandler = std::function<bool(const SDL_Event&)>;
using RunLoopAction = void(*)();
class Application {

View File

@ -15,10 +15,11 @@
#include <stdexcept>
#include <vector>
#include <map>
#include <functional>
namespace sc {
namespace gui {
using WindowEventHandler = bool(*)(const SDL_Event&, bool quit);
using WindowEventHandler = std::function<bool(const SDL_Event&, bool quit)>;
class Image;
class Window {