https://github.com/stumpycr/stumpy_x11
Display a canvas as a X11 window [experimental]
https://github.com/stumpycr/stumpy_x11
crystal framebuffer x11
Last synced: 2 months ago
JSON representation
Display a canvas as a X11 window [experimental]
- Host: GitHub
- URL: https://github.com/stumpycr/stumpy_x11
- Owner: stumpycr
- Created: 2017-05-11T13:48:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-11T14:23:15.000Z (over 8 years ago)
- Last Synced: 2025-01-22T23:28:04.633Z (11 months ago)
- Topics: crystal, framebuffer, x11
- Language: Crystal
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stumpy_x11
Display a canvas as a X11 window
## Example
``` crystal
require "stumpy_x11"
include StumpyCore
width, height = 400, 400
window = StumpyX11.new(width, height)
canvas = Canvas.new(width, height)
steps = 100
steps.times do |t|
(0...width).each do |x|
(0...height).each do |y|
canvas[x, y] = RGBA.from_relative(
x / width.to_f,
y / height.to_f,
t / steps.to_f,
1.0
)
end
end
window.write(canvas)
sleep 0.02
end
window.destroy
```
## TODO
* Handle window close event
* Documentation (writing raw slices)
## Credits
* [Daniel Collin (emoon)](https://github.com/emoon), most of the x11 stuff
was ported over from [emoon/minifb](https://github.com/emoon/minifb)
## Troubleshooting
If you run into errors like `unknown type wchar_t`,
run `ln -s /usr/include/linux/stddef.h /usr/include/stddef.h`