Star Ruby Ruby extension library for creating 2D games

StarRuby::Game

Module manages whole game.

Module methods

Game.fps
Game.fps=(fps)

Set/Get FPS (frames per second) limit. Default value is 30.

Game.real_fps

Get actual FPS.

Game.screen

Get final output(Texture) of the game screen.

The screen is NOT cleared automatically at the beginning of the game loop, so you should clear it by Texture#clear method.

Game.screen.clear
Game.run(width, height, options = {}) { ... }

Starts the game. Executes passed block each frame.

Resolution of the game screen set by width and height .

You have to pass Hash as options. Keys and values below can be selected.

KeyValueDefault
:cursorWhether to show a cursor or not (Since Ver. 0.1.16)false
:fullscreenFullscreen or not (Since Ver. 0.1.12)false
:window_scaleScale of the window.It will keep the resolution of the gamescreen.1
Game.running?

If the game is running return true otherwise return false.

Game.terminate

Terminate the game.

Game.ticks

Get the number of milliseconds since the program began.

(Not translated yet:) 実装の都合上、 49 日程度でオーバーフローし、 0 に戻ります。

Game.title
Game.title=(title)

Set/Get the game title.

© Copyright 2010 Hajime Hoshi