rubydraw 0.2.2.4a → 0.2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rubydraw/text.rb +16 -2
- metadata +8 -11
data/lib/rubydraw/text.rb
CHANGED
@@ -21,13 +21,27 @@ module Rubydraw
|
|
21
21
|
raise(SDLError, "Failed to initialize font: #{SDL.GetError}") if @drawable.pointer.null?
|
22
22
|
end
|
23
23
|
|
24
|
+
# Returns the sdl surface of this text object.
|
25
|
+
def sdl_surface
|
26
|
+
sdl_color = @color.to_sdl
|
27
|
+
SDL::TTF.RenderText_Blended(@drawable, @contents, sdl_color)
|
28
|
+
end
|
29
|
+
|
24
30
|
# Draw the font in the given window at a position.
|
25
31
|
def draw(window, position)
|
26
|
-
sdl_color = @color.to_sdl
|
27
|
-
sdl_surface = SDL::TTF.RenderText_Blended(@drawable, @contents, sdl_color)
|
28
32
|
source_rect = Rectangle[Point[0, 0], Point[sdl_surface.w, sdl_surface.h]]
|
29
33
|
blit_rect = Rectangle[position, Point[window.width, window.height]]
|
30
34
|
SDL::BlitSurface(sdl_surface, source_rect.to_sdl, window.sdl_surface, blit_rect.to_sdl)
|
31
35
|
end
|
36
|
+
|
37
|
+
# Returns the width.
|
38
|
+
def width
|
39
|
+
sdl_surface.w
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns the height.
|
43
|
+
def height
|
44
|
+
sdl_surface.h
|
45
|
+
end
|
32
46
|
end
|
33
47
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydraw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 93
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 2
|
10
|
-
-
|
11
|
-
|
12
|
-
version: 0.2.2.4a
|
10
|
+
- 5
|
11
|
+
version: 0.2.2.5
|
13
12
|
platform: ruby
|
14
13
|
authors:
|
15
14
|
- J. Wostenberg
|
@@ -103,14 +102,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
103
|
none: false
|
105
104
|
requirements:
|
106
|
-
- - "
|
105
|
+
- - ">="
|
107
106
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
107
|
+
hash: 3
|
109
108
|
segments:
|
110
|
-
-
|
111
|
-
|
112
|
-
- 1
|
113
|
-
version: 1.3.1
|
109
|
+
- 0
|
110
|
+
version: "0"
|
114
111
|
requirements: []
|
115
112
|
|
116
113
|
rubyforge_project:
|