Skip to content

GLFW demo#66

Open
akmubi wants to merge 2 commits intorxi:masterfrom
akmubi:master
Open

GLFW demo#66
akmubi wants to merge 2 commits intorxi:masterfrom
akmubi:master

Conversation

@akmubi
Copy link
Copy Markdown

@akmubi akmubi commented Oct 17, 2023

Added this as an example.

I stumbled upon the GDI demo PR recently and wondered, "Why don't we have a GLFW implementation?" So, I wrote a basic implementation.

It's pretty raw right now - I hashed it out in about an hour while flipping through the GLFW docs. I mostly omitted error handling, and moved input processing to glfw callbacks. There are some tweaks in the function signatures (like r_init, r_present), mainly because certain GLFW functions needed the GLFWwindow parameter.

I tested this in MinGW64 (MSYS2). To compile you need to install glfw and pkg-config packages (or replace pkg-config --libs glfw3 with -L<path-to-libglfw> -lglfw3 in build.sh). To install these packages (in MSYS2) run:

pacman -S mingw-w64-x86_64-glfw
pacman -S mingw-w64-x86_64-pkg-config

@awschult002
Copy link
Copy Markdown

there has been a new community fork of this repository. the community is looking to add some new simple features. please feel free to try your PR over there.

https://github.com/microui-community/microui

static int logbuf_updated = 0;
static float bg[3] = { 90, 95, 100 };

/* make context global because we need it in glfw callbacks */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global context is not needed, you can call glfwSetWindowUserPointer(window, ctx) in main and glfwGetWindowUserPointer(window) in the callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants