All Projects → glfw → gleq

glfw / gleq

Licence: other
Simple event queue for GLFW 3

Programming Languages

objective c
16641 projects - #2 most used programming language
c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to gleq

Opengl cmake skeleton
❤️ A ready to use cmake skeleton using GLFW, Glew and glm. 👍
Stars: ✭ 118 (+78.79%)
Mutual labels:  glfw
Glslviewer
Console-based GLSL Sandbox for 2D/3D shaders shaders
Stars: ✭ 2,834 (+4193.94%)
Mutual labels:  glfw
OpenGLAda
Thick Ada binding for OpenGL and GLFW
Stars: ✭ 85 (+28.79%)
Mutual labels:  glfw
Pyglfw
Python bindings for GLFW
Stars: ✭ 136 (+106.06%)
Mutual labels:  glfw
Vxr
General purpose engine written in C++ with emphasis on materials rendering (PBR, clear coat, anisotropy, iridescence)
Stars: ✭ 181 (+174.24%)
Mutual labels:  glfw
Berserk
[WIP] High performance 3D graphics game engine
Stars: ✭ 31 (-53.03%)
Mutual labels:  glfw
Demos
Vulkan API crossplatform demos in Go
Stars: ✭ 103 (+56.06%)
Mutual labels:  glfw
nuklear-glfw-vulkan
A nuklear adapter that does Vulkan rendering
Stars: ✭ 52 (-21.21%)
Mutual labels:  glfw
Lwjgl3 Tutorial
Tutorial for the Lightweight Java Game Library (LWJGL) 3
Stars: ✭ 199 (+201.52%)
Mutual labels:  glfw
n8engine
An open-source C# game engine that's going to be the best thing ever.
Stars: ✭ 51 (-22.73%)
Mutual labels:  glfw
Bimpy
imgui for python
Stars: ✭ 144 (+118.18%)
Mutual labels:  glfw
Flextgl
OpenGL and Vulkan header and loader generator.
Stars: ✭ 180 (+172.73%)
Mutual labels:  glfw
ImFrame
dear imgui + glfw framework
Stars: ✭ 86 (+30.3%)
Mutual labels:  glfw
Borealis
Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx).
Stars: ✭ 135 (+104.55%)
Mutual labels:  glfw
GLFW3.NET
Automatic generated bindings of GLFW3 for .NET
Stars: ✭ 28 (-57.58%)
Mutual labels:  glfw
Futureproof
A live editor for fragment shaders, powered by Neovim, WebGPU, and Zig!
Stars: ✭ 117 (+77.27%)
Mutual labels:  glfw
Nimgl
NimGL is a Nim library that offers bindings for popular libraries used in computer graphics
Stars: ✭ 218 (+230.3%)
Mutual labels:  glfw
Spatial.Engine
[WIP] Spatial is a cross-platform C++ game engine.
Stars: ✭ 50 (-24.24%)
Mutual labels:  glfw
demo-emulator
Nintendo Game Boy emulator written in Go to be used in workshops about emulator programming
Stars: ✭ 41 (-37.88%)
Mutual labels:  glfw
glfw.github.io
Jekyll sources for GLFW website
Stars: ✭ 27 (-59.09%)
Mutual labels:  glfw

GLEQ — GLFW Event Queue

GLEQ is a basic, header-only event queue library for GLFW 3. It adds GLFW events for monitors, joysticks and windows to a single global queue. Nothing more.

GLEQ is inspired by SDL and GLWT, and is written as an example for people requesting that GLFW provide an event queue API, to show how easy it is to implement on top of GLFW callbacks.

GLEQ is written in C and depends only on GLFW 3.0 or later.

GLEQ is a work in progress and the interface may change but it works as intended and covers nearly all events up to and including GLFW 3.3. Just drop it into your project and include it after the GLFW header.

GLEQ is licensed under the zlib/libpng license.

Using GLEQ

To use GLEQ, include gleq.h after the GLFW header. To add the implementation of GLEQ, define GLEQ_IMPLEMENTATION before including the GLEQ header in exactly one source file.

#include <GLFW/glfw3.h>

#define GLEQ_IMPLEMENTATION
#include "gleq.h"

If you will only be using GLEQ in a single source file, you can make all its functions static by defining GLEQ_STATIC as well.

#include <GLFW/glfw3.h>

#define GLEQ_IMPLEMENTATION
#define GLEQ_STATIC
#include "gleq.h"

After GLFW has been successfully initialized, call gleqInit. This will replace the monitor and joystick callbacks.

if (!glfwInit())
    return false;

gleqInit();

Once a GLFW window is created, you can track it with gleqTrackWindow. This replaces all callbacks on that window.

gleqTrackWindow(window);

Event processing is done as usual with glfwPollEvents, glfwWaitEvents or glfwWaitEventsTimeout. Events for monitors, joysticks and tracked windows are added to the queue as GLFW reports them.

Event retrieval is done with gleqNextEvent and each event is then freed with gleqFreeEvent.

GLEQevent event;

while (gleqNextEvent(&event))
{
    switch (event.type)
    {
        case GLEQ_WINDOW_RESIZED:
            printf("Window resized to %ix%i\n",
                   event.size.width, event.size.height);
            break;
    }

    gleqFreeEvent(&event);
}

The call to gleqFreeEvent frees any memory allocated for the event and clears the event struct. Currently only the file drop event allocates memory, but it's recommended to call it for every event once it has been processed.

FAQ

Does GLEQ use the GLFW window user pointer?

No, only GLFW callbacks.

Does GLEQ allocate memory?

Only to save a deep copy of the path list provided to the file drop callback. The event queue itself is a global static array.

Aren't static arrays bad?

It depends. Also, the size of the queue can be controlled with GLEQ_CAPACITY.

Isn't global data bad?

It depends. The native event queue wrapped by GLFW is global, too.

Why doesn't GLEQ provide one queue per window?

GLEQ is intended to be a simple example event queue. Having a queue per window would make it more complicated than it needs to be.

Why isn't GLEQ thread safe?

GLEQ is intended to be a simple example event queue. Making it thread safe would make it more complicated than it needs to be.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].