1. Anders Ruud
  2. love
  3. Issues

Issues

Issue #687 resolved

love.resize called when setMode called in love.load

hahawoo
created an issue

When setMode is called with the default width and height in love.load, love.resize is called:

function love.load()
    love.window.setMode(800, 600, {resizable = true})
end

function love.resize()
    love.graphics.setBackgroundColor(math.random(0, 255), math.random(0, 255), math.random(0, 255))
end

However if setMode is called with the default width and height outside of love.load, love.resize isn't called. Is... is this difference intentional?

Comments (5)

  1. hahawoo reporter

    This will ping on start up:

    pingsounddata = love.sound.newSoundData(44100,44100,16,1)
    for i=0, 44100 do pingsounddata:setSample(i, math.sin(440*2*(2*math.pi/44100)*i)*0.3*(-(i - 44100) / 44100)) end
    ping = love.audio.newSource(pingsounddata)
    
    function love.load()
        love.window.setMode(800, 600, {resizable = true})
    end
    
    function love.resize()
        ping:play()
    end
    

    And this will not, and the window will still be resizable:

    pingsounddata = love.sound.newSoundData(44100,44100,16,1)
    for i=0, 44100 do pingsounddata:setSample(i, math.sin(440*2*(2*math.pi/44100)*i)*0.3*(-(i - 44100) / 44100)) end
    ping = love.audio.newSource(pingsounddata)
    
    love.window.setMode(800, 600, {resizable = true})
    
    function love.resize()
        ping:play()
    end
    
  2. Log in to comment