I have made quite a lot of games in Ruby2D. I can play them on my PC, laptop. Ruby2D is a lot of fun and works very fast!

But for some strange reason I can't get Ruby2D window working on a Raspberry Pi 3 model B.

The OS I use is Arch Linux ARM on the Pi, where shapes and images are monochrome, that is, either fully white or fully black.

I have also tried Raspbian Buster and Ubuntu Mate. The Raspbian Buster fails with a black window.

Surprisingly enough, on Ubuntu Mate (tried about 6 months ago), the window is full screen even though I didn't set fullscreen: parameter to true, and mouse keyboard was not working.

Here's a preview of a Ruby2D Window with a Gradient Coloured Square

Here's how it looks on the Rapsberry Pi running Arch Linux ARM: Preview 1 Ruby2D on Arch Linux ARM - Circle Objects

You see, even though the colours are given are %w(#FF50A6 #5555FF #FFFF00 #3CE3B5) the windows shows only white.

In reality it should have all the four colours.

On my laptop running Arch Linux x86_64 the same code produces this window: Preview Arch Linux x86_64 on laptop showing proper preview


#!/usr/bin/ruby -w
require 'ruby2d'

Square.new(color: %w(#FF50A6 #5555FF #FFFF00 #3CE3B5))

Showing Random Coloured Dots on the Window

Here's how it looks on Arch Linux ARM: Preview 2 Random coloured dots

Here's how it looks on my laptop: Preview Arch Linux x86_64 on laptop showing random colored dots


#!/usr/bin/ruby -w
require 'ruby2d'

W, H = 640, 480
set width: W, height: H, fps_cap: 1
1000.times { Square.new(size: rand(1..3), color: [rand, rand, rand, 1], x: rand(W), y: rand(H)) }

If you use Image.new(...), it will show a white flat square on the window!

Displaying an Image with Image.new

Preview 2 Ruby2D on Arch Linux ARM - Image Objects


#!/usr/bin/ruby -w
require 'ruby2d'

W, H = 640, 480
set width: W, height: H, resizable: true, full_screen: false
Image.new(File.join(%w(/ tmp circle.png))).tap { |x| x.width, x.height = W, H}

Why does Ruby2D fails all the time on the Raspberry Pi? How can I properly run Ruby2D on the Raspberry Pi?

  • @jsotola, this behaviour is only applicable for the raspberry pi. The 3 GNU/Linux distributions I tried on the RPi fails render Ruby2D window properly. On my laptop and desktop combined, I have tried more than 10 different distributions and all work perfectly. – Sourav Goswami Aug 7 '19 at 5:11
  • I have updated my post, and added codes to the body... – Sourav Goswami Aug 7 '19 at 5:18
  • I don't know what causes the error. I have searched on stackoverflow, and got a similar result about the error but that's on an Android! Here's the post: stackoverflow.com/questions/29456707/… ... As I said, this only happens on the raspberry pi, and not even on a 32 bit Linux Mint OS that I tested on my laptop.. – Sourav Goswami Aug 7 '19 at 5:23
  • Yes, I should delete them then. Sure they all are the same error, but I posted the redundant images because it makes clear that the colours don't work with shapes and images (currently I have tested png and jpg). – Sourav Goswami Aug 7 '19 at 5:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.