summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorMichael Appell <[email protected]>2016-08-28 17:56:30 -0400
committerMichael Appell <[email protected]>2016-08-28 17:56:30 -0400
commit4206c7d84977e40d092610fe35e2d937d693bd1c (patch)
tree756096607a467f8dfbf88b596dd0e0147f2c9339 /lib
parent858e025ba48d2b7a15d30aa20f820128ceb0d8f0 (diff)
downloadruby2d-4206c7d84977e40d092610fe35e2d937d693bd1c.tar.gz
ruby2d-4206c7d84977e40d092610fe35e2d937d693bd1c.zip
Made Text objects changeable dynamically
Modified text.rb so that the text= method modifies the instance variable Modified ruby2d.c so that before rendering Text objects, it sets their value to whatever their @text variable is Modified textcard.rb to demonstrate that Text objects can be dynamically changed
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/text.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb
index a695b31..9ba4e41 100644
--- a/lib/ruby2d/text.rb
+++ b/lib/ruby2d/text.rb
@@ -2,11 +2,11 @@
module Ruby2D
class Text
-
+
attr_accessor :x, :y, :size, :text
def initialize(x=0, y=0, size=20, msg="Hello World!", font="Arial", c="white")
-
+
if File.exists? font
@font = font
else
@@ -29,7 +29,7 @@ module Ruby2D
end
def text=(t)
-
+ @text = t
end
def remove
@@ -43,7 +43,7 @@ module Ruby2D
def resolve_path(font)
if RUBY_PLATFORM =~ /darwin/
font_path = "/Library/Fonts/#{font}.ttf"
- else
+ else
# Linux
font_path = "/usr/share/fonts/truetype/#{font}.ttf"
end