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 <SDL2/SDL.h>
#include <map> #include <map>
#include <vector> #include <vector>
#include <functional>
namespace sc { namespace sc {
namespace gui { namespace gui {
using EventHandler = bool(*)(const SDL_Event&); using EventHandler = std::function<bool(const SDL_Event&)>;
using RunLoopAction = void(*)(); using RunLoopAction = void(*)();
class Application { class Application {

View File

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