panda_canvas 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,8 @@ module PandaCanvas
24
24
  end
25
25
 
26
26
  # Sets the font with name +font_name+ and +height+ in pixels to be used when drawing text.
27
- def font(font_name, height)
27
+ # All subsequent text drawing calls will use the given font.
28
+ def font(height, font_name=Gosu::default_font_name)
28
29
  key = [font_name, height]
29
30
  if @used_fonts.include? key
30
31
  @font = @used_fonts[key]
@@ -42,7 +43,7 @@ module PandaCanvas
42
43
  end
43
44
 
44
45
  # Draws text +s+ in coordinates +x+ and +y+ with a given +color+.
45
- def text(s, x, y, color)
46
+ def text(s, x, y, color=0xffffffff)
46
47
  color = sym_color(color) if color.is_a? Symbol
47
48
  @font.draw(s, x, y, 0, 1, 1, color)
48
49
  end
@@ -53,7 +54,7 @@ module PandaCanvas
53
54
  # If it is 1.0, the text will be to the left of +x+.
54
55
  # If it is 0.5, it will be centered on +x+.
55
56
  # The same applies to +rel_y+.
56
- def text_rel(s, x, y, rel_x, rel_y, color)
57
+ def text_rel(s, x, y, rel_x, rel_y, color=0xffffffff)
57
58
  color = sym_color(color) if color.is_a? Symbol
58
59
  @font.draw_rel(s, x, y, 0, rel_x, rel_y, 1, 1, color)
59
60
  end
@@ -8,7 +8,7 @@ module PandaCanvas
8
8
  FLUSH = [:flush].freeze
9
9
 
10
10
  # Signature set for defaults that are executed in each update event.
11
- CANVAS_UPDATE = [[:font, Gosu::default_font_name, 12]]
11
+ CANVAS_UPDATE = [[:font, 12]]
12
12
 
13
13
  # Names of calls that need to be sent directly to Canvas instead of the TexPlay image on draw.
14
14
  CANVAS_CALLS = [:font, :text, :text_rel].freeze
@@ -33,19 +33,6 @@ module PandaCanvas
33
33
  end
34
34
  end
35
35
 
36
- # Adds a font change call to +font_name+ with +height+ in pixels.
37
- # Uses default typeface, if +font_name+ is +nil+.
38
- # All subsequent text drawing calls will use the given font.
39
- def font(height, font_name=nil)
40
- @_calls << [:font, font_name || Gosu::default_font_name, height]
41
- end
42
-
43
- # Adds text +s+ to be drawn on screen with current font and +color+.
44
- # Text is placed in +x+ and +y+ coordinates.
45
- def text(s, x, y, color=0xffffffff)
46
- @_calls << [:text, s, x, y, color]
47
- end
48
-
49
36
  end # CleanRoom
50
37
 
51
38
  end # PandaCanvas
@@ -1,6 +1,6 @@
1
1
  module PandaCanvas
2
2
 
3
3
  # PandaCanvas version.
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
 
6
6
  end # end PandaCanvas
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dimitry Solovyov
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-18 00:00:00 +03:00
17
+ date: 2010-10-19 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency