Better callbacks
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user