summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTom Black <[email protected]>2016-07-16 16:26:08 -0500
committerTom Black <[email protected]>2016-07-16 16:26:08 -0500
commit543de7e0175cd162797415b579a1c7cba7d14f22 (patch)
tree402c2325f762f05b121b4c3b487c97f23caed4ec
parentae2f7d7015d26c12b4b7612a6c6c5703c58c5c57 (diff)
downloadruby2d-543de7e0175cd162797415b579a1c7cba7d14f22.tar.gz
ruby2d-543de7e0175cd162797415b579a1c7cba7d14f22.zip
Remove unneeded `Ruby2D::` namespacing
-rw-r--r--lib/ruby2d/dsl.rb11
-rw-r--r--lib/ruby2d/image.rb8
-rw-r--r--lib/ruby2d/quad.rb26
-rw-r--r--lib/ruby2d/rectangle.rb6
-rw-r--r--lib/ruby2d/square.rb6
-rw-r--r--lib/ruby2d/text.rb10
-rw-r--r--lib/ruby2d/triangle.rb20
7 files changed, 44 insertions, 43 deletions
diff --git a/lib/ruby2d/dsl.rb b/lib/ruby2d/dsl.rb
index 93fedb3..af9f598 100644
--- a/lib/ruby2d/dsl.rb
+++ b/lib/ruby2d/dsl.rb
@@ -2,23 +2,24 @@
module Ruby2D::DSL
def get(sym)
- Ruby2D::Application.get(sym)
+ Application.get(sym)
end
def set(opts)
- Ruby2D::Application.set(opts)
+ Application.set(opts)
end
def on(mouse: nil, key: nil, key_down: nil, controller: nil, &proc)
- Ruby2D::Application.on(mouse: mouse, key: key, key_down: key_down, controller: controller, &proc)
+ Application.on(mouse: mouse, key: key, key_down: key_down, controller: controller, &proc)
end
def update(&proc)
- Ruby2D::Application.update(&proc)
+ Application.update(&proc)
+ end
end
def show
- Ruby2D::Application.show
+ Application.show
end
def clear
diff --git a/lib/ruby2d/image.rb b/lib/ruby2d/image.rb
index 410fd14..5b29cee 100644
--- a/lib/ruby2d/image.rb
+++ b/lib/ruby2d/image.rb
@@ -14,14 +14,14 @@ module Ruby2D
@type_id = 3
@x, @y, @path = x, y, path
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
def remove
- if defined? Ruby2D::DSL
- Ruby2D::Application.remove(self)
+ if defined? DSL
+ Application.remove(self)
end
end
diff --git a/lib/ruby2d/quad.rb b/lib/ruby2d/quad.rb
index 08adf86..3185588 100644
--- a/lib/ruby2d/quad.rb
+++ b/lib/ruby2d/quad.rb
@@ -20,8 +20,8 @@ module Ruby2D
@color = c
update_color(c)
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
@@ -31,8 +31,8 @@ module Ruby2D
end
def remove
- if defined? Ruby2D::DSL
- Ruby2D::Application.remove(self)
+ if defined? DSL
+ Application.remove(self)
end
end
@@ -42,17 +42,17 @@ module Ruby2D
# If a valid color, use it for each vertex
if Color.is_valid? c
- @c1 = Ruby2D::Color.new(c)
- @c2 = Ruby2D::Color.new(c)
- @c3 = Ruby2D::Color.new(c)
- @c4 = Ruby2D::Color.new(c)
-
+ @c1 = Color.new(c)
+ @c2 = Color.new(c)
+ @c3 = Color.new(c)
+ @c4 = Color.new(c)
+
# If a valid array of colors, assign them to each vertex, respectively
elsif c.all? { |el| Color.is_valid? el }
- @c1 = Ruby2D::Color.new(c[0])
- @c2 = Ruby2D::Color.new(c[1])
- @c3 = Ruby2D::Color.new(c[2])
- @c4 = Ruby2D::Color.new(c[3])
+ @c1 = Color.new(c[0])
+ @c2 = Color.new(c[1])
+ @c3 = Color.new(c[2])
+ @c4 = Color.new(c[3])
else
raise Error, "Not a valid color for #{self.class}"
end
diff --git a/lib/ruby2d/rectangle.rb b/lib/ruby2d/rectangle.rb
index 54d972b..1ee30d5 100644
--- a/lib/ruby2d/rectangle.rb
+++ b/lib/ruby2d/rectangle.rb
@@ -1,7 +1,7 @@
# rectangle.rb
module Ruby2D
- class Rectangle < Ruby2D::Quad
+ class Rectangle < Quad
attr_reader :x, :y, :width, :height
@@ -11,8 +11,8 @@ module Ruby2D
update_coords(x, y, w, h)
update_color(c)
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
diff --git a/lib/ruby2d/square.rb b/lib/ruby2d/square.rb
index 6614c06..0be909f 100644
--- a/lib/ruby2d/square.rb
+++ b/lib/ruby2d/square.rb
@@ -1,7 +1,7 @@
# square.rb
module Ruby2D
- class Square < Ruby2D::Rectangle
+ class Square < Rectangle
attr_reader :size
@@ -12,8 +12,8 @@ module Ruby2D
update_coords(x, y, s, s)
update_color(c)
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb
index 93c2862..a695b31 100644
--- a/lib/ruby2d/text.rb
+++ b/lib/ruby2d/text.rb
@@ -18,8 +18,8 @@ module Ruby2D
@text, @color = msg, c
update_color(c)
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
@@ -33,8 +33,8 @@ module Ruby2D
end
def remove
- if defined? Ruby2D::DSL
- Ruby2D::Application.remove(self)
+ if defined? DSL
+ Application.remove(self)
end
end
@@ -56,7 +56,7 @@ module Ruby2D
end
def update_color(c)
- @c = Ruby2D::Color.new(c)
+ @c = Color.new(c)
end
end
diff --git a/lib/ruby2d/triangle.rb b/lib/ruby2d/triangle.rb
index d8f14d2..9bb0a4e 100644
--- a/lib/ruby2d/triangle.rb
+++ b/lib/ruby2d/triangle.rb
@@ -16,8 +16,8 @@ module Ruby2D
@color = c
update_color(c)
- if defined? Ruby2D::DSL
- Ruby2D::Application.add(self)
+ if defined? DSL
+ Application.add(self)
end
end
@@ -27,8 +27,8 @@ module Ruby2D
end
def remove
- if defined? Ruby2D::DSL
- Ruby2D::Application.remove(self)
+ if defined? DSL
+ Application.remove(self)
end
end
@@ -37,13 +37,13 @@ module Ruby2D
def update_color(c)
# If a 2D array
if c.class == Array && c.all? { |el| el.class == Array }
- @c1 = Ruby2D::Color.new(c[0])
- @c2 = Ruby2D::Color.new(c[1])
- @c3 = Ruby2D::Color.new(c[2])
+ @c1 = Color.new(c[0])
+ @c2 = Color.new(c[1])
+ @c3 = Color.new(c[2])
else
- @c1 = Ruby2D::Color.new(c)
- @c2 = Ruby2D::Color.new(c)
- @c3 = Ruby2D::Color.new(c)
+ @c1 = Color.new(c)
+ @c2 = Color.new(c)
+ @c3 = Color.new(c)
end
end