Class: DXRubySDL::Font

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size, fontname = '', hash = {}) ⇒ Font

Returns a new instance of Font.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dxruby_sdl/font.rb', line 8

def initialize(size, fontname = '', hash = {})
  @size = size

  if !SDL::TTF.init?
    SDL::TTF.init
  end
  if !(path = FONTS[fontname.downcase])
    path = FONTS.first.last
  end
  @_ttf = SDL::TTF.open(path, size)
end

Instance Attribute Details

#_ttfObject (readonly)

Returns the value of attribute _ttf.



6
7
8
# File 'lib/dxruby_sdl/font.rb', line 6

def _ttf
  @_ttf
end

#sizeObject (readonly)

Returns the value of attribute size.



5
6
7
# File 'lib/dxruby_sdl/font.rb', line 5

def size
  @size
end