Skip to content

Getting Started

Chadow edited this page Feb 9, 2024 · 8 revisions

Contents

  1. Get The Binary
  2. Executing A Game
    1. Command Line
    2. Boot File
    3. Embedding
  3. Packaging
    1. Simple
    2. Going Further
    3. Windows Icon

Get The Binary

You can get a build from the releases page or if you want the latest changes, from the Actions page on this repo.

Executing A Game

The next entries will explain the different ways to run your game with this utility, if you want to know the pros and cons of each take a lok at the following table:

Standalone Ruby Code is Hided
Command Line ✘²
Boot File ✘³
Embedding
  • ¹: while the program is fully standalone, the user has to open a terminal to run your game. This can be a deal-breaker if your players expect the classic click'n'run functionality of games. In case you intend to launch your game this way, you'll need to make custom launchers for each platform (an .ink or .bat in Windows, .desktop or .sh on Linux, for example)
  • ² ³: a possible workaround is compiling your Ruby source code to bytecode with mrbc. It is to note that as of now there aren't any known methods to reverse-engineer the bytecode.

Command Line

Call the binary with your game's entry point (generally main.rb) as argument:

gosu-mruby main.rb

It can run both Ruby and bytecode files.

Boot File

NOTE: experimental, feel free to raise an issue if you have a suggestion.

If there's a file named boot.rb in the same directory as the executable, it'll load that automatically, this way your users don't have to launch a terminal to run your game, just a click is needed and nothing more.

Normally, your boot.rb file will have something like this:

$: << 'src' # Add the src directory to the load path

require 'main'

# If you start your game loop in main or whatever other file, this isn't needed, however
# it can be done too here too
# MyGameWindow.new.show

Embedding

Also can be called Fused mode, this way is more complex than the other two, but admittedly the one with the more pros. Take a look at its wiki page.

Packaging

Simple

Once you have setup your project to be executed, you can package it as it is! There's no special thing to, just ZIP your game along with the shared libraries (.dlls, .sos) and distribute it, make sure to rename the generic name of the executable to one of your liking too.

Going Further

You could try to use one of the platform-specific ways of packaging:

WARNING: not tested, it'll be appreciated if you could contribute a guide if you do manage to package to one of this formats!

Windows Icon

The icon of the executable can be changed using Resource Hacker. The steps are the following:

  1. Open the executable, and you'll be greeted by this screen: empty screen
  2. Right-click the "Icon" entry and select Replace Icon ...: ![select replace icon]https://github.com/Chadowo/gosu-mruby-wrapper/assets/83732118/25fc8906-069f-4713-822f-f8d3c37b660c)
  3. Then in the following screen, click Open file with new icon..:
    open file
  4. Once you select your icon, click Replace and save it:
    save