Sha256: bdf49c8b22f9680e2e8716537a978754bd073a12a30c35cbd1c2ee8eb59c1b16

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require "savio/version"
require 'ruby2d'

module Savio
  class Error < StandardError; end

  require 'savio/IORenderable.rb'
  require 'savio/InputBox.rb'
  require 'savio/Slider.rb'
  require 'savio/Button.rb'
  require 'savio/ButtonManager.rb'
  require 'savio/hsv2rgb.rb'
  require 'savio/ColorSlider.rb'
  require 'savio/Scene.rb'
  require 'savio/Colors.rb'
  require 'savio/io.rb'

  def self.makeBool(value)
    case value
      when true, 'true', 1, '1', 't' then true
      when false, 'false', nil, '', 0, '0', 'f' then false
    else
      return "no"
    end
  end

  def self.guessType(value)
    if value.to_i.to_s == value
      return "int"
    elsif value.to_f.to_s == value
      return "float"
    elsif value == "true" || value == "false"
      return "bool"
    else
      return "str"
    end
  end

  def self.listen()
    @listening = true
  end

  def self.stop()
    @listening = false
  end

  def self.listening
    return @listening
  end


  @elements = []
  def self.elements
    @elements
  end

  def self.addElement(element)
    @elements.push(element)
  end

  def self.removeElement(element)
    @elements.delete(element)
  end


  def self.hide
    @elements.each do |e|
      e.remove
    end
  end

  def self.unhide
    @elements.each do |e|
      e.add
    end
  end


end

include Savio
Savio.listen

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
savio-0.1.8 lib/savio.rb
savio-0.1.7 lib/savio.rb
savio-0.1.6 lib/savio.rb