Sha256: 8e40d871bf662ef46180b5af5ae574f4876af7c422999414f439a46da599e77c

Contents?: true

Size: 766 Bytes

Versions: 6

Compression:

Stored size: 766 Bytes

Contents

# -*- coding: utf-8 -*-


%w[xot beeps rays reflex]
  .map  {|s| File.expand_path "../../../#{s}/lib", __dir__}
  .each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}

require 'reflexion/include'


COLORS = [:red, :green, :blue, :orange, :yellow, :indigo, :pink, :peach, :brown]

count = 0

setup do
  size    600, 400
  gravity 0, 9.8 * meter
end

draw do
  text "#{event.fps.to_i} FPS | #{count} BLOCKS", 10, 10
end

pointer do
  if down? || drag?
    count += 1 if window.add View.new {
      pos        event.pos
      size       rand 20..40
      background event.right? ? :gray : COLORS.sample
      dynamic    event.left?
      shape      [RectShape, EllipseShape].sample.new(density: 1)
      interval(1) {fill rand, rand, rand}
    }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reflexion-0.1.35 samples/reflexion/physics.rb
reflexion-0.1.34 samples/reflexion/physics.rb
reflexion-0.1.33 samples/reflexion/physics.rb
reflexion-0.1.32 samples/reflexion/physics.rb
reflexion-0.1.31 samples/reflexion/physics.rb
reflexion-0.1.30 samples/reflexion/physics.rb