This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "matrix" | |
# 変換前後の座標から射影変換のパラメーターを求める | |
# x11-x14: 変換前のX座標(左上から時計回り) | |
# y11-y14: 変換前のY座標 | |
# x21-x24: 変換後のX座標 | |
# y21-y24: 変換後のY座標 | |
def homography_params(x11, y11, x12, y12, | |
x13, y13, x14, y14, | |
x21, y21, x22, y22, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gosu" | |
module InputName | |
module ZOrder | |
Background, Text, Cursor = *0..2 | |
end | |
class Window < Gosu::Window | |
def initialize(width=240, height=160) | |
super(width, height, false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require "gosu" | |
rescue LoadError | |
$stderr.puts(<<-END_OF_MESSAGE) | |
LoadError: #{$!.message}. Please try `gem install gosu`. | |
If you are using Linux, please see https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux | |
END_OF_MESSAGE | |
exit(false) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gosu" | |
module CatchHats | |
module ZOrder | |
Background, Object, Text = *0..2 | |
end | |
class Player | |
attr_reader :x, :y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require "shogi_koma" | |
PIECES = [ | |
["歩兵", "FU"], | |
["香車", "KY"], | |
["桂馬", "KE"], | |
["銀将", "GI"], | |
["金将", "KI"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gosu/zen" | |
include Gosu::Zen | |
# patch | |
module Gosu | |
module Zen | |
def init(&body) | |
ZenWindow.send(:define_method, :init, &body) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gosu" | |
module GosuImageViewer | |
class Window < Gosu::Window | |
def initialize(width=640, height=480) | |
super(width, height, false) | |
self.caption = "Image Viewer using Gosu" | |
@images = [] | |
@scale = 1.0 | |
@angle = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gosu" | |
require "shogi" | |
require "socket" | |
module RbShogi | |
PIECES = [ | |
"FU", "TO", | |
"KY", "NY", | |
"KE", "NK", | |
"GI", "NG", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gtk3" | |
require "bricks_meet_balls" | |
class GameButton < Gtk::Button | |
PROPERTIES = [ | |
"num_of_rows", | |
"num_of_columns", | |
"num_of_balls", | |
"ball_images", | |
"brick_images", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# space_invaders.rb: | |
# A game as Space Invaders using Gosu and Ruby. | |
# | |
# Authors: | |
# (c) 2014 Masafumi Yokoyama | |
# | |
# License: | |
# This program is licensed under the MIT License. | |
# |