Class: Gosu::Font

Inherits:
Object
  • Object
show all
Defined in:
lib/ashton/gosu_ext/font.rb

Constant Summary collapse

DEFAULT_DRAW_COLOR =
Gosu::Color::WHITE

Instance Method Summary collapse

Instance Method Details

#draw(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ashton/gosu_ext/font.rb', line 7

def draw(*args)
  args, shader = if args.last.is_a?(Hash)
                   [args[0..-2], args.last[:shader]]
                 else
                   [args, nil]
                 end

  z = args[3]

  if shader
    shader.enable z
    $window.gl z do
      Gl.glActiveTexture Gl::GL_TEXTURE0 # Let's make an assumption :)
      shader.color = args[6].is_a?(Color) ? args[6] : DEFAULT_DRAW_COLOR
    end
  end

  begin
    draw_without_hash(*args)
  ensure
    shader.disable z if shader
  end
end

#draw_rel(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ashton/gosu_ext/font.rb', line 33

def draw_rel(*args)
  args, shader = if args.last.is_a?(Hash)
                   [args[0..-2], args.last[:shader]]
                 else
                   [args, nil]
                 end

  z = args[3]

  if shader
    shader.enable z
    $window.gl z do
      Gl.glActiveTexture GL::GL_TEXTURE0 # Let's make an assumption :)
      shader.color = args[8].is_a?(Color) ? args[8] : DEFAULT_DRAW_COLOR
    end
  end

  begin
    draw_rel_without_hash(*args)
  ensure
    shader.disable z if shader
  end
end