diff options
| author | Tom Black <[email protected]> | 2018-12-02 01:34:29 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2018-12-12 00:04:19 -0800 |
| commit | 0f52b2115a5f910ae4d3350f7400bb11622ea899 (patch) | |
| tree | 843cfd6db52bb812116ebee1e7655a2ba0feed93 /test | |
| parent | 80a2c9b1e14b5ed6a68107db407568e63547ac8d (diff) | |
| download | ruby2d-0f52b2115a5f910ae4d3350f7400bb11622ea899.tar.gz ruby2d-0f52b2115a5f910ae4d3350f7400bb11622ea899.zip | |
Remove current web backend
Preparing for WebAssembly
Diffstat (limited to 'test')
| -rw-r--r-- | test/audio.rb | 10 | ||||
| -rw-r--r-- | test/contains.rb | 12 | ||||
| -rw-r--r-- | test/sprite.rb | 16 | ||||
| -rw-r--r-- | test/testcard.rb | 24 |
4 files changed, 19 insertions, 43 deletions
diff --git a/test/audio.rb b/test/audio.rb index 8a0e8f6..64e580c 100644 --- a/test/audio.rb +++ b/test/audio.rb @@ -1,15 +1,9 @@ require 'ruby2d' -if RUBY_ENGINE == 'opal' - media = "../test/media" -else - media = "media" -end - set width: 300, height: 200, title: "Ruby 2D — Audio" -snd = Sound.new("#{media}/sound.wav") -mus = Music.new("#{media}/music.wav") +snd = Sound.new('media/sound.wav') +mus = Music.new('media/music.wav') volume_bar = Rectangle.new(color: 'green', width: 300, height: 50) diff --git a/test/contains.rb b/test/contains.rb index b24b898..d95a720 100644 --- a/test/contains.rb +++ b/test/contains.rb @@ -2,13 +2,7 @@ require 'ruby2d' set title: "Ruby 2D — Contains", height: 350 -if RUBY_ENGINE == 'opal' - media = "../test/media" - font = "sans-serif" -else - media = "media" - font = "#{media}/bitstream_vera/vera.ttf" -end +font = 'media/bitstream_vera/vera.ttf' objects = [] objects.push Square.new(x: 50, y: 50, size: 100) @@ -17,8 +11,8 @@ objects.push Quad.new(x1: 350, y1: 50, x2: 500, y2: 75, x3: 450, y3: 150, x4: 37 objects.push Triangle.new(x1: 550, y1: 50, x2: 600, y2: 125, x3: 500, y3: 150) objects.push Line.new(x1: 225, y1: 175, x2: 375, y2: 225, width: 20) objects.push Circle.new(x: 225, y: 275, radius: 50) -objects.push Image.new("#{media}/colors.png", x: 50, y: 200) -objects.push Text.new("Hello", x: 450, y: 200, size: 50, font: font) +objects.push Image.new('media/colors.png', x: 50, y: 200) +objects.push Text.new('Hello', x: 450, y: 200, size: 50, font: font) on :key_down do |event| close if event.key == 'escape' diff --git a/test/sprite.rb b/test/sprite.rb index e0042b7..321897c 100644 --- a/test/sprite.rb +++ b/test/sprite.rb @@ -1,15 +1,9 @@ require 'ruby2d' -if RUBY_ENGINE == 'opal' - media = "../test/media" -else - media = "media" -end - set title: "Ruby 2D — Sprite", width: 400, height: 300 coin1 = Sprite.new( - "#{media}/coin.png", + 'media/coin.png', clip_width: 84, time: 300, loop: true @@ -18,7 +12,7 @@ coin1 = Sprite.new( coin1.play coin2 = Sprite.new( - "#{media}/coin.png", + 'media/coin.png', y: 90, width: 42, height: 42, @@ -30,14 +24,14 @@ coin2 = Sprite.new( coin2.play boom = Sprite.new( - "#{media}/boom.png", + 'media/boom.png', x: 109, clip_width: 127, time: 75 ) hero = Sprite.new( - "#{media}/hero.png", + 'media/hero.png', x: 261, width: 78, height: 99, @@ -51,7 +45,7 @@ hero = Sprite.new( ) atlas = Sprite.new( - "#{media}/texture_atlas.png", + 'media/texture_atlas.png', x: 50, y: 90, animations: { count: [ diff --git a/test/testcard.rb b/test/testcard.rb index 21b627b..13ee01a 100644 --- a/test/testcard.rb +++ b/test/testcard.rb @@ -1,17 +1,11 @@ require 'ruby2d' -if RUBY_ENGINE == 'opal' - media = "../test/media" - font = "sans-serif" -else - media = "media" - font = "#{media}/bitstream_vera/vera.ttf" -end - set diagnostics: true set width: 700, height: 500, title: "Ruby 2D — Test Card" +font = 'media/bitstream_vera/vera.ttf' + # Read window attributes puts "=== Window Attributes === Title: #{get :title} @@ -206,15 +200,15 @@ Circle.new(x: 575, y: 225, radius: 17, sectors: 16, color: [0, 0, 0, 0.6]) rotate = false # Images -img_png = Image.new("#{media}/image.png", x: 600, y: 180) -img_jpg = Image.new("#{media}/image.jpg", x: 600, y: 290) -img_bmp = Image.new("#{media}/image.bmp", x: 600, y: 400) -img_r = Image.new("#{media}/colors.png", x: 400, y: 200, width: 50, height: 25) +img_png = Image.new('media/image.png', x: 600, y: 180) +img_jpg = Image.new('media/image.jpg', x: 600, y: 290) +img_bmp = Image.new('media/image.bmp', x: 600, y: 400) +img_r = Image.new('media/colors.png', x: 400, y: 200, width: 50, height: 25) img_r.color = [1.0, 0.3, 0.3, 1.0] -img_g = Image.new("#{media}/colors.png", x: 400, y: 225) +img_g = Image.new('media/colors.png', x: 400, y: 225) img_g.width, img_g.height = 25, 25 img_g.color = [0.3, 1.0, 0.3, 1.0] -img_b = Image.new("#{media}/colors.png", x: 425, y: 225) +img_b = Image.new('media/colors.png', x: 425, y: 225) img_b.width, img_b.height = 25, 25 img_b.color = [0.3, 0.3, 1.0, 1.0] @@ -228,7 +222,7 @@ fps = Text.new("", x: 10, y: 470, font: font) # Sprites spr = Sprite.new( - "#{media}/sprite_sheet.png", + 'media/sprite_sheet.png', x: 450, y: 200, clip_width: 50, time: 500, |
