Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

love.resize is not called when changing the size of the love.js canvas #59

Open
apicici opened this issue Apr 15, 2022 · 6 comments
Open
Labels
bug Something isn't working

Comments

@apicici
Copy link

apicici commented Apr 15, 2022

I just ported my game to love.js (it was a bit tricky because I'm also using fmod), and I noticed that love.resize is not called when the love.js canvas is resized (including when going to fullscreen mode). I have t.window.resizable = true in conf.lua and I tried on chromium and firefox on Linux.

Is this the expected behaviour? This seems to be a similar issue to #33 (I also get blurry fullscreen because love.resize is not called), but my understanding by reading the comments there is that setting t.window.resizable = true should lead to love.resize being called when changing the canvas size.

@Davidobot
Copy link
Owner

This should have been solved but see this #16 (comment)

@apicici
Copy link
Author

apicici commented Apr 15, 2022

I saw that when I was searching earlier, but I'm not sure how that can help. All of the things listed in that comment are already implemented in the index.html file, but the love.resize callback is never called (not even once). Is there a way to trigger love.resize from javascript?

@alexjgriffith
Copy link

To call lua (e.g. love.resize) from JS and vice versa, check out the Love.js API player, referenced in #26

https://github.com/MrcSnm/Love.js-Api-Player

@apicici
Copy link
Author

apicici commented Apr 21, 2022

To call lua (e.g. love.resize) from JS and vice versa, check out the Love.js API player, referenced in #26

https://github.com/MrcSnm/Love.js-Api-Player

I've been using that to make fmod work by calling JavaScript from lua, but it's not clear to me by reading the instructions how to call lua functions from JavaScript.

@alexjgriffith
Copy link

You can use JS.newRequest from within love to call a JavaScript function polling the size of the canvas and call love.resize when there is a change. Make sure you call JS.retrieveData in the update loop. Note, you will also have to run globalizeFS.js on the love.js file to get FS working in this fork. There are instructions in the README.

This is a bit of a hack. We could see about implementing stdin stdout for the module, which would let you interact with a repl.

@apicici
Copy link
Author

apicici commented Apr 21, 2022

I'll try that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants