lib/gamebox/core/resource_manager.rb
# loads fonts from the fonts dir and caches them for later
loads fonts from the fonts dir and caches them for later
loads fonts from the fonts dir and caches them for later
def load_font(name, size)
    config = Gamebox.configuration
    fonts_path = config.fonts_path
    gb_fonts_path = config.gb_fonts_path
    @loaded_fonts[name] ||= {}
    return @loaded_fonts[name][size] if @loaded_fonts[name][size]
    begin
      if name =~ /^\// and File.exists?(name)
        font = Font.new(@window, name, size)
        @loaded_fonts[name][size] = font
      else
        full_name = fonts_path + name
        if File.exist? full_name
          font = Font.new(@window, full_name, size)
          @loaded_fonts[name][size] = font
        else
          full_name = gb_fonts_path + name
          font = Font.new(@window, full_name, size)
          @loaded_fonts[name][size] = font
        end
      end
      return font
    rescue Exception => ex
      log "Cannot load font #{full_name}:#{ex}"
    end
    return nil
  end
def load_font ( name , size ) config = Gamebox . configuration fonts_path = config . fonts_path gb_fonts_path = config . gb_fonts_path @loaded_fonts [ name ] ||= { } return @loaded_fonts [ name ] [ size ] if @loaded_fonts [ name ] [ size ] begin if name =~ / ^ \/ / and File . exists? ( name ) font = Font . new ( @window , name , size ) @loaded_fonts [ name ] [ size ] = font else full_name = fonts_path + name if File . exist? full_name font = Font . new ( @window , full_name , size ) @loaded_fonts [ name ] [ size ] = font else full_name = gb_fonts_path + name font = Font . new ( @window , full_name , size ) @loaded_fonts [ name ] [ size ] = font end end return font rescue Exception => ex log "Cannot load font #{full_name}:#{ex}" end return nil end
loads fonts from the fonts dir and caches them for later
loads fonts from the fonts dir and caches them for later
name
<not_specific>
size
<not_specific>