summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorlstrzebinczyk <[email protected]>2017-05-29 00:06:03 +0200
committerTom Black <[email protected]>2017-06-25 17:15:50 -0400
commitadb7c2340c37ae624982b36f3bd017b130af2875 (patch)
tree57ebbfbfbcf40e270bab30c85cc4033b7c026a18 /lib
parent06a343c35a4a39bfe082719ebff7b5fad1d1db77 (diff)
downloadruby2d-adb7c2340c37ae624982b36f3bd017b130af2875.tar.gz
ruby2d-adb7c2340c37ae624982b36f3bd017b130af2875.zip
Dispatch rendering to rendered classes (#66)
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/image.rb4
-rw-r--r--lib/ruby2d/line.rb2
-rw-r--r--lib/ruby2d/music.rb12
-rw-r--r--lib/ruby2d/quad.rb2
-rw-r--r--lib/ruby2d/rectangle.rb2
-rw-r--r--lib/ruby2d/sound.rb4
-rw-r--r--lib/ruby2d/sprite.rb3
-rw-r--r--lib/ruby2d/square.rb1
-rw-r--r--lib/ruby2d/text.rb6
-rw-r--r--lib/ruby2d/triangle.rb2
-rw-r--r--lib/ruby2d/window.rb4
11 files changed, 14 insertions, 28 deletions
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb
index 0faee11..3ac705d 100644
--- a/lib/ruby2d/image.rb
+++ b/lib/ruby2d/image.rb
@@ -22,11 +22,9 @@ module Ruby2D
@width = opts[:width] || nil
@height = opts[:height] || nil
- @type_id = 4
-
self.color = opts[:color] || 'white'
- ext_image_init(@path)
+ ext_init(@path)
add
end
diff --git a/lib/ruby2d/line.rb b/lib/ruby2d/line.rb
index 7d1645c..e112f19 100644
--- a/lib/ruby2d/line.rb
+++ b/lib/ruby2d/line.rb
@@ -6,8 +6,6 @@ module Ruby2D
attr_accessor :x1, :x2, :y1, :y2, :color, :width
def initialize(opts = {})
- @type_id = 3
-
@x1 = opts[:x1] || 0
@y1 = opts[:y1] || 0
@x2 = opts[:x2] || 100
diff --git a/lib/ruby2d/music.rb b/lib/ruby2d/music.rb
index 2437019..57d5e29 100644
--- a/lib/ruby2d/music.rb
+++ b/lib/ruby2d/music.rb
@@ -16,27 +16,27 @@ module Ruby2D
@path = path
@loop = false
- ext_music_init(path)
+ ext_init(path)
end
def play
- ext_music_play
+ ext_play
end
def pause
- ext_music_pause
+ ext_pause
end
def resume
- ext_music_resume
+ ext_resume
end
def stop
- ext_music_stop
+ ext_stop
end
def fadeout(ms)
- ext_music_fadeout(ms)
+ ext_fadeout(ms)
end
end
end
diff --git a/lib/ruby2d/quad.rb b/lib/ruby2d/quad.rb
index cb72c31..f2806ee 100644
--- a/lib/ruby2d/quad.rb
+++ b/lib/ruby2d/quad.rb
@@ -16,8 +16,6 @@ module Ruby2D
attr_reader :color
def initialize(opts = {})
- @type_id = 2
-
@x1 = opts[:x1] || 0
@y1 = opts[:y1] || 0
@x2 = opts[:x2] || 100
diff --git a/lib/ruby2d/rectangle.rb b/lib/ruby2d/rectangle.rb
index 392c217..4b9db5e 100644
--- a/lib/ruby2d/rectangle.rb
+++ b/lib/ruby2d/rectangle.rb
@@ -6,8 +6,6 @@ module Ruby2D
attr_reader :x, :y, :width, :height
def initialize(opts = {})
- @type_id = 2
-
@x = opts[:x] || 0
@y = opts[:y] || 0
@z = opts[:z] || 0
diff --git a/lib/ruby2d/sound.rb b/lib/ruby2d/sound.rb
index c7b03e6..c9fce54 100644
--- a/lib/ruby2d/sound.rb
+++ b/lib/ruby2d/sound.rb
@@ -15,11 +15,11 @@ module Ruby2D
end
@path = path
- ext_sound_init(path)
+ ext_init(path)
end
def play
- ext_sound_play
+ ext_play
end
end
diff --git a/lib/ruby2d/sprite.rb b/lib/ruby2d/sprite.rb
index 999e66d..5e88975 100644
--- a/lib/ruby2d/sprite.rb
+++ b/lib/ruby2d/sprite.rb
@@ -12,7 +12,6 @@ module Ruby2D
# raise Error, "Cannot find image file `#{path}`"
# end
- @type_id = 5
@x, @y, @path = x, y, path
@clip_x, @clip_y, @clip_w, @clip_h = 0, 0, 0, 0
@default = nil
@@ -22,7 +21,7 @@ module Ruby2D
@current_frame_time = 0
@z = z
- ext_sprite_init(path)
+ ext_init(path)
if Module.const_defined? :DSL
Application.add(self)
end
diff --git a/lib/ruby2d/square.rb b/lib/ruby2d/square.rb
index 187d48d..1a862b9 100644
--- a/lib/ruby2d/square.rb
+++ b/lib/ruby2d/square.rb
@@ -6,7 +6,6 @@ module Ruby2D
attr_reader :size
def initialize(opts = {})
- @type_id = 2
@x = opts[:x] || 0
@y = opts[:y] || 0
@z = opts[:z] || 0
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb
index c9f5bb2..87fe4d3 100644
--- a/lib/ruby2d/text.rb
+++ b/lib/ruby2d/text.rb
@@ -8,8 +8,6 @@ module Ruby2D
attr_reader :text, :size, :width, :height, :font, :color
def initialize(opts = {})
- @type_id = 6
-
@x = opts[:x] || 0
@y = opts[:y] || 0
@z = opts[:z] || 0
@@ -25,13 +23,13 @@ module Ruby2D
end
self.color = opts[:color] || 'white'
- ext_text_init
+ ext_init
add
end
def text=(msg)
@text = msg.to_s
- ext_text_set(@text)
+ ext_set(@text)
end
def color=(c)
diff --git a/lib/ruby2d/triangle.rb b/lib/ruby2d/triangle.rb
index 255b19c..0d34b76 100644
--- a/lib/ruby2d/triangle.rb
+++ b/lib/ruby2d/triangle.rb
@@ -10,8 +10,6 @@ module Ruby2D
attr_reader :color, :type_id
def initialize(opts= {})
- @type_id = 1
-
@x1 = opts[:x1] || 50
@y1 = opts[:y1] || 0
@x2 = opts[:x2] || 100
diff --git a/lib/ruby2d/window.rb b/lib/ruby2d/window.rb
index 377523b..d3e8143 100644
--- a/lib/ruby2d/window.rb
+++ b/lib/ruby2d/window.rb
@@ -228,11 +228,11 @@ module Ruby2D
end
def show
- ext_window_show
+ ext_show
end
def close
- ext_window_close
+ ext_close
end
private