Better callbacks

This commit is contained in:
NaifBanana
2026-10-12 00:51:50 -05:00
parent b9e8144519
commit e6a5c9e805
3 changed files with 169 additions and 56 deletions
+9 -6
View File
@@ -69,16 +69,19 @@ int main() {
}}, indxs);
LOG(prog.log());
window->setCallback<nb::OGLWindow::KEY>(
(std::function<void(nb::OGLWindow*, int, int, int, int)>)[](nb::OGLWindow* w, int key, int x, int actiom, int mods)->void{
using nb::WindowCallbacks;
window->setCallback<nb::KEY>(
[](nb::OGLWindow* w, int key, int, int, int)->void{
if (key == GLFW_KEY_Q) {
w->shouldClose(true);
}
});
window->setCallback<nb::OGLWindow::CURSOR_POS>(
(std::function<void(nb::OGLWindow*, double, double)>)[](nb::OGLWindow* w, double x, double y)->void{
nb::logger.msg("Pos in x is " + std::to_string(x));
});
window->setCallback<nb::CURSOR_POS>(
[](nb::OGLWindow* w, double x, double y)->void{
nb::logger.msg("Pos in x is " + std::to_string(x));
}
);
while(!window->shouldClose()) {
OPENGL_CALL(glClearColor(0.2f, 0.3f, 0.3f, 1.0f));
OPENGL_CALL(glClear(GL_COLOR_BUFFER_BIT));