Dissecting Mari0 - Loading Text

Discussion in 'The Edge of the Forum' started by Often, Mar 5, 2016.

  1. Often
    OP

    Often Newbie

    Newcomer
    0
    0
    Mar 5, 2016
    United States
    [​IMG]

    Code:
    function love.load()
    
       scale = 2
       
       love.graphics.setBackgroundColor(0, 0, 0)
       
       fontimage = love.graphics.newImage("graphics/SMB/font.png")
       
       fontglyphs = "0123456789abcdefghijklmnopqrstuvwxyz.:/,'C-_>* !{}?"
       
       fontquads = {}
       
       for i = 1, string.len(fontglyphs) do
       
         fontquads[string.sub(fontglyphs, i, i)] = love.graphics.newQuad((i-1)*8, 0, 8, 8, 512, 8)
         
       end
       
       love.graphics.setColor(100, 100, 100)
       
       loadingtexts = {"loading.."}
       
       loadingtext = loadingtexts[math.random(#loadingtexts)]
       
       love.graphics.present()
       
    end
    
    
    
    function love.draw()
    
       properprint(loadingtext, (20*4*scale-string.len(loadingtext)*2*scale)+1, (54*scale)+9)
       
    end
    
    
    
    function properprint(s, x, y)
    
       local startx = x
       
       for i = 1, string.len(tostring(s)) do
       
         local char = string.sub(s, i, i)
         
         if char == "|" then
         
           x = startx-((i)*8)*scale
           
           y = y + 10*scale
           
         elseif fontquads[char] then
         
          love.graphics.setScreen("bottom")
         
           love.graphics.draw(fontimage, fontquads[char], x+((i-1)*4)*scale, y, 0, 2, scale, scale)
           
         end
         
       end
       
    end
    
    
    
    function love.keypressed(key)
    
      if key == 'start' then
       
      love.event.quit()
         
      end
       
    end
     
  2. ElyosOfTheAbyss

    ElyosOfTheAbyss GBAtemp Addict

    Member
    2,214
    1,720
    Aug 20, 2015
    What is this exactly?
     
  3. EarlAB

    EarlAB hon hon titty croissants

    Banned
    680
    677
    Jul 25, 2012
    United States
    Somewhere.
    Call of Duty: YOUR MOM!
    Battlefield: YO MOMMA!!

    That's what they would say.
     
  4. ElyosOfTheAbyss

    ElyosOfTheAbyss GBAtemp Addict

    Member
    2,214
    1,720
    Aug 20, 2015
    wut?!?!?!?!?!!?
     
  5. EarlAB

    EarlAB hon hon titty croissants

    Banned
    680
    677
    Jul 25, 2012
    United States
    Somewhere.
    [​IMG]
     
  6. ElyosOfTheAbyss

    ElyosOfTheAbyss GBAtemp Addict

    Member
    2,214
    1,720
    Aug 20, 2015
    Nice glass
     
  7. EarlAB

    EarlAB hon hon titty croissants

    Banned
    680
    677
    Jul 25, 2012
    United States
    Somewhere.
    [​IMG]