public Driver() { this.errorHandler = new GLFWerrorfun((ec, des) => Console.Out.WriteLine(des)); Functions.Init(); glfwInit(); glfwSetErrorCallback(this.errorHandler); }
public static GLFWerrorfun setErrorCallback(GLFWerrorfun cbfun) { return(Glfwint.setErrorCallback(cbfun)); }
internal OpenGLContext(string name) { if (GLFW.GlfwInit() == 0) { Console.Error.WriteLine("GLFW failed to initialize!"); Environment.Exit(1); } Window = GLFW.GlfwCreateWindow(1920, 1080, name, null, null); if (Window == null) { Console.Error.WriteLine("GLFW failed to open window!"); GLFW.GlfwTerminate(); Environment.Exit(1); } Input = new InputSource(); GLFW.GlfwMakeContextCurrent(Window); StrongReferences = new List <Delegate>(); { GLFWkeyfun cb = KeyCallback; StrongReferences.Add(cb); GLFW.GlfwSetKeyCallback(Window, cb); } { GLFWcharfun cb = CharCallback; StrongReferences.Add(cb); GLFW.GlfwSetCharCallback(Window, cb); } { GLFWerrorfun cb = ErrorCallback; StrongReferences.Add(cb); GLFW.GlfwSetErrorCallback(cb); } { GLFWscrollfun cb = ScrollCallback; StrongReferences.Add(cb); GLFW.GlfwSetScrollCallback(Window, cb); } { GLFWcharmodsfun cb = CharModsCallback; StrongReferences.Add(cb); GLFW.GlfwSetCharModsCallback(Window, cb); } { GLFWcursorposfun cb = CursorPosCallback; StrongReferences.Add(cb); GLFW.GlfwSetCursorPosCallback(Window, cb); } { GLFWwindowposfun cb = WindowPosCallback; StrongReferences.Add(cb); GLFW.GlfwSetWindowPosCallback(Window, cb); } { GLFWwindowsizefun cb = WindowSizeCallback; StrongReferences.Add(cb); GLFW.GlfwSetWindowSizeCallback(Window, cb); } { GLFWcursorenterfun cb = CursorEnterCallback; StrongReferences.Add(cb); GLFW.GlfwSetCursorEnterCallback(Window, cb); } { GLFWmousebuttonfun cb = MouseButtonCallback; StrongReferences.Add(cb); GLFW.GlfwSetMouseButtonCallback(Window, cb); } { GLFWwindowfocusfun cb = WindowFocusCallback; StrongReferences.Add(cb); GLFW.GlfwSetWindowFocusCallback(Window, cb); } { GLFWwindowiconifyfun cb = WindowIconifyCallback; StrongReferences.Add(cb); GLFW.GlfwSetWindowIconifyCallback(Window, cb); } { GLFWframebuffersizefun cb = FrameBufferSizeCallback; StrongReferences.Add(cb); GLFW.GlfwSetFramebufferSizeCallback(Window, cb); } }
public static extern GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
/*! @brief Sets the error callback. * * This function sets the error callback, which is called with an error code * and a human-readable description each time a GLFW error occurs. * * The error callback is called on the thread where the error occurred. If you * are using GLFW from multiple threads, your error callback needs to be * written accordingly. * * Because the description string may have been generated specifically for that * error, it is not guaranteed to be valid after the callback has returned. If * you wish to use it after the callback returns, you need to make a copy. * * Once set, the error callback remains set even after the library has been * terminated. * * @param[in] cbfun The new callback, or `NULL` to remove the currently set * callback. * @return The previously set callback, or `NULL` if no callback was set. * * @remarks This function may be called before @ref glfwInit. * * @par Thread Safety * This function may only be called from the main thread. * * @sa @ref error_handling * * @since Added in GLFW 3.0. * * @ingroup init */ internal static extern GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);