Skip to content

Instantly share code, notes, and snippets.

# coding: UTF-8
require_relative '../mydxlibrary/push_keys'
class MenuBase < Sprite
attr_accessor :alp, :alp2
attr_reader :bgImage, :child, :parent
def initialize(x, y, bgImage)
super(x, y, RenderTarget.new(bgImage.width, bgImage.height))
@RPGP1
RPGP1 / push_keys.rb
Created March 14, 2014 10:03
Input.push_keysが欲しくなったから作った。#DXRuby キーコードが全て/^K_/だからできた。
# coding: UTF-8
require "dxruby"
module DXRuby
KeyNames = self.constants.keep_if{|c| c[0..1] == "K_"}.freeze
KeyCodes = KeyNames.dup.map{|k| self.const_get(k)}.freeze
Keys = Hash.new.tap{|h| KeyNames.each_with_index{|n, i| h[n] = KeyCodes[i]}}.freeze
end
@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週間目の終わりは“しのかろ”が記事をお送りします。
 世にゲーム・プログラマー多数あり、と言えども実際のコードにおいては、
文章の形で公開されることは稀です。
 ですから、今年のこのイベントで公開される記事を楽しみに毎日を過ごしています。