aquire and release

This commit is contained in:
2025-04-20 14:58:39 -05:00
parent c6fa731df0
commit d253ebb197
7 changed files with 78 additions and 45 deletions

View File

@@ -95,14 +95,19 @@ namespace Archimedes {
std::list<std::variant<std::string, Module*>> toOpen;
void handleEvents() {
bool handled = false;
static bool handled;
while(!events.empty()) {
handled = false;
for(auto it = runOrder.rbegin(); it != runOrder.rend(); it++) {
if(modules[*it]->onEvent(*events.front())) {
handled = modules[*it]->onEvent(*events.front());
if(handled) {
Event* e = events.front();
events.pop_front();
delete e;
handled = true;
break;
}
}
@@ -110,7 +115,6 @@ namespace Archimedes {
if(!handled) {
std::cout << "Error: Unhandled Event: " << (std::string) *events.front() << std::endl;
}
handled = false;
}
}

View File

@@ -18,12 +18,14 @@ namespace Archimedes {
bool shouldClose() { return window.shouldClose(); }
void getSize(int& w, int& h) {
window.getSize(w, h);
}
void doFrame() {
window.pollEvents();
window.getSize(renderer->w, renderer->h);
renderer->render();
window.doFrame();