Search in sources :

Example 1 with GLFW_KEY_H

use of org.lwjgl.glfw.GLFW.GLFW_KEY_H in project legui by SpinyOwl.

the class ShaderProgram method initializeGuiWithCallbacks.

private void initializeGuiWithCallbacks() {
    GLFWKeyCallbackI escapeCallback = (w1, key, code, action, mods) -> running = !(key == GLFW_KEY_ESCAPE && action != GLFW_RELEASE);
    // used to skip gui rendering
    GLFWKeyCallbackI hideCallback = (w1, key, code, action, mods) -> {
        if (key == GLFW_KEY_H && action == GLFW_RELEASE) {
            hiding = !hiding;
        }
    };
    GLFWWindowCloseCallbackI windowCloseCallback = w -> running = false;
    CallbackKeeper keeper = initializer.getCallbackKeeper();
    keeper.getChainKeyCallback().add(escapeCallback);
    keeper.getChainKeyCallback().add(hideCallback);
    keeper.getChainWindowCloseCallback().add(windowCloseCallback);
    Renderer renderer = initializer.getRenderer();
    renderer.initialize();
}
Also used : GLFW.glfwDestroyWindow(org.lwjgl.glfw.GLFW.glfwDestroyWindow) GL15.glBufferData(org.lwjgl.opengl.GL15.glBufferData) GLFW_RELEASE(org.lwjgl.glfw.GLFW.GLFW_RELEASE) GL_COMPILE_STATUS(org.lwjgl.opengl.GL20.GL_COMPILE_STATUS) GL30.glDeleteVertexArrays(org.lwjgl.opengl.GL30.glDeleteVertexArrays) GL20.glCompileShader(org.lwjgl.opengl.GL20.glCompileShader) Button(com.spinyowl.legui.component.Button) FloatBuffer(java.nio.FloatBuffer) GLFW.glfwCreateWindow(org.lwjgl.glfw.GLFW.glfwCreateWindow) GLFW.glfwPollEvents(org.lwjgl.glfw.GLFW.glfwPollEvents) GL_INFO_LOG_LENGTH(org.lwjgl.opengl.GL20.GL_INFO_LOG_LENGTH) GLFW.glfwSwapInterval(org.lwjgl.glfw.GLFW.glfwSwapInterval) GL20.glCreateShader(org.lwjgl.opengl.GL20.glCreateShader) GL11.glDisable(org.lwjgl.opengl.GL11.glDisable) GL11.glViewport(org.lwjgl.opengl.GL11.glViewport) GL20.glAttachShader(org.lwjgl.opengl.GL20.glAttachShader) NULL(org.lwjgl.system.MemoryUtil.NULL) Renderer(com.spinyowl.legui.system.renderer.Renderer) GL20.glGetShaderInfoLog(org.lwjgl.opengl.GL20.glGetShaderInfoLog) CallbackKeeper(com.spinyowl.legui.system.context.CallbackKeeper) GLFW.glfwShowWindow(org.lwjgl.glfw.GLFW.glfwShowWindow) GL30.glGenVertexArrays(org.lwjgl.opengl.GL30.glGenVertexArrays) LayoutManager(com.spinyowl.legui.system.layout.LayoutManager) GL15.glDeleteBuffers(org.lwjgl.opengl.GL15.glDeleteBuffers) CursorEnterEventListener(com.spinyowl.legui.listener.CursorEnterEventListener) GL_STENCIL_BUFFER_BIT(org.lwjgl.opengl.GL11.GL_STENCIL_BUFFER_BIT) CursorEnterEvent(com.spinyowl.legui.event.CursorEnterEvent) GL_TRIANGLES(org.lwjgl.opengl.GL11.GL_TRIANGLES) ColorConstants(com.spinyowl.legui.style.color.ColorConstants) Frame(com.spinyowl.legui.component.Frame) RadioButtonGroup(com.spinyowl.legui.component.RadioButtonGroup) GLFW.glfwTerminate(org.lwjgl.glfw.GLFW.glfwTerminate) GL_DEPTH_TEST(org.lwjgl.opengl.GL11.GL_DEPTH_TEST) GLFWKeyCallbackI(org.lwjgl.glfw.GLFWKeyCallbackI) Label(com.spinyowl.legui.component.Label) GL20.glShaderSource(org.lwjgl.opengl.GL20.glShaderSource) GL20.glLinkProgram(org.lwjgl.opengl.GL20.glLinkProgram) GL_VERTEX_SHADER(org.lwjgl.opengl.GL20.GL_VERTEX_SHADER) GLFW(org.lwjgl.glfw.GLFW) GLFW.glfwMakeContextCurrent(org.lwjgl.glfw.GLFW.glfwMakeContextCurrent) BufferUtils(org.lwjgl.BufferUtils) GL_STATIC_DRAW(org.lwjgl.opengl.GL15.GL_STATIC_DRAW) EventProcessorProvider(com.spinyowl.legui.listener.processor.EventProcessorProvider) List(java.util.List) Vector2i(org.joml.Vector2i) GLFW_KEY_H(org.lwjgl.glfw.GLFW.GLFW_KEY_H) GL_FLOAT(org.lwjgl.opengl.GL11.GL_FLOAT) GL20.glDeleteProgram(org.lwjgl.opengl.GL20.glDeleteProgram) GL11.glDrawArrays(org.lwjgl.opengl.GL11.glDrawArrays) GL20.glGetProgrami(org.lwjgl.opengl.GL20.glGetProgrami) GLFW.glfwSwapBuffers(org.lwjgl.glfw.GLFW.glfwSwapBuffers) GL20.glUseProgram(org.lwjgl.opengl.GL20.glUseProgram) DefaultInitializer(com.spinyowl.legui.DefaultInitializer) GL20.glDeleteShader(org.lwjgl.opengl.GL20.glDeleteShader) Component(com.spinyowl.legui.component.Component) MouseClickEventListener(com.spinyowl.legui.listener.MouseClickEventListener) GL20.glEnableVertexAttribArray(org.lwjgl.opengl.GL20.glEnableVertexAttribArray) GL_LINK_STATUS(org.lwjgl.opengl.GL20.GL_LINK_STATUS) RadioButton(com.spinyowl.legui.component.RadioButton) GL15.glBindBuffer(org.lwjgl.opengl.GL15.glBindBuffer) GL15.glGenBuffers(org.lwjgl.opengl.GL15.glGenBuffers) ArrayList(java.util.ArrayList) GL_COLOR_BUFFER_BIT(org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT) GLFWWindowCloseCallbackI(org.lwjgl.glfw.GLFWWindowCloseCallbackI) GL11.glClear(org.lwjgl.opengl.GL11.glClear) Context(com.spinyowl.legui.system.context.Context) GL11.glEnable(org.lwjgl.opengl.GL11.glEnable) GL30.glBindVertexArray(org.lwjgl.opengl.GL30.glBindVertexArray) GL20.glVertexAttribPointer(org.lwjgl.opengl.GL20.glVertexAttribPointer) GL11.glClearColor(org.lwjgl.opengl.GL11.glClearColor) GL_FRAGMENT_SHADER(org.lwjgl.opengl.GL20.GL_FRAGMENT_SHADER) GL20.glCreateProgram(org.lwjgl.opengl.GL20.glCreateProgram) IOException(java.io.IOException) AnimatorProvider(com.spinyowl.legui.animation.AnimatorProvider) GL_ARRAY_BUFFER(org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER) MouseClickEvent(com.spinyowl.legui.event.MouseClickEvent) GL_FALSE(org.lwjgl.opengl.GL11.GL_FALSE) GL20.glDetachShader(org.lwjgl.opengl.GL20.glDetachShader) GL_BLEND(org.lwjgl.opengl.GL11.GL_BLEND) GL20.glDisableVertexAttribArray(org.lwjgl.opengl.GL20.glDisableVertexAttribArray) SimpleLineBorder(com.spinyowl.legui.style.border.SimpleLineBorder) GLFW_KEY_ESCAPE(org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) GL20.glGetShaderi(org.lwjgl.opengl.GL20.glGetShaderi) GL(org.lwjgl.opengl.GL) GLFWKeyCallbackI(org.lwjgl.glfw.GLFWKeyCallbackI) CallbackKeeper(com.spinyowl.legui.system.context.CallbackKeeper) GLFWWindowCloseCallbackI(org.lwjgl.glfw.GLFWWindowCloseCallbackI) Renderer(com.spinyowl.legui.system.renderer.Renderer)

Aggregations

DefaultInitializer (com.spinyowl.legui.DefaultInitializer)1 AnimatorProvider (com.spinyowl.legui.animation.AnimatorProvider)1 Button (com.spinyowl.legui.component.Button)1 Component (com.spinyowl.legui.component.Component)1 Frame (com.spinyowl.legui.component.Frame)1 Label (com.spinyowl.legui.component.Label)1 RadioButton (com.spinyowl.legui.component.RadioButton)1 RadioButtonGroup (com.spinyowl.legui.component.RadioButtonGroup)1 CursorEnterEvent (com.spinyowl.legui.event.CursorEnterEvent)1 MouseClickEvent (com.spinyowl.legui.event.MouseClickEvent)1 CursorEnterEventListener (com.spinyowl.legui.listener.CursorEnterEventListener)1 MouseClickEventListener (com.spinyowl.legui.listener.MouseClickEventListener)1 EventProcessorProvider (com.spinyowl.legui.listener.processor.EventProcessorProvider)1 SimpleLineBorder (com.spinyowl.legui.style.border.SimpleLineBorder)1 ColorConstants (com.spinyowl.legui.style.color.ColorConstants)1 CallbackKeeper (com.spinyowl.legui.system.context.CallbackKeeper)1 Context (com.spinyowl.legui.system.context.Context)1 LayoutManager (com.spinyowl.legui.system.layout.LayoutManager)1 Renderer (com.spinyowl.legui.system.renderer.Renderer)1 IOException (java.io.IOException)1