recursivegrid
Version, currently master branch1 version
- master branchlatestOct 1, 2024
github.com/wolfgang371/recursivegrid
A small library for two-dimensional, recursive grids
Installation
# Add this to your shard.yml
dependencies:
recursivegrid:
github: wolfgang371/recursivegrid
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.11.2- License
- MIT
- Author
- wolfgang371
Dependencies
Runtime Dependencies
- imgui1.89.9github: oprypin/crystal-imgui
- crsfml*github: oprypin/crsfml
- imgui-sfml1.89.8github: oprypin/crystal-imgui-sfml
README
recursivegrid
RecursiveGrid is a small library, written in Crystal. Main characteristics are:
- two-dimensional grid
- grids can contain grids, recursively
- grid elements can be arbitrary classes
- allow dynamical changes
- an API that fits immediate mode GUI usage
... while abstracting away / hiding...
- grid index counting on the user side
- column and/or row spanning
In addition you can find a sample GUI wrapper (for ImGui) that also abstracts the following aspects:
- pixel counting for both elements and optionally also (sub)grid frames
- automatical resizing of elements
https://github.com/user-attachments/assets/80b9bc63-79d2-4ea2-be8b-4d9116c34e40
Installation
-
Add the dependency to your
shard.yml:dependencies: recursivegrid: github: wolfgang371/recursivegrid -
Run
shards install -
Follow steps in
setup.sh -
Run
source ./setup.sh
Usage
Direct library usage
Simple example, taken from specs:
require "recursivegrid"
c = RecursiveGrid::Grid(Int32)
grid = c.new([[10, c.new([[20],[30]])]])
grid.size.should eq({2, 2})
grid.get_matrix.should eq([
[10, 20],
[10, 30]
])
Sample ImGui based GUI demo
As in src/imguidemo.cr, see above video.
Thanks
Thanks to...
- @ocornut, https://github.com/ocornut/ for Dear ImGui
- @oprypin, https://github.com/oprypin/ for Crystal port of ImGui
- Crystal team, https://github.com/crystal-lang/, https://crystal-lang.org/
Contributing
- Fork it (https://github.com/your-github-user/recursivegrid/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- wolfgang371 - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Oct 1, 2024
- Crystal
>= 1.11.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/wolfgang371/recursivegrid
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 1