Module: Shoes::DSL::Media

Included in:
Shoes::DSL
Defined in:
shoes-core/lib/shoes/dsl/media.rb

Overview

DSL methods for handling media

See Also:

Instance Method Summary collapse

Instance Method Details

#image(*args, &blk) ⇒ Object

Deprecated.

Previously supported method for drawing an image. Very similar to shape. See github.com/shoes/shoes4/issues/1309 for details.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'shoes-core/lib/shoes/dsl/media.rb', line 13

def image(*args, &blk)
  if blk
    raise Shoes::NotImplementedError,
          'Sorry image does not support the block form in Shoes 4!' \
          ' Check out github issue #1309 for any changes/updates or if you' \
          ' want to help :)'
  else
    opts = style_normalizer.normalize pop_style(args)
    path, *leftovers = args

    message = <<~EOS
      Wrong number of arguments. Must be:
        - image(path, [opts])
EOS
    raise ArgumentError, message if leftovers.any?

    create Shoes::Image, path, opts
  end
end

#sound(soundfile, opts = {}, &blk) ⇒ Shoes::Sound

Play a sound from supported file formats.

Supported formats:

* aiff
* mp3
* ogg/vorbis
* wav

Parameters:

  • soundfile (String)

    location of sound to play

  • opts (Hash) (defaults to: {})

    none currently supported

Returns:



56
57
58
# File 'shoes-core/lib/shoes/dsl/media.rb', line 56

def sound(soundfile, opts = {}, &blk)
  Shoes::Sound.new @__app__, soundfile, opts, &blk
end

#video(*_args) ⇒ Object

Deprecated.

Previously supported method for showing video. Cut because codecs. See github.com/shoes/shoes4/issues/113 for details.



37
38
39
40
41
42
# File 'shoes-core/lib/shoes/dsl/media.rb', line 37

def video(*_args)
  raise Shoes::NotImplementedError,
        'Sorry video support has been cut from shoes 4!' \
        ' Check out github issue #113 for any changes/updates or if you' \
        ' want to help :)'
end