[Solved] love.resize OS difference?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
mhazaza
Prole
Posts: 4
Joined: Thu Oct 08, 2020 2:43 pm

[Solved] love.resize OS difference?

Post by mhazaza »

Does love.resize work different on Windows compared to Linux?
Resizing on Windows just freezes my app...I even tried to catch the change in window size manually in love.update() with no explicit resize callback involved but as long as the window the mouse button is held, all draw+game functions freeze on Windows 10. On Arch Linux it works just fine.
I looked it up in the wiki but the only thing tricky that's mentioned there was about fullscreen mode. I feel like i'm missing something, and appreciate every opinion you have on this. Thanks!
I have no os specific code i guess, so i feel like it's not about the code since it works fine with linux. I'll post my main.lua anyway...

Code: Select all

local display = Display:new()
local game = Game:new()
local resize
local scrolling
local scroll
function love.draw()
	if resize then
		love.graphics.setColor(0,0,0)
		love.graphics.rectangle("fill",0,0,love.graphics.getWidth(),love.graphics.getHeight())
	else
		display()
	end
end
function love.load()
	local pos = game:start()
	display:start(pos)
	buffer = display.pMap()
	display.pieces = new8x8(0)
	scroll = scrollFunction(display.pieces,buffer,function(m,m2,s)
		m[s.x][s.y] = m2[s.x][s.y]
		return s
	end)
	scrolling = 0
end
function love.update(dt)
	if resize then
		resize = resize + dt
		if resize > 0.5 then
			resize = false
			display:init()
		end
	end
	if scrolling then
		scrolling = scrolling + dt
		if scrolling > 1/60 then
			local s = scroll()
			if s then
				if display.float and s==display.float then
					display.pieces[s.x][s.y]=0
				end
				scrolling = scrolling -1/60
			else
				scrolling = false
			end
		end
	end
end
function love.resize()
	resize=0
end
Last edited by mhazaza on Fri Oct 09, 2020 9:30 am, edited 1 time in total.
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: love.resize OS difference?

Post by zorg »

Hi and welcome to the forums.

Windows itself pauses the main thread of processes when you drag or resize the window. Löve runs graphics (and everything else by default, as well) on the main thread.

Hence, yes, you will neither see anything drawn nor update during you doing those things in windows.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
mhazaza
Prole
Posts: 4
Joined: Thu Oct 08, 2020 2:43 pm

Re: love.resize OS difference?

Post by mhazaza »

Zorg, thank you so much!
I guess there is no way to catch this event before the main thread stops, right?
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 5 guests