sdl event stuff
This commit is contained in:
@@ -28,7 +28,9 @@ class WindowModule : public Archimedes::Module {
|
||||
Archimedes::Window* aquireWindow() {
|
||||
if(!window) {
|
||||
|
||||
window = new Archimedes::Window([this](Archimedes::Event* e){
|
||||
window = new Archimedes::Window([this](Archimedes::Event* e) {
|
||||
for(std::function<void(Archimedes::Event*)> f : eventFuncs)
|
||||
f(e);
|
||||
app->emitEvent(e);
|
||||
});
|
||||
|
||||
@@ -54,6 +56,10 @@ class WindowModule : public Archimedes::Module {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto addEventFn(const std::function<void(Archimedes::Event*)>& fn) { eventFuncs.push_back(fn); return --eventFuncs.end()++; }
|
||||
|
||||
void removeEventFn(std::list<std::function<void(Archimedes::Event*)>>::iterator it) { eventFuncs.erase(it); }
|
||||
|
||||
Archimedes::Renderer* getRenderer() { return renderer; }
|
||||
|
||||
@@ -61,6 +67,8 @@ class WindowModule : public Archimedes::Module {
|
||||
|
||||
int windowRefs = 0;
|
||||
|
||||
std::list<std::function<void(Archimedes::Event*)>> eventFuncs;
|
||||
|
||||
Archimedes::Window* window = nullptr;
|
||||
Archimedes::Renderer* renderer = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user