diff options
| author | Tom Black <[email protected]> | 2015-12-26 00:00:52 -0600 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2015-12-26 00:00:52 -0600 |
| commit | ab8ca7894552a54781112938032a94a80c10b573 (patch) | |
| tree | 53aaebb528386b9523c094dbb2c71e3a251ecf1f | |
| parent | 9f7ff8d1ba22de93efe297428414040ddf3c1679 (diff) | |
| download | ruby2d-ab8ca7894552a54781112938032a94a80c10b573.tar.gz ruby2d-ab8ca7894552a54781112938032a94a80c10b573.zip | |
Add placeholders for new Text functionality
- Changing text colors
- Updating text content
| -rw-r--r-- | lib/ruby2d/text.rb | 5 | ||||
| -rw-r--r-- | tests/testcard.rb | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/ruby2d/text.rb b/lib/ruby2d/text.rb index b92f348..2dd36e9 100644 --- a/lib/ruby2d/text.rb +++ b/lib/ruby2d/text.rb @@ -31,6 +31,10 @@ module Ruby2D update_color(c) end + def text=(t) + + end + def remove if defined? Ruby2D::DSL Ruby2D::Application.remove(self) @@ -40,6 +44,7 @@ module Ruby2D private def resolve_path(font) + # TODO: Consider CSS names, like 'serif', 'san-serif', 'monospace' if RUBY_PLATFORM =~ /darwin/ font_path = "/Library/Fonts/#{font}.ttf" unless File.exists? font_path diff --git a/tests/testcard.rb b/tests/testcard.rb index a915bfa..0dda5a2 100644 --- a/tests/testcard.rb +++ b/tests/testcard.rb @@ -134,15 +134,18 @@ Image.new(580, 400, "media/image.bmp") # Text Text.new(0, 250) # Default message -Text.new(0, 275, 30, "Hello Ruby 2D!") # Custom message - +t = Text.new(0, 275, 30, "Hello Ruby 2D!") # Custom message +t.color = 'red' +fps = Text.new(0, 325, 20) # Pointer for mouse -pointer = Square.new(0, 0, 10, 'red') +pointer = Square.new(0, 0, 10, 'white') update do pointer.x = (get :mouse_x) - 5 pointer.y = (get :mouse_y) - 7 + + fps.text = "FPS: #{get :fps}" end show |
