Skip to content

Instantly share code, notes, and snippets.

@whity-82
whity-82 / gist:5421869
Created April 19, 2013 17:32
Sample of keyboard event handling on Chingu
#coding:utf-8
require 'chingu'
class GameWindow < Chingu::Window
# 1行の高さ(=フォントサイズ)
LINE_HEIGHT =20
# ウィンドウの高さ(行数)
LINES_IN_WINDOW = 24
# 標準フォントサイズ
FONT_SIZE = 20
@whity-82
whity-82 / gist:5419759
Last active December 16, 2015 10:19
Very basic sample of Chingu
require 'chingu'
class GameWindow < Chingu::Window
def initialize
super 640, 480, false
self.caption = "Chingu Tutorial Game"
end
def update
end
@whity-82
whity-82 / gist:5414073
Created April 18, 2013 16:22
Sample of mouse cursor enabling with Gosu
#coding:utf-8
require 'gosu'
class GameWindow < Gosu::Window
def initialize
super(640, 480, false)
end
# マウスカーソルを表示する
@whity-82
whity-82 / gist:5404633
Created April 17, 2013 14:15
Sample of keyboard event handling on Gosu
#coding:utf-8
require 'gosu'
class GameWindow < Gosu::Window
# 1行の高さ(=フォントサイズ)
LINE_HEIGHT =20
# ウィンドウの高さ(行数)
LINES_IN_WINDOW = 24
def initialize
@whity-82
whity-82 / gist:5403912
Last active December 16, 2015 08:09
Sample of drawing text with Gosu. Experiment how factor_x works.
require 'gosu'
class GameWindow < Gosu::Window
# 1行の高さ(=フォントサイズ)
LINE_HEIGHT =20
# ウィンドウの高さ(行数)
LINES_IN_WINDOW = 24
def initialize
super(640, LINE_HEIGHT * LINES_IN_WINDOW, false)
@whity-82
whity-82 / gist:5403900
Last active December 2, 2023 02:18
Sample of drawing text with Gosu & Ruby.
require 'gosu'
class GameWindow < Gosu::Window
def initialize
super 640, 480, false
self.caption = "Gosu Tutorial Game"
@font = Gosu::Font.new(self, Gosu::default_font_name, 20)
end