have opengl gracefully fail

This commit is contained in:
IoIxD 2026-04-27 00:30:58 -07:00
commit 73b320fc18

View file

@ -53,18 +53,21 @@ int main() {
MwNtitle, TITLE, MwNtitle, TITLE,
NULL); NULL);
opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 50, 50, 400, 400); opengl = MwCreateWidget(MwOpenGLClass, "opengl", window, 50, 50, 400, 400);
if(!opengl) {
MwMessageBox(NULL, "Unable to create OpenGL window.", "Error", MwMB_ICONERROR);
} else {
MwOpenGLMakeCurrent(opengl);
MwOpenGLMakeCurrent(opengl); init();
reshape(400, 400);
init(); MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
reshape(400, 400); MwAddUserHandler(opengl, MwNtickHandler, tick, NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL); MwAddTickList(opengl);
MwAddUserHandler(opengl, MwNtickHandler, tick, NULL);
MwAddTickList(opengl); MwAddUserHandler(opengl, MwNkeyHandler, key_pressed, NULL);
}
MwAddUserHandler(opengl, MwNkeyHandler, key_pressed, NULL);
MwLoop(window); MwLoop(window);
} }