Skip to content

Instantly share code, notes, and snippets.

@RPGP1
RPGP1 / gem_make.out
Created March 17, 2017 12:47
failed in 'gem install debase'
current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/debase-0.2.1/ext
C:/Ruby23/bin/ruby.exe -r ./siteconf20170317-11968-1h343qx.rb extconf.rb
checking for vm_core.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
@RPGP1
RPGP1 / array#===.rb
Created January 26, 2014 07:32
Array#===は要素を===で判定してくれ!
class Array
def ===(other)
return false if self.size != other.size
self.each_with_index do |value, index|
return false unless value === other[index]
end
return true
end
end
@RPGP1
RPGP1 / DXRubyのSpriteを継承して拡張する方法についてbyしのかろ.md
Created December 6, 2013 23:19
DXRubyのSpriteを継承して拡張する方法について

DXRuby Advent Calendar 2013 7日目 title: DXRubyのSpriteを継承して拡張する方法について author: しのかろ(Twitter@shinokaro)

 DXRuby Advent Calendar 2013も7日目。
 1週間目の終わりは“しのかろ”が記事をお送りします。
 世にゲーム・プログラマー多数あり、と言えども実際のコードにおいては、
文章の形で公開されることは稀です。
 ですから、今年のこのイベントで公開される記事を楽しみに毎日を過ごしています。

@RPGP1
RPGP1 / DSLtest.md
Last active December 9, 2015 18:29
if condition do
  # execute here when condition is true
end

while condtion do
  # execute here again and again while condition is true
end
Dim say As String, i as Integer
say = "I love Ruby"
For i = 1 To 5 Step 1
MsgBox say
Next i
@RPGP1
RPGP1 / DXRubyAdventCalendar2014_16.md
Last active November 1, 2015 09:00
DXRuby Advent Calendar 16日目  DXRubyでRPGを作りたくて

DXRubyでRPGを作りたくて

この記事はDXRuby Advent Calendarの16日目の記事です。昨日はmirichiさんのDXRubyの怪しげで不自然な挙動について語るでした。DirectXをCで直接叩いているそうで、かなり大変そうですね。しかし全て把握しているのもまた、凄いと思います。

# coding: Introduction

どうも、GameKazuです。DXRubyという使いやすいライブラリを使って、RPGという最も複雑なゲームの1つを作ろうとしている学生です。プログラミング歴は3年と少し、RubyとDXRubyは2年と少しなので、今回の参加者の中でも短い方だと思います。

@RPGP1
RPGP1 / command.rb
Created December 27, 2014 03:25
Rubyでコマンドシステム作ってみたら遅かった。(本体はcommand_test.rbです)
# coding: utf-8
require_relative './command_block'
require_relative './command_error'
require_relative './command_parts'
module Command
def self.included(mod)
mod.instance_eval do
include CommandSetter
@RPGP1
RPGP1 / my_map_system.txt
Created May 6, 2014 04:28
マップシステム考えた。
Mapは、TileSetを一つ持つ。
自身の持つ二次元配列とTileSetから受け取る画像配列で描画する。
TileSetは、Tileをまとめる。
分割前の画像・分割方法を記憶し、Tileを生成して保持。
Tileから画像を受け取り画像配列を作る。
Tileの一部だけ画像を変更するとそれを記憶しておく。
Tileはそれぞれのtype毎にサブクラスを定義し、生成時に受け取った画像などの情報を適切に処理する。
オートタイルで実際に表示される画像(複数)を保持する。
@RPGP1
RPGP1 / electricpiano.rb
Created April 23, 2014 09:03
安い電子ピアノの音を作った。ProcとFiberで周波数を返すことで、倍音の合成を楽にした。
require 'dxruby'
piano = [0.419414141440249,
0.166971777138902,
0.235853904101082,
0.0470590406691173,
0.0373803247025181,
0.00373803247025181,
0.0166971777138902,
0.0419414141440249,
@RPGP1
RPGP1 / marshal_image.rb
Last active August 29, 2015 13:58
Image#marshal_dump/marshal_load作った。ひとまずこれで凌ぐ。
# coding: ASCII
require 'dxruby'
require 'zlib'
module DXRuby
class Image
def marshal_dump
image_data = []
for y in 0...height