use of com.spinyowl.cbchain.impl.ChainErrorCallback in project legui by SpinyOwl.
the class Demo method initialize.
private void initialize() {
if (!GLFW.glfwInit()) {
throw new RuntimeException("Can't initialize GLFW");
}
ChainErrorCallback errorCallback = new ChainErrorCallback();
errorCallback.add(GLFWErrorCallback.createPrint(System.err));
errorCallback.add(GLFWErrorCallback.createThrow());
glfwSetErrorCallback(errorCallback);
glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE);
GLFWKeyCallbackI glfwKeyCallbackI = (w1, key, code, action, mods) -> running = !(key == GLFW_KEY_ESCAPE && action != GLFW_RELEASE);
GLFWWindowCloseCallbackI glfwWindowCloseCallbackI = w -> running = false;
frame = new Frame(width, height);
window = glfwCreateWindow(width, height, title, NULL, NULL);
glfwSetWindowPos(window, 50, 50);
glfwShowWindow(window);
createGuiElements(frame);
context = new Context(window);
keeper = new DefaultCallbackKeeper();
CallbackKeeper.registerCallbacks(window, keeper);
keeper.getChainKeyCallback().add(glfwKeyCallbackI);
keeper.getChainWindowCloseCallback().add(glfwWindowCloseCallbackI);
systemEventProcessor = new SystemEventProcessorImpl();
SystemEventProcessor.addDefaultCallbacks(keeper, systemEventProcessor);
running = true;
}
Aggregations