この資料は、「2024 年度 Ruby アソシエーション開発助成金」制度で採択された「Processing Gem ベースの 2D レトロゲームエンジンの開発」についての最終報告書になります。
昨年度採択されたCRuby 用 Processing Gem の本家 Processing との互換性向上に向けた取り組みを基に、その成果物である Processing Gem をベースにして新たに 2Dレトロゲームエンジンの開発を行いました。
この資料は、「2024 年度 Ruby アソシエーション開発助成金」制度で採択された「Processing Gem ベースの 2D レトロゲームエンジンの開発」についての最終報告書になります。
昨年度採択されたCRuby 用 Processing Gem の本家 Processing との互換性向上に向けた取り組みを基に、その成果物である Processing Gem をベースにして新たに 2Dレトロゲームエンジンの開発を行いました。
| def add_sp(array = nil, sp) | |
| add_sprite sp | |
| array&.push sp | |
| sp | |
| end | |
| def delete_sp(array = nil, sp) | |
| remove_sprite sp | |
| array&.delete sp | |
| sp |
この資料は、「2024 年度 Ruby アソシエーション開発助成金」制度で採択された「Processing Gem ベースの 2D レトロゲームエンジンの開発」についての中間報告書になります。
昨年度採択されたCRuby 用 Processing Gem の本家 Processing との互換性向上に向けた取り組みを基に、その成果物である Processing Gem をベースにして新たに 2Dレトロゲームエンジンの開発を行います。
| require 'strscan' | |
| require 'rubysketch' | |
| using RubySketch | |
| B = Beeps | |
| class MMLCompiler | |
| def compile(str) | |
| scanner = StringScanner.new str.gsub(/;.*\n/, '') |
この資料は、「2023 年度 Ruby アソシエーション開発助成金」制度で採択された「CRuby 用 Processing Gem の、本家 Processing との互換性向上に向けた取り組み」についての中間報告書になります。
クリエイティブコーディングの世界では Processing や p5.js のようなフレームワークが広く利用されています。これらを利用することで、フレームワーク利用者はグラフィックスと視覚的な表現を駆使したアートやインタラクティブなアプリケーションを簡単に作成することができます。
| require 'rubysketch' | |
| using RubySketch | |
| STEP = 20 | |
| SIZE_RANGE = 20..100 | |
| def nextSize() | |
| SIZE_RANGE.step(STEP).to_a.sample | |
| end |
| SAVE_PATH = 'ToonData' | |
| class Button < Sprite | |
| def initialize(w: 100, h: 44, label: nil, rgb: [200] * 3, &block) | |
| super 0, 0, w, h | |
| @label, @rgb, @select = label, rgb, false | |
| pressing = false | |
| includeMouse = ->x, y { (0...self.w).include?(x) && (0..self.h).include?(y) } |
| CHECKER_SHADER = createShader nil, <<END | |
| varying vec4 vertPosition; | |
| void main() { | |
| float x = mod(vertPosition.x, 32.) / 16. - 1.; | |
| float y = mod(vertPosition.y, 32.) / 16. - 1.; | |
| float c = x * y >= 0. ? 0.8 : 0.7; | |
| gl_FragColor = vec4(c, c, c, 1.); | |
| } | |
| END |
| require 'rubysketch' | |
| using RubySketch | |
| class Canvas < Sprite | |
| def initialize(width, height, scale: 1) | |
| super 0, 0, width, height | |
| @width, @height, @scale = width, height, scale |