Module: Ray
- Defined in:
- lib/ray/pp.rb,
lib/ray/dsl.rb,
lib/ray/ray.rb,
lib/ray/font.rb,
lib/ray/game.rb,
lib/ray/rect.rb,
lib/ray/text.rb,
lib/ray/view.rb,
lib/ray/audio.rb,
lib/ray/color.rb,
lib/ray/event.rb,
lib/ray/image.rb,
lib/ray/music.rb,
lib/ray/scene.rb,
lib/ray/sound.rb,
lib/ray/effect.rb,
lib/ray/helper.rb,
lib/ray/matrix.rb,
lib/ray/shader.rb,
lib/ray/sprite.rb,
lib/ray/target.rb,
lib/ray/turtle.rb,
lib/ray/vector.rb,
lib/ray/vertex.rb,
lib/ray/window.rb,
lib/ray/polygon.rb,
lib/ray/drawable.rb,
lib/ray/font_set.rb,
lib/ray/animation.rb,
lib/ray/dsl/event.rb,
lib/ray/gl/vertex.rb,
lib/ray/image_set.rb,
lib/ray/pixel_bus.rb,
lib/ray/scene_list.rb,
lib/ray/dsl/handler.rb,
lib/ray/dsl/matcher.rb,
lib/ray/text_helper.rb,
lib/ray/audio_source.rb,
lib/ray/gl/int_array.rb,
lib/ray/image_target.rb,
lib/ray/resource_set.rb,
lib/ray/sound_buffer.rb,
lib/ray/animation_list.rb,
lib/ray/buffer_renderer.rb,
lib/ray/dsl/event_raiser.rb,
lib/ray/dsl/event_runner.rb,
lib/ray/effect/generator.rb,
lib/ray/effect/grayscale.rb,
lib/ray/sound_buffer_set.rb,
lib/ray/animation/sequence.rb,
lib/ray/dsl/event_listener.rb,
lib/ray/dsl/event_translator.rb,
lib/ray/animation/combination.rb,
lib/ray/effect/black_and_white.rb,
lib/ray/effect/color_inversion.rb,
lib/ray/animation/block_animation.rb,
lib/ray/animation/circular_motion.rb,
lib/ray/animation/color_variation.rb,
lib/ray/animation/float_variation.rb,
lib/ray/animation/sprite_animation.rb,
lib/ray/animation/vector_variation.rb,
ext/ray.c
Defined Under Namespace
Modules: Audio, DSL, FontSet, GL, Helper, ImageSet, Matchers, PP, ResourceSet, SoundBufferSet, TextHelper Classes: Animation, AnimationList, AudioSource, BufferRenderer, Color, Drawable, Effect, Event, Font, Game, Image, ImageTarget, Input, Key, KeyMod, Matrix, Music, NoKeyError, NoPatternError, NoRunnerError, PixelBus, Polygon, Rect, Scene, SceneList, Shader, Sound, SoundBuffer, Sprite, Target, Text, Turtle, Vector2, Vector3, Vertex, View, Window
Constant Summary collapse
- BigEndian =
True for big endian
([1].pack("I") == [1].pack("N"))
- InternalEncoding =
Encoding used by Ray for text_entered events.
BigEndian ? "UTF-32BE" : "UTF-32LE"
- Keys =
{}
- Mod =
{}
Class Method Summary collapse
- .describe_matcher(name) {|*args| ... } ⇒ Object
-
.font_set(regex) {|*args| ... } ⇒ Object
Creates a new font set.
-
.game(title, opts = {}) { ... } ⇒ Object
Creates a new game.
-
.image_set(regex) {|*args| ... } ⇒ Object
Creates a new image set.
-
.screen_size ⇒ Ray::Vector2
Size of the screen.
-
.sound_buffer_set(regex) {|*args| ... } ⇒ Object
Creates a new sound buffer set.
Instance Method Summary collapse
-
#almost ⇒ DSL::Matcher
A matcher matching a value close of x.
-
#anything ⇒ DSL::Matcher
A matcher matching anything (always true).
-
#colliding_with ⇒ DSL::Matcher
A matching matching any rect colliding with the argument.
-
#inside ⇒ DSL::Matcher
A matching matching any rect inside the argument.
-
#less_than ⇒ DSL::Matcher
A matcher matching anything that is less than x (comparaison using <).
-
#more_than ⇒ DSL::Matcher
A matcher matching anything greater than x (comparaison using >).
-
#outside ⇒ DSL::Matcher
A matching matching any rect outside the argument.
Class Method Details
.describe_matcher(name) {|*args| ... } ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/ray/dsl/matcher.rb', line 65 def describe_matcher(name, &create_block) Matchers.module_eval do define_method(name) do |*args| DSL::Matcher.new(&create_block.call(*args)) end module_function name end end |
.font_set(regex) {|*args| ... } ⇒ Object
Creates a new font set.
23 24 25 |
# File 'lib/ray/font_set.rb', line 23 def font_set(regex, &block) Ray::FontSet.add_set(regex, &block) end |
.game(title, opts = {}) { ... } ⇒ Object
Creates a new game.
240 241 242 |
# File 'lib/ray/game.rb', line 240 def game(title, opts = {}, &block) Ray::Game.new(title, opts, &block) end |
.image_set(regex) {|*args| ... } ⇒ Object
Creates a new image set.
22 23 24 |
# File 'lib/ray/image_set.rb', line 22 def image_set(regex, &block) Ray::ImageSet.add_set(regex, &block) end |
.screen_size ⇒ Ray::Vector2
Returns Size of the screen.
12 13 14 15 16 |
# File 'ext/ray.c', line 12 static VALUE ray_screen_size(VALUE self) { return ray_vector2_to_rb(say_make_vector2(say_imp_screen_get_width(), say_imp_screen_get_height())); } |
.sound_buffer_set(regex) {|*args| ... } ⇒ Object
Creates a new sound buffer set.
22 23 24 |
# File 'lib/ray/sound_buffer_set.rb', line 22 def sound_buffer_set(regex, &block) Ray::SoundBufferSet.add_set(regex, &block) end |
Instance Method Details
#almost ⇒ DSL::Matcher
the maximum and the minimum will only be computed once.
Returns A matcher matching a value close of x.
100 101 102 103 |
# File 'lib/ray/dsl/matcher.rb', line 100 describe_matcher(:almost) do |x, precision| min, max = (x - precision), (x + precision) lambda { |o| (o <= max) && (o >= min) } end |
#anything ⇒ DSL::Matcher
Returns A matcher matching anything (always true).
78 79 80 |
# File 'lib/ray/dsl/matcher.rb', line 78 describe_matcher(:anything) do lambda { |o| true } end |
#colliding_with(x, y[, w, h]) ⇒ DSL::Matcher #colliding_with(rect) ⇒ DSL::Matcher #colliding_with(array) ⇒ DSL::Matcher
Returns A matching matching any rect colliding with the argument.
131 132 133 134 |
# File 'lib/ray/dsl/matcher.rb', line 131 describe_matcher(:colliding_with) do |*args| rect = args.size > 1 ? Ray::Rect.new(*args) : args.first.to_rect lambda { |o| o.collide? rect } end |
#inside(x, y[, w, h]) ⇒ DSL::Matcher #inside(rect) ⇒ DSL::Matcher #inside(array) ⇒ DSL::Matcher
Returns A matching matching any rect inside the argument.
110 111 112 113 |
# File 'lib/ray/dsl/matcher.rb', line 110 describe_matcher(:inside) do |*args| rect = args.size > 1 ? Ray::Rect.new(*args) : args.first.to_rect lambda { |o| o.inside? rect } end |
#less_than ⇒ DSL::Matcher
Returns A matcher matching anything that is less than x (comparaison using <).
90 91 92 |
# File 'lib/ray/dsl/matcher.rb', line 90 describe_matcher(:less_than) do |x| lambda { |o| o < x } end |
#more_than ⇒ DSL::Matcher
Returns A matcher matching anything greater than x (comparaison using >).
84 85 86 |
# File 'lib/ray/dsl/matcher.rb', line 84 describe_matcher(:more_than) do |x| lambda { |o| o > x } end |
#outside(x, y[, w, h]) ⇒ DSL::Matcher #outside(rect) ⇒ DSL::Matcher #outside(array) ⇒ DSL::Matcher
Returns A matching matching any rect outside the argument.
120 121 122 123 |
# File 'lib/ray/dsl/matcher.rb', line 120 describe_matcher(:outside) do |*args| rect = args.size > 1 ? Ray::Rect.new(*args) : args.first.to_rect lambda { |o| o.outside? rect } end |