Skip to content

Instantly share code, notes, and snippets.

@xord
xord / grant-2023.md
Last active March 15, 2024 15:56
2023 年度 Ruby アソシエーション開発助成金 最終報告

2023 年度 Ruby アソシエーション開発助成金 最終報告

1. はじめに

この資料は、「2023 年度 Ruby アソシエーション開発助成金」制度で採択された「CRuby 用 Processing Gem の、本家 Processing との互換性向上に向けた取り組み」についての最終報告書になります。

2. プロジェクトについて

2.1 概要

@xord
xord / grant-2023.md
Last active January 9, 2024 16:34
2023 年度 Ruby アソシエーション開発助成金 中間報告

2023 年度 Ruby アソシエーション開発助成金 中間報告

1. はじめに

この資料は、「2023 年度 Ruby アソシエーション開発助成金」制度で採択された「CRuby 用 Processing Gem の、本家 Processing との互換性向上に向けた取り組み」についての中間報告書になります。

2. プロジェクト概要

クリエイティブコーディングの世界では Processingp5.js のようなフレームワークが広く利用されています。これらを利用することで、フレームワーク利用者はグラフィックスと視覚的な表現を駆使したアートやインタラクティブなアプリケーションを簡単に作成することができます。

@xord
xord / ball_merge_game.rb
Created December 9, 2023 06:34
スイカゲーム風サンプル
require 'rubysketch'
using RubySketch
STEP = 20
SIZE_RANGE = 20..100
def nextSize()
SIZE_RANGE.step(STEP).to_a.sample
end
@xord
xord / toon3.rb
Created October 17, 2023 17:41
rubysketch gem で作ったパラパラ漫画アプリ
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) }
@xord
xord / toon2.rb
Created October 17, 2023 01:51
rubysketch gem で作ったパラパラ漫画アプリ
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
@xord
xord / toon.rb
Created October 16, 2023 18:07
rubysketch gem で作ったパラパラ漫画アプリ
require 'rubysketch'
using RubySketch
class Canvas < Sprite
def initialize(width, height, scale: 1)
super 0, 0, width, height
@width, @height, @scale = width, height, scale
@xord
xord / OpenDuelystUnits.rb
Last active January 29, 2023 17:02
Show all OpenDuelyst units
require 'open-uri'
require 'rexml'
require 'processing'
using Processing
UNITS_DIR = 'units'
UNIT_URL_BASE = 'https://raw.githubusercontent.com/open-duelyst/duelyst/87bf66f414c476e3002857af2d1ed295f0d2471c/app/resources/units'
def next_unit()
@units ||= UNITS.dup()
@xord
xord / openduelyst_sprites.rb
Created January 20, 2023 16:56
OpenDuelyst の app/resources/units 以下を表示
require 'rexml'
def parse_plist(plist)
dict2hash REXML::Document.new(plist).elements['/plist']
end
def dict2hash(dict)
dict.reduce([{}, :root]) do |(hash, key), element|
case (element.name rescue nil)
when 'key'
@xord
xord / jump_action.rb
Last active December 17, 2015 17:19
簡単なジャンプアクションゲーム
# -*- coding: utf-8 -*-
%w[xot beeps rays reflex]
.map {|s| File.expand_path "../../../../#{s}/lib", __FILE__}
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
require 'reflexion/include'
$player =
$ground = nil
@xord
xord / gist:6059349
Last active December 20, 2015 02:49
test code.
#include <stdio.h>
#include <vector>
class View
{
public:
View (size_t count, int level)
{
if (level <= 0) return;