Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

Trying to integrate 'constraint-layout'

Open
#223 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

The docs talk about using a 'constraint solver' like Cassowary with the space layout to do constrained layout. [There is a discussion here](https://8th-dev.com/forum/index.php/topic,2228.0.html) on my forum about the matter.

TL;DR: Nuklear outputs coordinates as soon as e.g. nk_button_label() is called. But the constraint-solver doesn't know the coordinates until after all items with constraints have been added.

One solution might be to layout rectangles separately and solve the constraints, then apply the rectangles to the items. But that doesn't work unless you already know the minimum sizes of the items being inserted in those rectangles (e.g. text length of a button).

My idea is to add something like "nk_layout_constrained_begin" and "nk_layout_constrained_end" and have the solver work on 'end'... but how do I queue up the items added and act appropriately?

All ideas welcome!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Nuklear layout documentation and the discussion linked in the issue, then trace how nk_button_label() emits coordinates. The issue does not name a file or test, and completion criteria remain unresolved because the constrained-layout API and item-queueing approach are still open design questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.