This file contains hidden or 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
# encoding: UTF-8 | |
# module encapsulating run | |
module Runner | |
def run | |
move | |
render | |
bounds_collision | |
end | |
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
web = %w{#841B2D #c0c0c0 #ffd700} | |
names = %i{RUBY SILVER GOLD} | |
colours = names.zip(web).to_h | |
background color(colours[:GOLD]) | |
This file contains hidden or 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
# Visualizer | |
# After http://dry.ly/ruby-music-visualizer by David Guttman | |
# Load minim and import the packages we'll be using | |
load_library :minim | |
import 'ddf.minim' | |
import 'ddf.minim.analysis' | |
attr_reader :beat, :current_ffts, :dim, :fft, :freqs, :input | |
attr_reader :fft_smoothing, :max_ffts, :minim, :scaled_ffts |
This file contains hidden or 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
# Java::OrgJrubyExceptions::RaiseException | |
# (ArgumentError) wrong number of arguments calling `initialize` (3 for 0) | |
# RUBY.mouse_moved(mesh_doodle.rb:62) | |
attr_reader :prev, :p, :q, :rotation, :faces, :pos, :weight, :renderer | |
Face = Struct.new(:a, :b, :c) | |
class Vec3D # re-open the Vec3D class to add rotation functionality | |
def rotate_y(theta) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
# bounce.rb | |
class Bounce < Processing::App | |
BLUE = '#0000FF' | |
GREEN = '#00FF00' | |
RED = '#FF0000' | |
WHITE = '#FFFFFF' | |
BALL_SPEED = 5 | |
BALL_SIZE = 32 |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<extensions> | |
<extension> | |
<groupId>io.takari.polyglot</groupId> | |
<artifactId>polyglot-ruby</artifactId> | |
<version>0.1.11</version> | |
</extension> | |
</extensions> |
This file contains hidden or 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
// Original shader by RavenWorks | |
// Fake Floyd-Steinberg dithering | |
// https://www.shadertoy.com/view/4sjGRD | |
// Adapted for Ruby-Processing by Martin Prout <@monkstoneT> | |
#ifdef GL_ES | |
precision mediump float; | |
precision mediump int; | |
#endif |
This file contains hidden or 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 'forwardable' | |
# A custom Array created using forwardable (that can also access the PApplet pre, | |
# post and draw loops by extending our new LibraryProxy class. Also has access | |
# to custom background(int), fill(int) and stroke(int) methods. | |
class CustomArray < LibraryProxy | |
extend Forwardable | |
def_delegators(:@objs, :each, :<<) | |
include Enumerable |