I have a Raspberry PiTFT 7" Touchscreen display and I'd like to create a simple app to display and output system data (ie. CPU usage, temperature etc).
I've noticed that the current common method of implementing this is to use the pygame library to output into the framebuffer /dev/fb1 in which the display is connected to.
I'd like to perform the same action but using Ruby as I am more familiar with the language.
Can someone point me in the right direction as to how do I get started?
I've looked at both rubygame and gosu libraries, and they seem to be able to do what I want to do, which is to draw a screen but I am unable to find any information as to how to direct the output into the framebuffer itself.
The ruby corelib has an IO class you should be able to use to direct output to the framebuffer, say:
device = IO.sysopen '/dev/fb1'
buffer = IO.new device, 'a'
buffer.puts "Your usecase."
You can use the same pattern to interact with many of the special /dev
files, such as writing to /dev/null
or reading from /dev/random
(although both of these are better abstracted already through File::NULL
and Random
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With