Ruby library/gem for game graphics? - ruby

I am creating a simple Blackjack game in Ruby, and I have finished all the game logic stuff (finally!) and currently have it running through the command line. It is all working, so now I need a library or gem that will make the whole graphics side of things easier.
Any ideas?
Thanks.

As well as Gosu, mentioned elsewhere, there's Rubygame which also appears to be regularly updated.
No opinion on either, suggested as an alternative for comparison.
UPDATE: New(-ish?) kid on the block: Ray. Fairly graphically-oriented, it would appear.

Maybe you could try to use Gosu which is a 2D game development library for the Ruby and C++ programming languages, available for Mac OS X, Windows and Linux.
Available as a gem. More information here
You can also watch a fun presentation I saw in Barcelona during Euruko (ruby conference).
Available Here

Shoes would be a good candidate, it's very lightweight, cross platform & fun to use.
It has a nice ruby API which you can use to draw shapes and use native GUI widgets.

Related

Ruby GUI support on OSX Mavericks (Not Shoes or Ruby Motion) plus OSX app package support

This has been asked many times. Some of the answers are pretty old now. I have looked around everywhere for 2 things.This the last resort before I give up. Looking for:
Bindings that will enable GUI programming using Ruby (not Shoes) using Mavericks. I have found plenty bindings but with no activity for the past 3 or 4 years, with the exception of RubyMotion which seems very expensive while not taking advantage of Xcode features / does not have an IDE.
Way to package app for users as a regular OSX app so the user does not have to install anything by hand on OSX (if mutiplatform even better to target Windows too)
I have fallen in love with Ruby but without a means to tackle the above will be difficult to deploy for users, while I am not interested in Rails.
Feels like Rails popularity has in effect killed Ruby by putting it into a niche when it could be so much more.
Any new news on either of these 2 fronts or everything is abandoned / dead ?
Should I move on with Python / Objective-C ? (Which I like both but enjoy Ruby more)
I succesfully compiled scripts with tk, green shoes and gosu as a GUI to an executable with ocra but only have experience doing so on windows. If you want an actual, cross platform GUI try the java swing framework with jruby, here an example.
If you deploy a JAR or an executable nu further installations are needed.
I suppose you use MRI ruby now, the step to jruby is not so difficult.
require 'java'
# With the 'require' above, we can now refer to things that are part of the
# standard Java platform via their full paths.
frame = javax.swing.JFrame.new("Window") # Creating a Java JFrame
label = javax.swing.JLabel.new("Hello")
# We can transparently call Java methods on Java objects, just as if they were defined in Ruby.
frame.getContentPane.add(label) # Invoking the Java method 'getContentPane'.
frame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
frame.pack
frame.setVisible(true)
RubyMotion is the best alternative. But if don't want to spend the money you should be able to use macruby.
Here are some resources
http://blog.phusion.nl/2010/03/12/creating-our-very-first-mac-application-with-ruby-how-exciting/
I must say that using macruby for a big project might not be a good idea. You should expect stuff breaking and few support. As of 2015, the [MacRuby page on GitHub][3] says that the project is in an indefinite hiatus due to the changes made by Apple in the Objective C garbage collection support that MacRuby depends on. They suggest using RubyMotion.
RubyMotion seems to be really good for what you want but for development the lack of a IDE is really a huge downside. Also from my experience rubymotion only comes handy if you already know the cocoa framework really well.
So my recommendation is for you to test rubymotion if you can. They give your money back in the first 30 days if you only want to try it out. So if you have the money give it a try.
If you are new to osx development and only want to develop for osx I think you should go with objective-c. The language is not that bad and you will get the best development environment available for it for free.

Side scrolling game in Ruby

Does anyone have advice on creating a side-scrolling action game in Ruby?
I am particularly looking for libraries, tools, or guides. I've built a terminal text-based game however now I'd like to involve graphics and possibly run the game outside of terminal.
It's important to me that it be in Ruby.
How about libgosu?
http://www.libgosu.org/
"Gosu is a 2D game development library for the Ruby and C++ programming languages, available for Mac OS X, Windows and Linux. It has been in development since 2001."
"Ruby/Gosu integrates well:
gem install gosu
complete with examples, precompiled for Windows & OS X"
A very nice toolkit for making 2D graphics is SDL there are ruby bindings available at
http://www.kmc.gr.jp/~ohai/rubysdl.en.html
oreilly net has a very nice article about writing games with ruby here
https://web.archive.org/web/20170813235228/http://archive.oreilly.com/pub/a/ruby/2007/12/04/creating-games-in-ruby.html
If jruby is ok for you, you can use various java libries for the gfx part like java2D or
processing ( http://www.rubyinside.com/using-the-processing-graphics-system-from-ruby-780.html )

Ruby: What game library is best/simplest for 2D arcades/platformers?

I want to create simple arcade on Ruby. I used GOSU some time, and then I find many game libraries for ruby: RubyGame, Chingu ....
What library is best for game development, and why?
Gosu is the most popular (and actively maintained) library for writing 2D games in Ruby. It has an underlying C++ library that it uses to improve performance and interact with the underlying display rendering libraries like OpenGL.
I'm also working on a gem that will make it easier to write real arcade games in Ruby. In the mean time, you may be interested in using a MAME compatible arcade controller. I wrote a gem that provides the common MAME keyboard input mappings for Gosu.
There is also a gem called GameBox which uses Gosu behind the scenes. GameBox attempts to abstract many of the common game boilerplate so that you are left with writing the "business logic" of your game.
It is for you to decide based on what exactly you will implement https://www.ruby-toolbox.com/categories/game_libraries

Alternatives for HornetsEye - Ruby

I installed HornetsEye, that "real-time computer vision library" for some experiments with my webcam. I want to know if are there other alternatives in ruby?
RMagick comes to mind, but it is not very very performant ...
I have not tested it yet personally, but since OpenCV is definitely the way to go from C++, the ruby-opencv gem could be interesting. I could only find this one actively developped, though.
http://github.com/ruby-opencv/ruby-opencv
Perhaps Camellia Image Processing Library interests you because.
It has been written in C but has a native wrapper for RUBY and its performance is very good.

Can Ruby be used for UI based Windows apps?

I'm sorry if this question is noob-ish but I'm not having much luck with Google. Can Ruby be used for UI based Windows apps? I'm not looking for a Rails app, just Ruby.
Thanks
You have couple of options.
Use Gtk Ruby which works on Windows as well (http://ruby-gnome2.sourceforge.jp/).
You can use WxRuby or Tk.
You can use JRuby and Swing.In fact there are high level libraries which can help you there, such as (http://monkeybars.rubyforge.org/)
Yes, but the experience will vary depending on how you hook up the UI. TK or gtk, wxRuby, ruby shoes (not sure how alive that one is right now), Qt (which is cool) and fox (aka fxRuby) are some of the options. If you like to hurt yourself, you can hook directly to Win32 libraries, but I doubt you'll want to.
Additionally, if you target the nascent IronRuby, you can use WinForms or WPF.
I also prefer wxRuby. It looks great, uses native components, yet is cross-platform. On the Ruby On Windows blog there is a great write-up of how to get started. It helped me a lot.
You bet. wxRuby is what I use, but others use GTK. wxRuby also works on Linux which is where I am writing a program, but it should suit your needs. You can install it using
gem install wxruby
You could check out wxRuby..
Depends what kind of Window app are you going to implement. If this is your own pet project, then definitely you can try WxRuby or GTK. There is no risk here.
However if this is going to be serious, commercial windows app then you have to think twice. It is really worth using Ruby? It is great language. I use it on daily basis. But for a Windows app, C# integration with the whole environment is hard to beat.
check out Shoooes!

Resources